unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Harald Hanche-Olsen <hanche@math.ntnu.no>
Cc: 11358@debbugs.gnu.org
Subject: bug#11358: 24.1.50; Feature request: A way to abort emacs-client
Date: Wed, 06 Jul 2016 21:07:30 -0400	[thread overview]
Message-ID: <878txecl2l.fsf@users.sourceforge.net> (raw)
In-Reply-To: <20120427.094458.962283820717487751.hanche@math.ntnu.no> (Harald Hanche-Olsen's message of "Fri, 27 Apr 2012 09:44:58 +0200 (CEST)")

Harald Hanche-Olsen <hanche@math.ntnu.no> writes:

> There should be a way, from within a server editing buffer, to cause
> the corresponding emacs-client process to exit with a nonzero exit
> status. This can then be used by the calling process as an indication
> that the user has abandoned the edit.
>
> If there is already a way to achieve this, consider this a
> documentation bug: I am certainly unable to find this feature.

There is a way to do this, I know because it's used by magit to tell git
to cancel the commit message editing (with-editor is a library that was
spun off from magit):

(defun with-editor-return (cancel)
  (let ...
        (clients server-buffer-clients)
...
               (dolist (client clients)
                 (ignore-errors
                   (server-send-string client "-error Canceled by user"))
...


The only documentation I could find on it was in server-process-filter
docstring:

(cl-defun server-process-filter (proc string)
  "Process a request from the server to edit some files.
PROC is the server process. [...]
The following commands are accepted by the client:
[...]
`-error DESCRIPTION'
  Signal an error and delete process PROC.

Probably it should be mentioned in the elisp manual somewhere, not sure
where, there doesn't seem to be an appropriate existing chapter.





  reply	other threads:[~2016-07-07  1:07 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 [this message]
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
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=878txecl2l.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=11358@debbugs.gnu.org \
    --cc=hanche@math.ntnu.no \
    /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).