GNU bug report logs - #1297
font-lock-keywords-case-fold-search doc and usage

Previous Next

Package: emacs;

Reported by: Dan Nicolaescu <dann <at> ics.uci.edu>

Date: Sun, 2 Nov 2008 16:05:05 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


Message #21 received at 1297 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 1297 <at> debbugs.gnu.org
Subject: Re: font-lock-keywords-case-fold-search doc and usage
Date: Mon, 3 Nov 2008 23:22:54 -0800 (PST)
Chong Yidong <cyd <at> stupidchicken.com> writes:

  > Dan Nicolaescu <dann <at> ics.uci.edu> writes:
  > 
  > >   > Great catch.  No one has complained about this, so clearly it's OK for
  > >   > font-lock-keywords-case-fold-search to be nil.  I removed the bogus
  > >   > 8-year-old setting of font-lock-keywords-case-fold-search.
  > >
  > > But that's not quite right, not sure about the standard, but there are
  > > lisps that are case insensitive:
  > >
  > > (DEFUN foo (arg)
  > >  blah)
  > >
  > > ought to be fontified the same was as:
  > >
  > > (defun foo (arg)
  > >  blah)
  > 
  > We can put this in the wishlist.  I don't see any reason to rock this
  > particular boat right now.

It's easier to fix than to write a wishlist item

--- lisp-mode.el.~1.230.~	2008-11-02 21:49:24.000000000 -0800
+++ lisp-mode.el	2008-11-03 23:13:38.000000000 -0800
@@ -195,7 +195,8 @@
 
 ;; The LISP-SYNTAX argument is used by code in inf-lisp.el and is
 ;; (uselessly) passed from pp.el, chistory.el, gnus-kill.el and score-mode.el
-(defun lisp-mode-variables (&optional lisp-syntax)
+;; KEYWORDS-CASE-SENSITIVE means that for font-lock keywords will not be case sensitive.
+(defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive)
   (when lisp-syntax
     (set-syntax-table lisp-mode-syntax-table))
   (setq local-abbrev-table lisp-mode-abbrev-table)
@@ -241,9 +242,9 @@
   (setq multibyte-syntax-as-symbol t)
   (set (make-local-variable 'syntax-begin-function) 'beginning-of-defun)
   (setq font-lock-defaults
-	'((lisp-font-lock-keywords
+	`((lisp-font-lock-keywords
 	   lisp-font-lock-keywords-1 lisp-font-lock-keywords-2)
-	  nil nil (("+-*/.<>=!?$%_&~^:@" . "w")) nil
+	  nil ,keywords-case-insensitive (("+-*/.<>=!?$%_&~^:@" . "w")) nil
 	  (font-lock-mark-block-function . mark-defun)
 	  (font-lock-syntactic-face-function
 	   . lisp-font-lock-syntactic-face-function))))
@@ -464,7 +465,7 @@ if that value is non-nil."
   (use-local-map lisp-mode-map)
   (setq major-mode 'lisp-mode)
   (setq mode-name "Lisp")
-  (lisp-mode-variables)
+  (lisp-mode-variables nil t)
   (make-local-variable 'comment-start-skip)
   (setq comment-start-skip
        "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")




This bug report was last modified 16 years and 203 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.