unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Unhelpful bit of coding in font-lock.el
@ 2019-08-25 15:29 Alan Mackenzie
  0 siblings, 0 replies; only message in thread
From: Alan Mackenzie @ 2019-08-25 15:29 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-25 15:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-25 15:29 Unhelpful bit of coding in font-lock.el Alan Mackenzie

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).