Subject: Re: font-lock-keywords-case-fold-search doc and usage

From: Dan Nicolaescu <[email-masked]>
Date: Mon, 3 Nov 2008 23:22:54 -0800 (PST)

Chong Yidong <[email-masked]> writes:

  > Dan Nicolaescu <[email-masked]> 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]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")