I am running Emacs 27.1 on Ubuntu.
I have installed
gif-screencast and have gotten it to start recording whenever i start Emacs by adding
init.el. So far, so good. The problem is saving the recording when killing Emacs. I have tried to add both
(add-hook 'kill-emacs-hook 'gif-screencast-stop)
(setq confirm-kill-emacs 'gif-screencast-stop)
init.el, but none of them manage to stop the recording and save it before Emacs asks me whether I want to kill running processes. When I answer 'yes', it will, of course, kill the
gif-screencast process before ending it properly.
My current solution, arrived at by trial and error, is to add
(advice-add 'save-buffers-kill-emacs :before #'gif-screencast-stop)
init.el. This works when killing Emacs by using the GUI menu, but not when using
C-x C-c from within Emacs. When I try the latter, i get
Wrong number of arguments: (0.0), 1. When I do the former, it correctly saves the
gif-screencast recording before giving me the
Save file ...? prompt and then killing Emacs.
Edit: it gives me 2 prompts:
First, it gives me
Active processes exist; kill them and exit anyway?, then it gives me
Save file ...?. The first one of these is the one that has to wait until after
gif-screencast has properly finished.
My syntax is wrong somehow, but I'm not experienced enough with
elisp to figure it out.
How do I make this execute correctly also when killing Emacs with