all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#52297: 29.0.50; Error in c-force-redisplay timer
@ 2021-12-05  7:27 Eli Zaretskii
  2021-12-06 20:26 ` Alan Mackenzie
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2021-12-05  7:27 UTC (permalink / raw)
  To: 52297; +Cc: Alan Mackenzie

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))





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#52297: 29.0.50; Error in c-force-redisplay timer
  2021-12-05  7:27 bug#52297: 29.0.50; Error in c-force-redisplay timer Eli Zaretskii
@ 2021-12-06 20:26 ` Alan Mackenzie
  2022-02-08 10:15   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Alan Mackenzie @ 2021-12-06 20:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 52297

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).





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#52297: 29.0.50; Error in c-force-redisplay timer
  2021-12-06 20:26 ` Alan Mackenzie
@ 2022-02-08 10:15   ` Lars Ingebrigtsen
  2022-02-08 18:36     ` Alan Mackenzie
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-08 10:15 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 52297

Alan Mackenzie <acm@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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#52297: 29.0.50; Error in c-force-redisplay timer
  2022-02-08 10:15   ` Lars Ingebrigtsen
@ 2022-02-08 18:36     ` Alan Mackenzie
  2022-02-08 19:00       ` Eli Zaretskii
  2022-02-09  8:45       ` martin rudalics
  0 siblings, 2 replies; 11+ messages in thread
From: Alan Mackenzie @ 2022-02-08 18:36 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 52297

Hello, Lars.

On Tue, Feb 08, 2022 at 11:15:36 +0100, Lars Ingebrigtsen wrote:
> Alan Mackenzie <acm@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).





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#52297: 29.0.50; Error in c-force-redisplay timer
  2022-02-08 18:36     ` Alan Mackenzie
@ 2022-02-08 19:00       ` Eli Zaretskii
  2022-02-09  8:45       ` martin rudalics
  1 sibling, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2022-02-08 19:00 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: larsi, 52297-done

> Date: Tue, 8 Feb 2022 18:36:56 +0000
> Cc: Eli Zaretskii <eliz@gnu.org>, 52297@debbugs.gnu.org,
>   martin rudalics <rudalics@gmx.at>
> From: Alan Mackenzie <acm@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.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#52297: 29.0.50; Error in c-force-redisplay timer
  2022-02-08 18:36     ` Alan Mackenzie
  2022-02-08 19:00       ` Eli Zaretskii
@ 2022-02-09  8:45       ` martin rudalics
  2022-02-09 16:53         ` Alan Mackenzie
  1 sibling, 1 reply; 11+ messages in thread
From: martin rudalics @ 2022-02-09  8:45 UTC (permalink / raw)
  To: Alan Mackenzie, Lars Ingebrigtsen; +Cc: 52297

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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#52297: 29.0.50; Error in c-force-redisplay timer
  2022-02-09  8:45       ` martin rudalics
@ 2022-02-09 16:53         ` Alan Mackenzie
  2022-02-09 18:21           ` martin rudalics
  0 siblings, 1 reply; 11+ messages in thread
From: Alan Mackenzie @ 2022-02-09 16:53 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lars Ingebrigtsen, 52297

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).





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#52297: 29.0.50; Error in c-force-redisplay timer
  2022-02-09 16:53         ` Alan Mackenzie
@ 2022-02-09 18:21           ` martin rudalics
  2022-02-09 20:06             ` Alan Mackenzie
  0 siblings, 1 reply; 11+ messages in thread
From: martin rudalics @ 2022-02-09 18:21 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Lars Ingebrigtsen, 52297

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

TIA, martin





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#52297: 29.0.50; Error in c-force-redisplay timer
  2022-02-09 18:21           ` martin rudalics
@ 2022-02-09 20:06             ` Alan Mackenzie
  2022-02-10  8:26               ` martin rudalics
  0 siblings, 1 reply; 11+ messages in thread
From: Alan Mackenzie @ 2022-02-09 20:06 UTC (permalink / raw)
  To: martin rudalics; +Cc: acm, Lars Ingebrigtsen, 52297

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)))))))))))
 
 \f


-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#52297: 29.0.50; Error in c-force-redisplay timer
  2022-02-09 20:06             ` Alan Mackenzie
@ 2022-02-10  8:26               ` martin rudalics
  2022-02-10 17:15                 ` bug#52709: [ was: bug#52297: 29.0.50; Error in c-force-redisplay timer ] Alan Mackenzie
  0 siblings, 1 reply; 11+ messages in thread
From: martin rudalics @ 2022-02-10  8:26 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Lars Ingebrigtsen, 52297

 > 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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#52709: [ was: bug#52297: 29.0.50; Error in c-force-redisplay timer ]
  2022-02-10  8:26               ` martin rudalics
@ 2022-02-10 17:15                 ` Alan Mackenzie
  0 siblings, 0 replies; 11+ messages in thread
From: Alan Mackenzie @ 2022-02-10 17:15 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lars Ingebrigtsen, 52709-done

Hello, Martin.

On Thu, Feb 10, 2022 at 09:26:36 +0100, martin rudalics wrote:
>  > 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.

Excellent, thanks!  I've installed it to master.

I'm closing the bug with this post (though it might have been closed
anyway).

> Thanks, martin

-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-02-10 17:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-05  7:27 bug#52297: 29.0.50; Error in c-force-redisplay timer Eli Zaretskii
2021-12-06 20:26 ` Alan Mackenzie
2022-02-08 10:15   ` Lars Ingebrigtsen
2022-02-08 18:36     ` Alan Mackenzie
2022-02-08 19:00       ` Eli Zaretskii
2022-02-09  8:45       ` martin rudalics
2022-02-09 16:53         ` Alan Mackenzie
2022-02-09 18:21           ` martin rudalics
2022-02-09 20:06             ` Alan Mackenzie
2022-02-10  8:26               ` martin rudalics
2022-02-10 17:15                 ` bug#52709: [ was: bug#52297: 29.0.50; Error in c-force-redisplay timer ] Alan Mackenzie

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.