From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Unconditional quit on SIGUSR2 Date: Mon, 25 Apr 2011 10:32:27 -0300 Message-ID: References: <4D90354E.9000704@gmail.com> <4D908F5F.8000303@gmail.com> <4D90C42F.9060500@gmail.com> <83bp0vrszf.fsf@gnu.org> <4D90E199.2040809@gmail.com> <83aagfrq1y.fsf@gnu.org> <4D90E661.40207@gmail.com> <8362r2sy5x.fsf@gnu.org> <4D9106E7.5010902@gmail.com> <162CA738-6205-4D86-B263-B1C6408950BD@gmail.com> <4D921D1C.30806@gmail.com> <4DB4D976.5050502@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1303738361 16953 80.91.229.12 (25 Apr 2011 13:32:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 25 Apr 2011 13:32:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 25 15:32:36 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 1QELty-0006aB-Rn for ged-emacs-devel@m.gmane.org; Mon, 25 Apr 2011 15:32:35 +0200 Original-Received: from localhost ([::1]:34465 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QELty-00087p-Cj for ged-emacs-devel@m.gmane.org; Mon, 25 Apr 2011 09:32:34 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:33984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QELtv-00087i-PG for emacs-devel@gnu.org; Mon, 25 Apr 2011 09:32:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QELtu-0004Co-LN for emacs-devel@gnu.org; Mon, 25 Apr 2011 09:32:31 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:49854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QELtu-0004Ck-If for emacs-devel@gnu.org; Mon, 25 Apr 2011 09:32:30 -0400 Original-Received: from 121-249-126-200.fibertel.com.ar ([200.126.249.121]:34640 helo=ceviche.home) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1QELtu-0005TM-5s; Mon, 25 Apr 2011 09:32:30 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 18B2C6618A; Mon, 25 Apr 2011 10:32:27 -0300 (ART) In-Reply-To: <4DB4D976.5050502@gmail.com> (Daniel Colascione's message of "Sun, 24 Apr 2011 19:16:22 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 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:138732 Archived-At: That reminds me of the idea to turn C-g C-g C-g into a "really break, no matter what" key sequence. Someone posted a patch for it a while back and I didn't find the time to review it back then. > === modified file 'doc/emacs/trouble.texi' > --- doc/emacs/trouble.texi 2011-01-25 04:08:28 +0000 > +++ doc/emacs/trouble.texi 2011-03-29 17:47:26 +0000 > @@ -812,6 +812,14 @@ > This backtrace is useful for debugging such long loops, so if you can > produce it, copy it into the bug report. > +@vindex debug-on-special-event > +If the normal quit process is ineffective, you can try sending Emacs > +the special event given in @code{debug-on-special-event}, which by > +default corresponds to SIGUSR2. When Emacs receives this event, it > +stops what it's doing, sets @code{debug-on-quit} to @code{t}, and > +tries to break into the debugger in a variety of ways. This process > +happens even in places where quitting is normally not allowed. > + > @item > Check whether any programs you have loaded into the Lisp world, > including your @file{.emacs} file, set any variables that may affect the > === modified file 'doc/lispref/debugging.texi' > --- doc/lispref/debugging.texi 2011-01-25 04:08:28 +0000 > +++ doc/lispref/debugging.texi 2011-03-29 17:46:44 +0000 > @@ -185,6 +185,20 @@ > when you quit. @xref{Quitting}. > @end defopt > +@defopt debug-on-special-event > +When this variable contains a symbol matching one of the special > +events in @code{special-event-map} (@pxref{Active Keymaps}) and Emacs > +receives the corresponding event, Emacs will break into the debugger > +instead of processing the event normally, setting @code{debug-on-quit} > +to @code{t} as a side effect. This feature is useful for terminating > +infinite loops in places where quits would normally be ignored, such > +as in code that runs during redisplay. > + > +Currently, the only events Emacs recognizes as valid values for > +@code{debug-on-special-event} are @code{sigusr1} and @code{sigusr2}. > + > +@end defopt I'm not sure I'd want to advertise this feature in all manuals at this point. I'd rather see it in etc/DEBUG. And it should include some info about what happens after you get the backtrace: e.g. can you just hit `q' to abort the inf-loop and go on using this Emacs sessions as if nothing happened? > + if (SYMBOLP (Vdebug_on_special_event) && > + STRINGP (XSYMBOL (Vdebug_on_special_event)->xname)) Use SYMBOL_NAME. And I don't think STRINGP is needed here. Another minor problem is that you use a name with "special-event" and the doc makes references to "special-event-map" yet the two are fundamentally unrelated (except that they both can handle SIGUSRn signals). Stefan