[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11358: 24.1.50; Feature request: A way to abort emacs-client
From: |
Harald Hanche-Olsen |
Subject: |
bug#11358: 24.1.50; Feature request: A way to abort emacs-client |
Date: |
Thu, 3 Jun 2021 14:46:33 +0000 |
User-agent: |
Microsoft-MacOutlook/16.49.21050901 |
Here is a very naive first stab:
(defun server-abort ()
(interactive)
(if server-clients
(mapc (lambda (proc)
(server-send-string
proc (concat "-error "
(server-quote-arg "Aborted by the user"))))
server-clients)
(message "This buffer has no clients")))
That is good enough for me, but ‘server-edit’ (or ‘server-done’, really)
does a bit of housekeeping that this one does not.
Most importantly, what this code does not is decide what to do
with the buffer. It appears that, if it is unmodified, a process sentinel
will delete it, but if it is modified, it remains. Perhaps that is okay.
Perhaps aborting a server is such an exceptional event, one should
leave the cleanup to the user anyhow.
Further ‘server-edit’ will try to switch to a different server buffer,
if one exists. This code does not. Again, perhaps that is as it should be.
– Harald