emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master c9998fc: Fix elisp function name font-lock bug.


From: Tassilo Horn
Subject: [Emacs-diffs] master c9998fc: Fix elisp function name font-lock bug.
Date: Fri, 20 Mar 2015 22:09:41 +0000

branch: master
commit c9998fcbf40c533004533dee96f2eb67349d55ae
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Fix elisp function name font-lock bug.
    
    * emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-1): Fix
    false positive in function name font-locking.
---
 lisp/ChangeLog               |    5 +++++
 lisp/emacs-lisp/lisp-mode.el |   18 +++++++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ee4e021..85e62be 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-20  Tassilo Horn  <address@hidden>
+
+       * emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-1): Fix
+       false positive in function name font-locking.
+
 2015-03-20  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/cl-macs.el (cl-defsubst): Ignore false-positive
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 6b30773..d8901ac 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -320,14 +320,18 @@
     `( ;; 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]