From 4d25ef6b5bc05989542fb232747bc71b80b37575 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Wed, 7 Feb 2024 06:33:39 +0100 Subject: [PATCH] docs(scripts): add script for restarting Emacs --- docs/scripts.org | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/scripts.org b/docs/scripts.org index 0a6ed93..de1563c 100644 --- a/docs/scripts.org +++ b/docs/scripts.org @@ -550,6 +550,24 @@ in order to send to Emacs any ~mailto:~ requests made in my system. emacsclient -c -n -a emacs -e "(browse-url-mail \"$*\")" #+END_SRC +*** Restart Emacs +:PROPERTIES: +:HEADER-ARGS: :shebang "#!/bin/bash" :mkdirp yes :tangle ~/.local/bin/restart-emacs +:END: +Believe me or not, it happens I restart Emacs. I generally start Emacs +manually with =emacs --daemon= because of an issue rendering =lsp-mode= +useless when started by the user systemd service. +#+begin_src bash +PID_EMACS=$(pidof emacs) +killall emacs +echo "Waiting for Emacs to be killed... (pid: $PID_EMACS)" +if timeout 30 tail --pid=$PID_EMACS -f /dev/null ; then + emacs --daemon +else + echo "Failed to kill Emacs after 30s" +fi +#+end_src + ** Media *** mp42webm :PROPERTIES: