es 574 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. # simple script to shutdown the running Emacs daemon
  3. # emacsclient options for reference
  4. # -a Alternate editor, runs bin/false in this case
  5. # -e eval the script
  6. # If the server-process is bound and the server is in a good state, then kill
  7. # the server
  8. server_ok() {
  9. emacsclient -a "false" -e "(boundp 'server-process)"
  10. }
  11. if [ "t" == "$(server_ok)" ]; then
  12. echo "Shutting down Emacs server"
  13. # wasn't removing emacs from ALT-TAB on mac
  14. # emacsclient -e "(server-force-delete)"
  15. emacsclient -e '(kill-emacs)'
  16. else
  17. echo "Emacs server not running"
  18. fi