bug-gnu-emacs
[Top][All Lists]
Advanced

[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: npostavs
Subject: bug#11358: 24.1.50; Feature request: A way to abort emacs-client
Date: Wed, 06 Jul 2016 21:07:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]