emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unhelpful bit of coding in font-lock.el


From: Alan Mackenzie
Subject: Unhelpful bit of coding in font-lock.el
Date: Sun, 25 Aug 2019 15:29:13 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello, Emacs.

In font-lock-set-defaults, quite near the beginning, we have:

      (if (nth 2 defaults)
          (set (make-local-variable 'font-lock-keywords-case-fold-search) t)
        (kill-local-variable 'font-lock-keywords-case-fold-search))

.  (nth 2 defaults) is the flag that, when non-nil, requests case
folding for keywords.  Aside from the fact that
font-lock-keywords-case-fold-search is now buffer local anyway, thus
making the make-local-variable redundant, the effect of this form
depends on the default value of f-l-k-c-f-search:

If that default value is nil, all works as desired.  It it's t, then the
above form will always set f-l-k-c-f-search to t.

The OP in bug #37137 has the following in his .emacs:

        (custom-set-variables
             '(font-lock-keywords-case-fold-search t)

, which changes the default value of the variable.  I'm not sure why he
does this (I've asked him, but haven't yet had a reply).  The symptom of
the bug is an infinite loop in C Mode on typing a "capitalised keyword",
e.g. LONG.

So, why does the form in font-lock-set-defaults read the way it does?
Why not, simply:

    (setq font-lock-keywords-case-fold-search (nth 2 defaults))

?  Surely it's no longer important (if it ever was) to save the space
taken up by the buffer local copies with value nil.

Maybe it would be good to add something to the doc string saying that
nothing good can come from setting this variable.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]