From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: more candidates for obsoletion Date: Sun, 13 May 2012 20:34:46 +0200 Message-ID: References: <87k40vptms.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1336934105 509 80.91.229.3 (13 May 2012 18:35:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 13 May 2012 18:35:05 +0000 (UTC) Cc: Juanma Barranquero , sds@gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 13 20:35:04 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1STddH-0007Gq-Cy for ged-emacs-devel@m.gmane.org; Sun, 13 May 2012 20:35:03 +0200 Original-Received: from localhost ([::1]:40440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1STddG-0003Gd-O2 for ged-emacs-devel@m.gmane.org; Sun, 13 May 2012 14:35:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1STddD-0003GA-Oj for emacs-devel@gnu.org; Sun, 13 May 2012 14:35:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1STddB-0000Q0-OV for emacs-devel@gnu.org; Sun, 13 May 2012 14:34:59 -0400 Original-Received: from hermes.netfonds.no ([80.91.224.195]:50429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1STddB-0000Pr-Eb; Sun, 13 May 2012 14:34:57 -0400 Original-Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1STddA-000054-Fm; Sun, 13 May 2012 20:34:56 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTlS2ObTvhrTP68b/u yEIjFQlYQCn72DQ7Whe1AAACW0lEQVQ4jWWTQW/iMBCFxz5srpmkmKuxqua6kVX2ukIrcYVKTq+4 lZ0riSL893fGSQrdHQSE+fzejMcGUhqcc11wfaLHM3+mt6lIMAMXXHGN/a3YRO+r09AzuGVFl4b+ 7darl0vnz++egQosIY9zbxwOPsTu/ZJAo0dSdEdacS64Qprg90eCuvX13rkTJZ7TQ0BtW2s3DvNi LUHrUTcMlLW1tWgxrzukxqQmK/DTWtvu7ec2DXo0VZGaAnZNghYJkAx/phsOKLdj2VcDKawnp71t 27oZNMiqGmEsBSksZmDbmkyusjDNTsoDK/YEqDFbH6d+GAbEUvQfGXARCjxO1RUqkFIXxXeQvm3Q 5rbY7tc/YK8WsE1p1KANmBXM1duqGc09FgWD0mjhxQ4FCmlgKZ4BGawNTH/uXZEix+HLagVVSs2Y RhbQF6BaAT6n43QHADwsdgJRPCqMJtLaFozRZQbHBRgJSJPjgqJYwJVrUE4D5E70dgGhfwFrX6OX OhNdEhhBoAse+Iq4EwJ7gUIVQwidc2cGMbjovFAxupBjAR75jkb0MXYx0Mt1LnR0Hi4y6Ci/BF39 QIqN6/iRMyoSpVVkdQJOdvlXJoivfPddBdkn0lt5kLq29QwOgJv893AdnY4hYBUv/aAhqpz3WNFG dhifaJLSpAOBcInxPA9rhzStJh8LgIhAl2w+NnFIdwC+NNJorXlW5gFIxe4aShLnsX8BHqwWtEX1 1DyA2V7knrf/Af2DdxldNabpbsUg5IlQFGYFZhVQDSbUwxxstcvzmiN4zJG73NzzFDP5C82VLEiL Jwq1AAAAAElFTkSuQmCC X-Now-Playing: Various's _R. Crumb's Heroes of Blues, Jazz & Country_: "East Texas Serenaders - Mineola Rag" In-Reply-To: (Stefan Monnier's message of "Wed, 02 May 2012 09:02:34 -0400") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux) X-MailScanner-ID: 1STddA-000054-Fm MailScanner-NULL-Check: 1337538897.11762@2Diw9JcBvryUuMSSR0mhKg X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 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:150475 Archived-At: Stefan Monnier writes: >> That is, say `M-x backtrace-message RET obsolete RET', and then get a >> backtrace whenever a string matching "obsolete" is messaged. > > Sounds good (tho I'd call it debug-on-message or something like that). > Patch welcome, If we want to get all the messages, I think set_message might be the most likely place to put this. The main problem is then how to avoid debugging recursively forever. The following works, but surely there's an easier way to do this... Proof of concept patch follows. The real one would be structured slightly differently: === modified file 'src/xdisp.c' --- src/xdisp.c 2012-05-11 06:39:26 +0000 +++ src/xdisp.c 2012-05-13 18:32:19 +0000 @@ -10407,11 +10407,22 @@ Doesn't GC, as with_echo_area_buffer binds Qinhibit_modification_hooks to t before calling set_message_1 (which calls insert). */ +Lisp_Object call_debugger (Lisp_Object arg); +static int debugging = 0; + +Lisp_Object +undo_debugging (Lisp_Object arg) +{ + debugging = 0; + return Qnil; +} static void set_message (const char *s, Lisp_Object string, EMACS_INT nbytes, int multibyte_p) { + int count = SPECPDL_INDEX (); + message_enable_multibyte = ((s && multibyte_p) || (STRINGP (string) && STRING_MULTIBYTE (string))); @@ -10420,6 +10431,19 @@ (intptr_t) s, string, nbytes, multibyte_p); message_buf_print = 0; help_echo_showing_p = 0; + + record_unwind_save_match_data (); + + if (! debugging && + ! NILP (Vdebug_on_message) && + STRINGP (Vdebug_on_message) && + ! NILP (Fstring_match (Vdebug_on_message, string, Qnil))) { + debugging = 1; + record_unwind_protect (undo_debugging, Qnil); + call_debugger (Fcons (Qerror, Fcons (string, Qnil))); + } + + unbind_to (count, Qnil); } @@ -28824,6 +28848,10 @@ Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil); Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0), Qempty_box); + + DEFVAR_LISP ("debug-on-message", Vdebug_on_message, + doc: /* If non-nil, debug if a message matching this regexp is displayed. */); + Vdebug_on_message = Qnil; } -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/