all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: Unhelpful bit of coding in font-lock.el
Date: Sun, 25 Aug 2019 15:29:13 +0000	[thread overview]
Message-ID: <20190825152913.GC4724@ACM> (raw)

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	other threads:[~2019-08-25 15:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190825152913.GC4724@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.