unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Harald Hanche-Olsen <harald.hanche-olsen@ntnu.no>
To: Eli Zaretskii <eliz@gnu.org>, Lars Ingebrigtsen <larsi@gnus.org>
Cc: "11358@debbugs.gnu.org" <11358@debbugs.gnu.org>,
	"npostavs@users.sourceforge.net" <npostavs@users.sourceforge.net>
Subject: bug#11358: 24.1.50; Feature request: A way to abort emacs-client
Date: Thu, 3 Jun 2021 14:46:33 +0000	[thread overview]
Message-ID: <1AC8AF23-F1EB-4A0D-B702-8931B318B36D@ntnu.no> (raw)
In-Reply-To: <83wnrbwfg8.fsf@gnu.org>

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



  reply	other threads:[~2021-06-03 14:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-27  7:44 bug#11358: 24.1.50; Feature request: A way to abort emacs-client Harald Hanche-Olsen
2016-07-07  1:07 ` npostavs
2021-06-02  6:38   ` Lars Ingebrigtsen
2021-06-02  7:05     ` Harald Hanche-Olsen
2021-06-03  7:07       ` Lars Ingebrigtsen
2021-06-03  7:54         ` Eli Zaretskii
2021-06-03 14:46           ` Harald Hanche-Olsen [this message]
2021-06-04  9:13             ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1AC8AF23-F1EB-4A0D-B702-8931B318B36D@ntnu.no \
    --to=harald.hanche-olsen@ntnu.no \
    --cc=11358@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).