From: Helmut Eller <eller.helmut@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Random idea: Debugging `quit'
Date: Sun, 11 Sep 2011 18:51:58 +0200 [thread overview]
Message-ID: <m2ehzn9g41.fsf@gmail.com> (raw)
In-Reply-To: m3obyrk9qk.fsf@stories.gnus.org
* Lars Magne Ingebrigtsen [2011-09-11 04:01] writes:
> If something hangs, then I'd really like to know where it hangs. So I
> always wish that I'd have been running with `debug-on-quit' set. But
> doing so is really annoying, since `C-g' is a natural thing to do in
> many circumstances.
>
> So wouldn't it be nice if we could say, for instance, `C-u C-g' to get a
> debugging `quit'? Or perhaps `C-u 6 6 6 C-g', or whatever deemed
> necessary to avoid annoying people...
Yes, that would be nice.
Not so nice, but kill -SIGUSR2 <emacs-pid> in shell tells Emacs to
enter the debugger.
Another possibility would be to set debug-on-quit permanently to t
and at the same time set the variable debugger to some function
that is smart enough to look at the queued events:
(require 'cl)
(require 'debug) ; load it now to avoid resetting debugger
(setq debug-on-quit t)
(setq debugger 'my-debug)
(defun my-debug (&rest args)
(cond ((equal args '(error (quit)))
(let ((unread-events (loop while (input-pending-p)
collect (read-event nil nil 0.1))))
(cond ((equal (subseq unread-events -4)
'(21 54 54 54)) ; C-u 6 6 6
(debug nil 'my-break))
(t
(discard-input)
(let ((debug-on-quit nil))
(signal 'quit nil))))))
(t
(apply #'debug args))))
Helmut
next prev parent reply other threads:[~2011-09-11 16:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-11 4:01 Random idea: Debugging `quit' Lars Magne Ingebrigtsen
2011-09-11 7:58 ` Andreas Schwab
2011-09-11 14:38 ` Antoine Levitt
2011-09-11 15:24 ` Lars Magne Ingebrigtsen
2011-09-11 15:42 ` Andreas Schwab
2011-09-11 23:28 ` Stephen J. Turnbull
2011-09-11 11:25 ` Sean Sieger
2011-09-11 16:51 ` Helmut Eller [this message]
2011-09-11 21:01 ` Lars Magne 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=m2ehzn9g41.fsf@gmail.com \
--to=eller.helmut@gmail.com \
--cc=emacs-devel@gnu.org \
/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).