From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Unhelpful bit of coding in font-lock.el Date: Sun, 25 Aug 2019 15:29:13 +0000 Message-ID: <20190825152913.GC4724@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="154479"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 25 17:30:09 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i1uT1-000e2b-1U for ged-emacs-devel@m.gmane.org; Sun, 25 Aug 2019 17:30:07 +0200 Original-Received: from localhost ([::1]:43100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i1uSz-0000sk-QD for ged-emacs-devel@m.gmane.org; Sun, 25 Aug 2019 11:30:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54741) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i1uSE-0000s4-BT for emacs-devel@gnu.org; Sun, 25 Aug 2019 11:29:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i1uSC-0007tG-AU for emacs-devel@gnu.org; Sun, 25 Aug 2019 11:29:18 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:16488 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1i1uSC-0007rs-0P for emacs-devel@gnu.org; Sun, 25 Aug 2019 11:29:16 -0400 Original-Received: (qmail 76297 invoked by uid 3782); 25 Aug 2019 14:36:27 -0000 Original-Received: from acm.muc.de (p2E5D5A8B.dip0.t-ipconnect.de [46.93.90.139]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 25 Aug 2019 16:36:26 +0200 Original-Received: (qmail 7537 invoked by uid 1000); 25 Aug 2019 15:29:13 -0000 Content-Disposition: inline X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:239552 Archived-At: 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).