unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>,
	Zachary Napier <zachary.napier.44@gmail.com>
Cc: 37137@debbugs.gnu.org
Subject: bug#37137: Setting font-lock-case-fold-search to t causes hangs on certain types in c-mode
Date: Mon, 2 Sep 2019 19:26:26 +0000	[thread overview]
Message-ID: <20190902192626.GA4133@ACM> (raw)
In-Reply-To: <jwv4l1uj272.fsf-monnier+emacs@gnu.org>

Hello, Stefan and Zachary.

On Mon, Sep 02, 2019 at 08:50:12 -0400, Stefan Monnier wrote:
> > I inherited this .emacs file from someone else who had this
> > set.  I'm guessing it used to be customizable?

> AFAICT it's never been custom-izable, and it really would be weird for
> it to be.  I think it's more likely that this custom-set-variables was
> hand-edited.

That variable couldn't possibly have been customisable.  It's default
value being other than nil breaks font locking, in that it spikes its
active binding to t, regardless of the value supplied in (nth 2
font-lock-defaults).

> > I can just change the regexps I am using in
> > font-lock-add-keywords.

> That's a much safer approach.  You can also do

>     (add-hook '<foo>-mode-hook
>       (lambda ()
>         (setq-local font-lock-case-fold-search t)))

> for the specific mode where you need it: it may break the font-locking
> of that mode, but if it does, at least the breakage will be limited to
> that mode.

No.  font-lock-keywords-case-fold-search is purely a font-lock internal
variable.  Any buffer local value of it created outside of font-lock
gets ignored.  Setting its default value to anything other than nil will
break font-locking, as described above.

There is neither need nor sense in setting
font-lock-keywords-case-fold-search.  Instead, set element 2 of
font-lock-defaults to the desired setting.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).





      reply	other threads:[~2019-09-02 19:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 22:20 bug#37137: Setting font-lock-case-fold-search to t causes hangs on certain types in c-mode Zachary Napier
     [not found] ` <mailman.18.1566429065.1922.bug-gnu-emacs@gnu.org>
2019-08-25 10:22   ` Alan Mackenzie
2019-08-25 18:12 ` Stefan Monnier
2019-09-01 21:28   ` Zachary Napier
2019-09-02 12:50     ` Stefan Monnier
2019-09-02 19:26       ` Alan Mackenzie [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20190902192626.GA4133@ACM \
    --to=acm@muc.de \
    --cc=37137@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=zachary.napier.44@gmail.com \
    /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 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).