From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#17577: 24.3.91; Error during redisplay prevent quitting. Date: Sat, 24 May 2014 11:50:08 -0400 Message-ID: References: <87lhtrzsod.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1400946686 1201 80.91.229.3 (24 May 2014 15:51:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 24 May 2014 15:51:26 +0000 (UTC) Cc: 17577@debbugs.gnu.org To: Thierry Volpiatto Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 24 17:51:16 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1WoEE7-0007ls-MJ for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 May 2014 17:51:15 +0200 Original-Received: from localhost ([::1]:48359 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WoEE7-0002Oy-C0 for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 May 2014 11:51:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WoEE0-0002NR-9l for bug-gnu-emacs@gnu.org; Sat, 24 May 2014 11:51:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WoEDv-0000d0-2s for bug-gnu-emacs@gnu.org; Sat, 24 May 2014 11:51:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WoEDu-0000cv-W7 for bug-gnu-emacs@gnu.org; Sat, 24 May 2014 11:51:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WoEDu-000818-4o for bug-gnu-emacs@gnu.org; Sat, 24 May 2014 11:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 May 2014 15:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17577 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17577-submit@debbugs.gnu.org id=B17577.140094662330768 (code B ref 17577); Sat, 24 May 2014 15:51:02 +0000 Original-Received: (at 17577) by debbugs.gnu.org; 24 May 2014 15:50:23 +0000 Original-Received: from localhost ([127.0.0.1]:59216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WoEDF-00080A-LN for submit@debbugs.gnu.org; Sat, 24 May 2014 11:50:22 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:3856) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WoEDC-0007zs-RP for 17577@debbugs.gnu.org; Sat, 24 May 2014 11:50:20 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVPO+KQe/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSQTh3EI0hkXjnoHhDgElB6Ue4Fqg0wh X-IPAS-Result: ArUGAIDvNVPO+KQe/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSQTh3EI0hkXjnoHhDgElB6Ue4Fqg0wh X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="63965772" Original-Received: from 206-248-164-30.dsl.teksavvy.com (HELO pastel.home) ([206.248.164.30]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 24 May 2014 11:50:09 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 7C04B6013A; Sat, 24 May 2014 11:50:08 -0400 (EDT) In-Reply-To: <87lhtrzsod.fsf@gmail.com> (Thierry Volpiatto's message of "Sat, 24 May 2014 06:50:26 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:89453 Archived-At: For: Error during redisplay: (#[128 "\300\301\"\210\300\302\"\207" [apply redisplay--update-region-highlights ignore nil] 4 nil nil] (#)) signaled (quit) the problem is probably that xdisp.c should set inhibit-quit while running pre-redisplay-function. But you also quote: > Error during redisplay: (eval (helm-show-candidate-number [...] This doesn't come from pre-redisplay-function but from updating the mode-line, and I can't remember modifying this code. And it seems that this code has never run with inhibit-quit. At least, that's what (setq header-line-format '("" (:eval (format "inhibit-quit=%S" inhibit-quit)))) tells me in Emacs-23.4. Actually, I see that inhibit-quit is also nil while running jit-lock, which baffles me. But indeed, if I add a slow font-lock rule and hit C-g while it's processing that rule, I get: Error during redisplay: (quit) So I wonder why this is new. My best explanation is that it's actually not new, but for some odd reason the timing has changed such that it happens more often now. > With this version of emacs (24.3.91) it is usable because I let-bounded > `pre-redisplay-function' to nil, Since pre-redisplay-function is new in 24.4, it's important we fix the bugs it introduces, so please remove this workaround from helm.el. > (:eval (helm-show-candidate-number > (when (listp helm-mode-line-string) > (car-safe helm-mode-line-string)))) The "when" check is redundant. > but the message is still here, with Emacs-24.4.50, quitting is nearly > impossible, and the message contain byte-code. Sounds like the pre-redisplay-function message, then. This one is indeed new. > Another strange thing is when hitting C-g on a long helm-grep process, > C-g works normally but return "Emacs-lisp:" in the minibuffer when done. Hmm... grepping around, "Emacs-lisp:" seems extremely unlikely, but maybe you meant "Emacs-Lisp:" which I guess could potentially come from the rarely used "menu in echo area" feature, i.e. "Emacs-Lisp" would come from the name of a keymap. Why/how this happens, I don't know. I installed the patch below into the `emacs-24' branch. Could you try it and see if it solves the problem for you? Stefan === modified file 'src/ChangeLog' --- src/ChangeLog 2014-05-22 05:00:39 +0000 +++ src/ChangeLog 2014-05-24 15:48:59 +0000 @@ -1,3 +1,11 @@ +2014-05-24 Stefan Monnier + + * xdisp.c: Bind inhibit-quit during pre-redisplay-function. + (safe__call, safe__call1, safe__eval): New functions. + (safe_call): Use it. + (prepare_menu_bars): Use it for pre-redisplay-function (bug#17577). + (display_mode_element): Same for `:eval'. + 2014-05-22 Paul Eggert Fix port to 32-bit AIX (Bug#17540). === modified file 'src/xdisp.c' --- src/xdisp.c 2014-05-21 15:03:18 +0000 +++ src/xdisp.c 2014-05-24 15:45:51 +0000 @@ -2591,8 +2591,8 @@ following. Return the result, or nil if something went wrong. Prevent redisplay during the evaluation. */ -Lisp_Object -safe_call (ptrdiff_t nargs, Lisp_Object func, ...) +static Lisp_Object +safe__call (bool inhibit_quit, ptrdiff_t nargs, Lisp_Object func, ...) { Lisp_Object val; @@ -2615,6 +2615,8 @@ GCPRO1 (args[0]); gcpro1.nvars = nargs; specbind (Qinhibit_redisplay, Qt); + if (inhibit_quit) + specbind (Qinhibit_quit, Qt); /* Use Qt to ensure debugger does not run, so there is no possibility of wanting to redisplay. */ val = internal_condition_case_n (Ffuncall, nargs, args, Qt, @@ -2626,6 +2628,11 @@ return val; } +Lisp_Object +safe_call (ptrdiff_t nargs, Lisp_Object func, ...) +{ + return safe__call (false, nargs, func); +} /* Call function FN with one argument ARG. Return the result, or nil if something went wrong. */ @@ -2633,7 +2640,13 @@ Lisp_Object safe_call1 (Lisp_Object fn, Lisp_Object arg) { - return safe_call (2, fn, arg); + return safe__call (false, 2, fn, arg); +} + +Lisp_Object +safe__call1 (bool inhibit_quit, Lisp_Object fn, Lisp_Object arg) +{ + return safe__call (inhibit_quit, 2, fn, arg); } static Lisp_Object Qeval; @@ -2641,7 +2654,13 @@ Lisp_Object safe_eval (Lisp_Object sexpr) { - return safe_call1 (Qeval, sexpr); + return safe__call1 (false, Qeval, sexpr); +} + +Lisp_Object +safe__eval (bool inhibit_quit, Lisp_Object sexpr) +{ + return safe__call1 (inhibit_quit, Qeval, sexpr); } /* Call function FN with two arguments ARG1 and ARG2. @@ -11549,7 +11568,7 @@ } } } - safe_call1 (Vpre_redisplay_function, windows); + safe__call1 (true, Vpre_redisplay_function, windows); } /* Update all frame titles based on their buffer names, etc. We do @@ -21863,7 +21882,7 @@ if (CONSP (XCDR (elt))) { Lisp_Object spec; - spec = safe_eval (XCAR (XCDR (elt))); + spec = safe__eval (true, XCAR (XCDR (elt))); n += display_mode_element (it, depth, field_width - n, precision - n, spec, props, risky);