emacsclient -a 'emacs-server-start' -nw --socket-name=$TTY, where
emacs-server-start is a script that runs
emacs --daemon="$TTY" (I use
$TTY to get a different client for each terminal instance).
This works well, when I edit a file like
e file (here
e is an alias to the above
emacsclient command), it edits the file. However, sometimes, if I then close emacs (
C-x C-c) and try to edit the same file again with
e file, emacs starts and immediately closes. I have to start emacsclient without the file in the command line argument and navigate to it with
C-x C-f or
I think I know how to reproduce this. I believe what is happening is that sometimes I will have a buffer open with a file that gets modified on disk (by being edited by another emacs session, or more commonly, by being checkout on disk). The file will have no edits, so won't be seen by emacs as being in need of saving. Hence
C-x C-c won't prompt. However, for whatever reason, this keeps the buffer from being killed when this happens. Perhaps the "do you want to revert this buffer" prompt is canceling it somehow.
Assuming my deductions are correct, how can I tell
server-save-buffers-kill-terminal to always kill buffers that don't need saving, regardless of whether or not they have changed on disk?