GNU bug report logs - #52297
29.0.50; Error in c-force-redisplay timer

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Sun, 5 Dec 2021 07:28:01 UTC

Severity: normal

Merged with 52709

Found in version 29.0.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52297 in the body.
You can then email your comments to 52297 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#52297; Package emacs. (Sun, 05 Dec 2021 07:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eli Zaretskii <eliz <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 05 Dec 2021 07:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Cc: Alan Mackenzie <acm <at> muc.de>
Subject: 29.0.50; Error in c-force-redisplay timer
Date: Sun, 05 Dec 2021 09:27:23 +0200
To reproduce, visit some C file:

  emacs -Q
  C-x C-f some-C-file.c RET

and then press "M-x".  Observe the following error message in the echo
area, displayed after "M-x":

  Error running timer ‘c-force-redisplay’: (error "Font-lock trying to use keywords before setting them up")


In GNU Emacs 29.0.50 (build 297, i686-pc-mingw32)
 of 2021-12-04 built on HOME-C4E4A596F7
Repository revision: f247fa5d5ce7cb34f23c979c17b14c5713eb5490
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 5.1.2600
System Description: Microsoft Windows XP Service Pack 3 (v5.1.0.2600)

Configured using:
 'configure -C --prefix=/d/usr --with-wide-int
 --enable-checking=yes,glyphs 'CFLAGS=-O0 -gdwarf-4 -g3''

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY
W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS WEBP
XPM ZLIB

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1255

Major mode: C/*l

Minor modes in effect:
  bug-reference-prog-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr dabbrev vc-git diff-mode easy-mmode vc
vc-dispatcher bug-reference cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs emacsbug message mailcap
yank-media rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived
epg rfc6068 epg-config gnus-util rmail rmail-loaddefs auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json map
text-property-search time-date seq gv subr-x byte-opt bytecomp
byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils iso-transl tooltip
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win
w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty
make-network-process emacs)

Memory information:
((conses 16 106661 15066)
 (symbols 48 10282 1)
 (strings 16 30803 3721)
 (string-bytes 1 1052292)
 (vectors 16 18181)
 (vector-slots 8 225472 10799)
 (floats 8 31 57)
 (intervals 40 6144 267)
 (buffers 888 11))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52297; Package emacs. (Mon, 06 Dec 2021 20:27:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: 29.0.50; Error in c-force-redisplay timer
Date: Mon, 6 Dec 2021 20:26:11 +0000
Hello, Eli.

On Sun, Dec 05, 2021 at 09:27:23 +0200, Eli Zaretskii wrote:
> To reproduce, visit some C file:

>   emacs -Q
>   C-x C-f some-C-file.c RET

> and then press "M-x".  Observe the following error message in the echo
> area, displayed after "M-x":

>   Error running timer ‘c-force-redisplay’: (error "Font-lock trying to use keywords before setting them up")

OK, I'll look at it.

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).




Merged 52297 52709. Request was from martin rudalics <rudalics <at> gmx.at> to control <at> debbugs.gnu.org. (Tue, 21 Dec 2021 18:22:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52297; Package emacs. (Tue, 08 Feb 2022 10:16:01 GMT) Full text and rfc822 format available.

Message #13 received at 52297 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 52297 <at> debbugs.gnu.org
Subject: Re: bug#52297: 29.0.50; Error in c-force-redisplay timer
Date: Tue, 08 Feb 2022 11:15:36 +0100
Alan Mackenzie <acm <at> muc.de> writes:

>>   emacs -Q
>>   C-x C-f some-C-file.c RET
>
>> and then press "M-x".  Observe the following error message in the echo
>> area, displayed after "M-x":
>
>>   Error running timer ‘c-force-redisplay’: (error "Font-lock trying to use keywords before setting them up")
>
> OK, I'll look at it.

Alan, this was nine weeks ago.  Have you made any progress here?  (I
don't see the issue myself, but it's apparently stopping Martin from
using recent Emacs builds.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52297; Package emacs. (Tue, 08 Feb 2022 18:38:01 GMT) Full text and rfc822 format available.

Message #16 received at 52297 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: martin rudalics <rudalics <at> gmx.at>, Eli Zaretskii <eliz <at> gnu.org>,
 52297 <at> debbugs.gnu.org
Subject: Re: bug#52297: 29.0.50; Error in c-force-redisplay timer
Date: Tue, 8 Feb 2022 18:36:56 +0000
Hello, Lars.

On Tue, Feb 08, 2022 at 11:15:36 +0100, Lars Ingebrigtsen wrote:
> Alan Mackenzie <acm <at> muc.de> writes:

> >>   emacs -Q
> >>   C-x C-f some-C-file.c RET

> >> and then press "M-x".  Observe the following error message in the echo
> >> area, displayed after "M-x":

> >>   Error running timer ‘c-force-redisplay’: (error "Font-lock trying to use keywords before setting them up")

> > OK, I'll look at it.

> Alan, this was nine weeks ago.  Have you made any progress here?  (I
> don't see the issue myself, but it's apparently stopping Martin from
> using recent Emacs builds.)

Sorry, I lost this one.  I've just configured a build on GNU with:

    $ CFLAGS='-O0 -g3' ./configure --enable-checking=yes,glyphs --with-gpm

, and built it.  When I do

    $ emacs -Q
    C-x C-f src/xdisp.c
    M-x end-of-buffer RET

, I don't see the bug at all.

Eli or Martin, is this bug still showing itself?  If so, would it be
possible to give a more exact recipe to reproduce it (though I'm aware
the answer to this question is probably no).

> -- 
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no

-- 
Alan Mackenzie (Nuremberg, Germany).




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 08 Feb 2022 19:02:01 GMT) Full text and rfc822 format available.

Notification sent to Eli Zaretskii <eliz <at> gnu.org>:
bug acknowledged by developer. (Tue, 08 Feb 2022 19:02:02 GMT) Full text and rfc822 format available.

Message #21 received at 52297-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: rudalics <at> gmx.at, larsi <at> gnus.org, 52297-done <at> debbugs.gnu.org
Subject: Re: bug#52297: 29.0.50; Error in c-force-redisplay timer
Date: Tue, 08 Feb 2022 21:00:03 +0200
> Date: Tue, 8 Feb 2022 18:36:56 +0000
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 52297 <at> debbugs.gnu.org,
>   martin rudalics <rudalics <at> gmx.at>
> From: Alan Mackenzie <acm <at> muc.de>
> 
> > >>   emacs -Q
> > >>   C-x C-f some-C-file.c RET
> 
> > >> and then press "M-x".  Observe the following error message in the echo
> > >> area, displayed after "M-x":
> 
> > >>   Error running timer ‘c-force-redisplay’: (error "Font-lock trying to use keywords before setting them up")
> 
> > > OK, I'll look at it.
> 
> > Alan, this was nine weeks ago.  Have you made any progress here?  (I
> > don't see the issue myself, but it's apparently stopping Martin from
> > using recent Emacs builds.)
> 
> Sorry, I lost this one.  I've just configured a build on GNU with:
> 
>     $ CFLAGS='-O0 -g3' ./configure --enable-checking=yes,glyphs --with-gpm
> 
> , and built it.  When I do
> 
>     $ emacs -Q
>     C-x C-f src/xdisp.c
>     M-x end-of-buffer RET
> 
> , I don't see the bug at all.
> 
> Eli or Martin, is this bug still showing itself?

No, I don't.  I guess it was fixed in the meantime.  So I'm closing
this bug.

Thanks.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 08 Feb 2022 19:02:02 GMT) Full text and rfc822 format available.

Notification sent to martin rudalics <rudalics <at> gmx.at>:
bug acknowledged by developer. (Tue, 08 Feb 2022 19:02:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52297; Package emacs. (Wed, 09 Feb 2022 08:46:01 GMT) Full text and rfc822 format available.

Message #29 received at 52297 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Alan Mackenzie <acm <at> muc.de>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 52297 <at> debbugs.gnu.org
Subject: Re: bug#52297: 29.0.50; Error in c-force-redisplay timer
Date: Wed, 9 Feb 2022 09:45:16 +0100
reopen 52297
quit

> Eli or Martin, is this bug still showing itself?  If so, would it be
> possible to give a more exact recipe to reproduce it (though I'm aware
> the answer to this question is probably no).

With emacs -Q pulled from master and built today (2022-02-09) I load a
file containing the following text


(custom-set-variables
 '(ediff-split-window-function 'split-window-horizontally)
 '(ediff-window-setup-function 'ediff-setup-windows-plain)
 '(initial-frame-alist (quote ((fullscreen . maximized))))
 '(tool-bar-mode nil))

(switch-to-buffer
 (find-file-noselect "~/emacs-git/trunk/src/minibuf.c"))

(defun my-diffs-revision ()
  (interactive)
  (let* ((this-file-name (buffer-file-name))
	 (backend (vc-backend this-file-name))
	 backup)
    (cond
     (backend
      (vc-call state this-file-name)
      (vc-file-getprop this-file-name 'vc-latest-revision)
      (require 'ediff-vers)
      (with-current-buffer (find-file-noselect this-file-name)
	(ediff-vc-internal "" "")))
     ((setq backup (file-newest-backup this-file-name))
      (ediff-buffers
       (find-file-noselect backup) (current-buffer))))))

(global-set-key [(control shift meta a)] 'my-diffs-revision)


and type C-M-S-a (the file compared here is minibuffer.c of Emacs'
master).

With debugging turned on this gets me

Debugger entered--Lisp error: (error "Font-lock trying to use keywords before setting th...")
  signal(error ("Font-lock trying to use keywords before setting th..."))
  error("Font-lock trying to use keywords before setting th...")
  font-lock-compile-keywords(nil)
  font-lock-fontify-keywords-region(1 112 nil)
  font-lock-default-fontify-region(1523 1532 nil)
  c-font-lock-fontify-region(1523 1532)
  c-force-redisplay(1523 1532)
  apply(c-force-redisplay (1523 1532))
  timer-event-handler([t 25091 29205 916629 nil c-force-redisplay (1523 1532) nil 777000 nil])

martin




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 09 Feb 2022 08:46:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52297; Package emacs. (Wed, 09 Feb 2022 16:54:01 GMT) Full text and rfc822 format available.

Message #34 received at 52297 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 52297 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#52297: 29.0.50; Error in c-force-redisplay timer
Date: Wed, 9 Feb 2022 16:53:33 +0000
Hello, Martin.

On Wed, Feb 09, 2022 at 09:45:16 +0100, martin rudalics wrote:
> reopen 52297
> quit

>  > Eli or Martin, is this bug still showing itself?  If so, would it be
>  > possible to give a more exact recipe to reproduce it (though I'm aware
>  > the answer to this question is probably no).

> With emacs -Q pulled from master and built today (2022-02-09) I load a
> file containing the following text

[ .... ]

Thanks.  With that file, I can reproduce the bug.  I'll set about fixing
it.

> With debugging turned on this gets me

> Debugger entered--Lisp error: (error "Font-lock trying to use keywords before setting th...")
>    signal(error ("Font-lock trying to use keywords before setting th..."))
>    error("Font-lock trying to use keywords before setting th...")
>    font-lock-compile-keywords(nil)
>    font-lock-fontify-keywords-region(1 112 nil)
>    font-lock-default-fontify-region(1523 1532 nil)
>    c-font-lock-fontify-region(1523 1532)
>    c-force-redisplay(1523 1532)
>    apply(c-force-redisplay (1523 1532))
>    timer-event-handler([t 25091 29205 916629 nil c-force-redisplay (1523 1532) nil 777000 nil])

> martin

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52297; Package emacs. (Wed, 09 Feb 2022 18:22:01 GMT) Full text and rfc822 format available.

Message #37 received at 52297 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 52297 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#52297: 29.0.50; Error in c-force-redisplay timer
Date: Wed, 9 Feb 2022 19:21:20 +0100
> Thanks.  With that file, I can reproduce the bug.  I'll set about fixing
> it.

TIA, martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52297; Package emacs. (Wed, 09 Feb 2022 20:07:02 GMT) Full text and rfc822 format available.

Message #40 received at 52297 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: martin rudalics <rudalics <at> gmx.at>
Cc: acm <at> muc.de, Lars Ingebrigtsen <larsi <at> gnus.org>, 52297 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#52297: 29.0.50; Error in c-force-redisplay timer
Date: Wed, 9 Feb 2022 20:06:18 +0000
Hello again, Martin.

On Wed, Feb 09, 2022 at 19:21:20 +0100, martin rudalics wrote:
>  > Thanks.  With that file, I can reproduce the bug.  I'll set about fixing
>  > it.

> TIA, martin

I think the problem is that the buffer wasn't set in the timer function,
so c-force-redisplay was, in the bug scenario, trying to fontify a
spurious buffer.

Would you try out the following patch, please, which fixes this bug.
I'm optimistic it will have fixed the main bug.

Thanks!



diff -r 67fe5c0a9d03 cc-fonts.el
--- a/cc-fonts.el	Mon Jan 31 17:34:20 2022 +0000
+++ b/cc-fonts.el	Wed Feb 09 19:58:26 2022 +0000
@@ -2256,12 +2256,13 @@
 ;; redisplay.
 (defvar c-re-redisplay-timer nil)
 
-(defun c-force-redisplay (start end)
+(defun c-force-redisplay (buffer start end)
   ;; Force redisplay immediately.  This assumes `font-lock-support-mode' is
   ;; 'jit-lock-mode.  Set the variable `c-re-redisplay-timer' to nil.
-  (save-excursion (c-font-lock-fontify-region start end))
-  (jit-lock-force-redisplay (copy-marker start) (copy-marker end))
-  (setq c-re-redisplay-timer nil))
+  (with-current-buffer buffer
+    (save-excursion (c-font-lock-fontify-region start end))
+    (jit-lock-force-redisplay (copy-marker start) (copy-marker end))
+    (setq c-re-redisplay-timer nil)))
 
 (defun c-fontify-new-found-type (type)
   ;; Cause the fontification of TYPE, a string, wherever it occurs in the
@@ -2291,6 +2292,7 @@
 			 (not c-re-redisplay-timer))
 		(setq c-re-redisplay-timer
 		      (run-with-timer 0 nil #'c-force-redisplay
+				      (current-buffer)
 				      (match-beginning 0) (match-end 0)))))))))))
 
 


-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52297; Package emacs. (Thu, 10 Feb 2022 08:27:01 GMT) Full text and rfc822 format available.

Message #43 received at 52297 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 52297 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#52297: 29.0.50; Error in c-force-redisplay timer
Date: Thu, 10 Feb 2022 09:26:36 +0100
> Would you try out the following patch, please, which fixes this bug.
> I'm optimistic it will have fixed the main bug.

It fixes the problem here.  Please install.

Thanks, martin




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 11 Mar 2022 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 43 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.