Big issue with emacsclient when launching alternate editor with eval instructions: it considers the --eval Lisp code a file name, which it opens as a buffer. Instead, use -a "" which launches Emacs with daemon on if no daemon is running. Also, instead of using a SystemD service for Emacs, let's just manage it via emacsclient. Less dependence on it then.
21 lines
753 B
Bash
Executable File
21 lines
753 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
case "$(printf "new\nstop\nrestart\neshell\nmail" | dmenu -p "eserver: ")" in
|
|
"restart")
|
|
emacsclient --eval "(save-buffers-kill-emacs)";
|
|
emacs --bg-daemon;
|
|
notify-send "eselect: Restarted Emacs server";;
|
|
"stop")
|
|
emacsclient --eval "(save-buffers-kill-emacs)";
|
|
notify-send "eselect: Halted Emacs server";;
|
|
"new")
|
|
notify-send "eselect: Launching Emacs";
|
|
emacsclient -c -a "";;
|
|
"eshell")
|
|
notify-send "eselect: Launching Eshell";
|
|
emacsclient -c -a "" --eval "(progn (eshell) (delete-other-windows))";;
|
|
"mail")
|
|
notify-send "eselect: Launching notmuch";
|
|
emacsclient -c -a "" --eval "(progn (notmuch) (delete-other-windows))";;
|
|
esac
|