I'm trying to write a script using emacs --script
and in it I am using start-process
, because I want to use set-process-filter
.
The following does nothing if run as a script:
#!/usr/bin/env -S emacs -Q --script # -*- mode: emacs-lisp; lexical-binding: t; -*-
(let ((p (start-process "subcommand" nil "notify-send" "Hello!")))
(set-process-sentinel p (lambda (process signal)
(start-process "notify" nil "notify-send" "Hello again!")))
(set-process-filter p (lambda (process output)
(message output)))
;; (while t)
)
However, if I run that same elisp in my gui emacs I get to notifications (one for hello and one for hello again). I tried to solve this using a no-op loop (commented out), but that only allowed the first hello to be sent out. Basically, I want emacs to wait for it's subprocess to finish before exiting.
I'm not sure where to go from here. Any ideas on how I can get something like this working?