]> code.delx.au - gnu-emacs/commitdiff
Fix elisp function name font-lock bug.
authorTassilo Horn <tsdh@gnu.org>
Fri, 20 Mar 2015 22:09:06 +0000 (23:09 +0100)
committerTassilo Horn <tsdh@gnu.org>
Fri, 20 Mar 2015 22:09:06 +0000 (23:09 +0100)
* emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-1): Fix
false positive in function name font-locking.

lisp/ChangeLog
lisp/emacs-lisp/lisp-mode.el

index ee4e021b9406fe5e95edadf7d7465789467bf48a..85e62be80c25e59c445e0a9f7dbd2629c76721cc 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-20  Tassilo Horn  <tsdh@gnu.org>
+
+       * emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-1): Fix
+       false positive in function name font-locking.
+
 2015-03-20  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * emacs-lisp/cl-macs.el (cl-defsubst): Ignore false-positive
index 6b3077302ed04f7d13922e592e2a96aa082544a0..d8901ac017dd29ec310e7eef91031b7b81fbf233 100644 (file)
     `( ;; Definitions.
       (,(concat "(" el-defs-re "\\_>"
                 ;; Any whitespace and defined object.
-                "[ \t'\(]*"
-                "\\(\\(?:\\sw\\|\\s_\\)+\\)?")
+                "[ \t']*"
+               ;; With cl-defstruct, the name may follow a paren,
+               ;; e.g. (cl-defstruct (foo-struct opts)...).
+                "\\(([ \t']*\\)?\\(\\(?:\\sw\\|\\s_\\)+\\)?")
        (1 font-lock-keyword-face)
-       (2 (let ((type (get (intern-soft (match-string 1)) 'lisp-define-type)))
-            (cond ((eq type 'var) font-lock-variable-name-face)
-                  ((eq type 'type) font-lock-type-face)
-                  (t font-lock-function-name-face)))
-          nil t))
+       (3 (let ((type (get (intern-soft (match-string 1)) 'lisp-define-type)))
+           (cond ((eq type 'var) font-lock-variable-name-face)
+                 ((eq type 'type) font-lock-type-face)
+                 ;; If match-string 2 is non-nil, we encountered a
+                 ;; form like (defalias (intern (concat s "-p"))).
+                 ((not (match-string 2)) font-lock-function-name-face)))
+         nil t))
       ;; Emacs Lisp autoload cookies.  Supports the slightly different
       ;; forms used by mh-e, calendar, etc.
       ("^;;;###\\([-a-z]*autoload\\)" 1 font-lock-warning-face prepend))