Subject: bug#11358: 24.1.50; Feature request: A way to abort emacs-client

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 04 Jun 2021 11:13:24 +0200

Harald Hanche-Olsen <[email-masked]> writes:

> 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.

Thanks, I installed this in Emacs 28 (under the name
server-edit-abort).  This, along with your previous patch, reaches the
limit of the number of lines we can accept into Emacs without a
copyright assignment.  Would you be willing to sign such paperwork?

> 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.

Yes, I think that makes sense.  If somebody wants to add more logic
here (to query the user for something), that might also be nice.  But it
may not be necessary.

> 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.

Yeah, I think aborting just the current buffer makes sense, but I can
see somebody wanting this to behave more like `server-edit' -- I guess
we'll see.  But I think this is fine for now, at least, so I'm closing
this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no