emacsclient:tldr:e488f
The command emacsclient --eval '(save-buffers-kill-emacs)' is used to send an Emacs Lisp expression to an already running Emacs session and executes it. Let's break it down:
-
emacsclient: This is the command-line program used to interact with a running Emacs instance. It is typically used as a way to open files in an already running Emacs session. -
--eval: It is an argument to theemacsclientcommand that tells it to evaluate and execute the given Emacs Lisp expression. -
'(save-buffers-kill-emacs)': This is the Emacs Lisp expression that will be evaluated by the running Emacs session. In this case, it is calling thesave-buffers-kill-emacsfunction, which will prompt Emacs to save all modified buffers and then exit Emacs.
So, when you run emacsclient --eval '(save-buffers-kill-emacs)' in the terminal, it will send the expression (save-buffers-kill-emacs) to the running Emacs session, which will then save all modified buffers and close Emacs.