From 73feb431b3a82651d60bde1984a2de56519b2885 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 12 Oct 2025 10:33:58 +0200 Subject: [PATCH] ; elisp-mode.el: Improve consistency among face names. Rename a couple of faces to solidify the convention that the face name 'elisp-foo' implies "references to foo", not "foo definitions". For definitions we use 'elisp-deffoo' if foo is only one word, or 'elisp-bar-baz-definition' otherwise. * lisp/progmodes/elisp-mode.el (elisp-function-reference): Rename to 'elisp-function'. (elisp-macro-call): Rename to 'elisp-macro'. (elisp-non-local-exit): (elisp-unknown-call): (elisp-special-form): * lisp/emacs-lisp/elisp-scope.el: * test/lisp/progmodes/elisp-mode-resources/semantic-highlighting.el: Update references to renamed faces. --- lisp/emacs-lisp/elisp-scope.el | 4 +- lisp/progmodes/elisp-mode.el | 10 +-- .../semantic-highlighting.el | 68 +++++++++---------- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/lisp/emacs-lisp/elisp-scope.el b/lisp/emacs-lisp/elisp-scope.el index 36acf7cbd0c..d0904199419 100644 --- a/lisp/emacs-lisp/elisp-scope.el +++ b/lisp/emacs-lisp/elisp-scope.el @@ -292,7 +292,7 @@ symbol role properties." (elisp-scope-define-symbol-role function (callable) :doc "Function names." - :face 'elisp-function-reference + :face 'elisp-function :help (lambda (beg end def) (cond ((equal beg def) "Local function definition") (def "Local function call") @@ -318,7 +318,7 @@ symbol role properties." (elisp-scope-define-symbol-role macro (callable) :doc "Macro names." - :face 'elisp-macro-call + :face 'elisp-macro :help (lambda (beg end _def) (if-let* ((sym (intern-soft (buffer-substring-no-properties beg end)))) (apply-partially #'elisp--function-help-echo sym) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 2b452bd2a0f..979baa8c1fe 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -328,19 +328,19 @@ code analysis." (defface elisp-symbol-role-definition '((t :foreground "#00008b" :inherit font-lock-function-name-face)) "Face for highlighting symbol role definitions in Emacs Lisp code.") -(defface elisp-function-reference '((t :inherit font-lock-function-call-face)) +(defface elisp-function '((t :inherit font-lock-function-call-face)) "Face for highlighting function calls in Emacs Lisp code.") -(defface elisp-non-local-exit '((t :inherit elisp-function-reference :underline "red")) +(defface elisp-non-local-exit '((t :inherit elisp-function :underline "red")) "Face for highlighting calls to functions that do not return.") -(defface elisp-unknown-call '((t :inherit elisp-function-reference :foreground "#2f4f4f")) +(defface elisp-unknown-call '((t :inherit elisp-function :foreground "#2f4f4f")) "Face for highlighting unknown functions/macros in Emacs Lisp code.") -(defface elisp-macro-call '((t :inherit font-lock-keyword-face)) +(defface elisp-macro '((t :inherit font-lock-keyword-face)) "Face for highlighting macro calls in Emacs Lisp code.") -(defface elisp-special-form '((t :inherit elisp-macro-call)) +(defface elisp-special-form '((t :inherit elisp-macro)) "Face for highlighting special forms in Emacs Lisp code.") (defface elisp-throw-tag '((t :inherit font-lock-constant-face)) diff --git a/test/lisp/progmodes/elisp-mode-resources/semantic-highlighting.el b/test/lisp/progmodes/elisp-mode-resources/semantic-highlighting.el index a41fb05ce18..25949c61818 100644 --- a/test/lisp/progmodes/elisp-mode-resources/semantic-highlighting.el +++ b/test/lisp/progmodes/elisp-mode-resources/semantic-highlighting.el @@ -1,7 +1,7 @@ ;;; semantic-highlighting.el --- -*- lexical-binding: t; -*- (defun foo (bar) -;; ^ (elisp-macro-call font-lock-keyword-face) +;; ^ (elisp-macro font-lock-keyword-face) ;; ^ (elisp-defun font-lock-function-name-face) ;; ^ elisp-binding-variable (let ((cpa current-prefix-arg)) @@ -11,42 +11,42 @@ (or cpa (ignore bar))) ;; ^ (elisp-special-form font-lock-keyword-face) ;; ^ elisp-bound-variable -;; ^ elisp-function-reference +;; ^ elisp-function ;; ^ elisp-bound-variable ) (add-face-text-property -;; ^ elisp-function-reference +;; ^ elisp-function (point) (mark) -;; ^ elisp-function-reference -;; ^ elisp-function-reference +;; ^ elisp-function +;; ^ elisp-function (if not-good ;; ^ (elisp-special-form font-lock-keyword-face) ;; ^ elisp-free-variable 'error ;; ^ elisp-face (message "Good.") -;; ^ elisp-function-reference +;; ^ elisp-function 'success)) ;; ^ elisp-face (require 'cl-lib) -;; ^ (elisp-function-reference font-lock-keyword-face) +;; ^ (elisp-function font-lock-keyword-face) ;; ^ (elisp-feature font-lock-constant-face) ;; Taken from `completion-shorthand-try-completion' in minibuffer.el: (defun foobaz (string table pred point) -;; ^ (elisp-macro-call font-lock-keyword-face) +;; ^ (elisp-macro font-lock-keyword-face) ;; ^ (elisp-defun font-lock-function-name-face) ;; ^ ^ ^ ^ elisp-binding-variable (cl-loop with expanded -;; ^ (elisp-macro-call font-lock-keyword-face) +;; ^ (elisp-macro font-lock-keyword-face) ;; ^ elisp-binding-variable for (short . long) in ;; ^ elisp-binding-variable ;; ^ elisp-binding-variable (with-current-buffer minibuffer--original-buffer -;; ^ (elisp-macro-call font-lock-keyword-face) +;; ^ (elisp-macro font-lock-keyword-face) ;; ^ elisp-free-variable read-symbol-shorthands) ;; ^ elisp-free-variable @@ -54,27 +54,27 @@ ;; ^ elisp-binding-variable (and (> point (length short)) ;; ^ (elisp-special-form font-lock-keyword-face) -;; ^ elisp-function-reference +;; ^ elisp-function ;; ^ elisp-bound-variable -;; ^ elisp-function-reference +;; ^ elisp-function ;; ^ elisp-bound-variable (string-prefix-p short string) -;; ^ elisp-function-reference +;; ^ elisp-function ;; ^ elisp-bound-variable ;; ^ elisp-bound-variable (try-completion (setq expanded -;; ^ elisp-function-reference +;; ^ elisp-function ;; ^ (elisp-special-form font-lock-keyword-face) ;; ^ elisp-bound-variable (concat long -;; ^ elisp-function-reference +;; ^ elisp-function ;; ^ elisp-bound-variable (substring -;; ^ elisp-function-reference +;; ^ elisp-function string ;; ^ elisp-bound-variable (length short)))) -;; ^ elisp-function-reference +;; ^ elisp-function ;; ^ elisp-bound-variable table pred)) ;; ^ elisp-bound-variable @@ -82,44 +82,44 @@ when probe ;; ^ elisp-bound-variable do (message "Shorthand expansion") -;; ^ elisp-function-reference +;; ^ elisp-function and return (cons expanded (max (length long) -;; ^ elisp-function-reference +;; ^ elisp-function ;; ^ elisp-bound-variable -;; ^ elisp-function-reference -;; ^ elisp-function-reference +;; ^ elisp-function +;; ^ elisp-function ;; ^ elisp-bound-variable (+ (- point (length short)) -;; ^ elisp-function-reference -;; ^ elisp-function-reference -;; ^ elisp-function-reference +;; ^ elisp-function +;; ^ elisp-function +;; ^ elisp-function ;; ^ elisp-bound-variable (length long)))))) -;; ^ elisp-function-reference +;; ^ elisp-function ;; ^ elisp-bound-variable (let ((foo 'bar)) ;; ^ (elisp-special-form font-lock-keyword-face) ;; ^ elisp-binding-variable (cl-flet ((foo () 'baz)) -;; ^ (elisp-macro-call font-lock-keyword-face) -;; ^ elisp-function-reference +;; ^ (elisp-macro font-lock-keyword-face) +;; ^ elisp-function (foo) -;; ^ elisp-function-reference +;; ^ elisp-function (cl-macrolet ((foo () 'foo)) -;; ^ (elisp-macro-call font-lock-keyword-face) -;; ^ elisp-macro-call +;; ^ (elisp-macro font-lock-keyword-face) +;; ^ elisp-macro (foo)))) -;; ^ elisp-macro-call +;; ^ elisp-macro (when-let* ((foo (symbol-at-point)) -;; ^ (elisp-macro-call font-lock-keyword-face) +;; ^ (elisp-macro font-lock-keyword-face) ;; ^ elisp-binding-variable -;; ^ elisp-function-reference +;; ^ elisp-function current-prefix-arg ;; ^ elisp-shadowing-variable ((commandp foo))) -;; ^ elisp-function-reference +;; ^ elisp-function ;; ^ elisp-bound-variable foo) ;; ^ elisp-bound-variable