unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Interrupting an emacs server from outside emacs
@ 2013-05-16 12:04 Renaud Casenave-Péré
  2013-05-16 12:49 ` Julien Danjou
  0 siblings, 1 reply; 3+ messages in thread
From: Renaud Casenave-Péré @ 2013-05-16 12:04 UTC (permalink / raw)
  To: emacs-devel

Hi,

I am trying to control emacs from outside, and while it is quite easy to execute
a command using emacsclient --eval, if that command is stuck for whatever
reason, I would like to be able to interrupt it, as I would type C-g from emacs,
but remotely.

for example, if I execute this from a terminal:

emacsclient -e "(sleep-for 50)"

I would like to be able to cancel the sleep command from the terminal like this:

emacsclient -e "(keyboard-quit)"

or something. Being called keyboard-quit, I know it wasn't designed to be used
from the terminal, but this being emacs, surely there is way? Using emacsclient
or with unix signals, or something else.

Does anybody know such a trick?


Thanks,

-- 
Renaud Casenave-Péré



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Interrupting an emacs server from outside emacs
  2013-05-16 12:04 Interrupting an emacs server from outside emacs Renaud Casenave-Péré
@ 2013-05-16 12:49 ` Julien Danjou
  2013-05-16 13:10   ` Renaud Casenave-Péré
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Danjou @ 2013-05-16 12:49 UTC (permalink / raw)
  To: Renaud Casenave-Péré; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]

On Thu, May 16 2013, Renaud Casenave-Péré wrote:

> I am trying to control emacs from outside, and while it is quite easy to execute
> a command using emacsclient --eval, if that command is stuck for whatever
> reason, I would like to be able to interrupt it, as I would type C-g from emacs,
> but remotely.
>
> for example, if I execute this from a terminal:
>
> emacsclient -e "(sleep-for 50)"
>
> I would like to be able to cancel the sleep command from the terminal like this:
>
> emacsclient -e "(keyboard-quit)"
>
> or something. Being called keyboard-quit, I know it wasn't designed to be used
> from the terminal, but this being emacs, surely there is way? Using emacsclient
> or with unix signals, or something else.
>
> Does anybody know such a trick?

IIRC, it has already been discussed on this list.
I think you're looking for `debug-on-event' which by default allow you
to send SIGUSR2 to emacs to get a debug backtrace.

-- 
Julien Danjou
// Free Software hacker / freelance consultant
// http://julien.danjou.info

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Interrupting an emacs server from outside emacs
  2013-05-16 12:49 ` Julien Danjou
@ 2013-05-16 13:10   ` Renaud Casenave-Péré
  0 siblings, 0 replies; 3+ messages in thread
From: Renaud Casenave-Péré @ 2013-05-16 13:10 UTC (permalink / raw)
  To: emacs-devel

On Thu, May 16 2013, Julien Danjou wrote:

> IIRC, it has already been discussed on this list.
> I think you're looking for `debug-on-event' which by default allow you
> to send SIGUSR2 to emacs to get a debug backtrace.

Well… It does work.
This would need some cleanup as it enters the debugger, but a simple

emacsclient -e "(exit-recursive-edit)"

seems to do the trick.
I will keep this solution if nobody objects.

Thanks for the quick reply!

-- 
Renaud Casenave-Péré



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-16 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-16 12:04 Interrupting an emacs server from outside emacs Renaud Casenave-Péré
2013-05-16 12:49 ` Julien Danjou
2013-05-16 13:10   ` Renaud Casenave-Péré

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