GNU bug report logs - #23272
25.0.92; syntax-propertize-via-font-lock considered harmful

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Mon, 11 Apr 2016 22:55:01 UTC

Severity: normal

Tags: moreinfo

Found in version 25.0.92

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 23272 <at> debbugs.gnu.org
Subject: bug#23272: 25.0.92; syntax-propertize-via-font-lock considered harmful
Date: Thu, 21 Nov 2019 01:22:41 +0200
On 30.10.2019 17:56, Lars Ingebrigtsen wrote:
> I'm unable to reproduce this bug on the current trunk.  Has this been
> fixed in the three years since it was reported?

I think it's still there as a possibility, but the odds of triggering it 
are becoming more rare with each year.

Looking at the backtrace, it requires a major mode that uses 
font-lock-syntactic-keywords and calls syntax-propertize-via-font-lock 
to set its syntax-propertize-function.

Since Emacs 26 (where the bug still reproduces), ada-mode has both 
switched to a proper syntax-propertize-function instead of the one 
mentioned above and moved out of Emacs core, so "mode: ada" isn't doing 
anything in 'emacs -Q'.

So the repro scenario is like this now:

(define-derived-mode foo-mode fundamental-mode "Foo"
  (setq-local syntax-propertize-function
	      (syntax-propertize-via-font-lock nil)))

(with-temp-buffer
  (insert "-- -*- mode: foo -*-")
  (delay-mode-hooks
    (set-auto-mode))
  (syntax-propertize (point)))

The resulting backtrace:

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 t)
  font-lock-fontify-syntactic-keywords-region(1 21)
  #f(compiled-function (start end) #<bytecode 0x15817a4f1981>)(1 21)
  syntax-propertize(21)

Considering font-lock-syntactic-keywords are obsolete since Emacs 24, 
this is not very important, and people should feel free to close this if 
a fix is not found soon.




This bug report was last modified 5 years and 82 days ago.

Previous Next


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