From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: Random idea: Debugging `quit' Date: Sun, 11 Sep 2011 18:51:58 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1315759941 32381 80.91.229.12 (11 Sep 2011 16:52:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 11 Sep 2011 16:52:21 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 11 18:52:17 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R2nGT-0002hF-4f for ged-emacs-devel@m.gmane.org; Sun, 11 Sep 2011 18:52:17 +0200 Original-Received: from localhost ([::1]:48581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2nGS-0008PQ-QE for ged-emacs-devel@m.gmane.org; Sun, 11 Sep 2011 12:52:16 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:34498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2nGP-0008P7-U1 for emacs-devel@gnu.org; Sun, 11 Sep 2011 12:52:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2nGO-0003fi-RE for emacs-devel@gnu.org; Sun, 11 Sep 2011 12:52:13 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:55668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2nGO-0003fe-Lb for emacs-devel@gnu.org; Sun, 11 Sep 2011 12:52:12 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R2nGN-0002gZ-Il for emacs-devel@gnu.org; Sun, 11 Sep 2011 18:52:11 +0200 Original-Received: from dial-176163.pool.broadband44.net ([212.46.176.163]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Sep 2011 18:52:11 +0200 Original-Received: from eller.helmut by dial-176163.pool.broadband44.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Sep 2011 18:52:11 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 39 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: dial-176163.pool.broadband44.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:+MkwvhdZDNS0sPdyVA+DUL1tjb4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:143891 Archived-At: * 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 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