diff options
| author | Eshel Yaron | 2025-10-12 10:33:58 +0200 |
|---|---|---|
| committer | Eshel Yaron | 2025-10-12 10:33:58 +0200 |
| commit | 73feb431b3a82651d60bde1984a2de56519b2885 (patch) | |
| tree | f60cf316fdd52fac17bbe36b55268cb9f380c7a5 | |
| parent | 026f3bbd8d394ecf3fead9ee2d45dc54ce40b60a (diff) | |
| download | emacs-feature/elisp-fontify-semantically.tar.gz emacs-feature/elisp-fontify-semantically.zip | |
; elisp-mode.el: Improve consistency among face names.feature/elisp-fontify-semantically
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.
| -rw-r--r-- | lisp/emacs-lisp/elisp-scope.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 10 | ||||
| -rw-r--r-- | test/lisp/progmodes/elisp-mode-resources/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." | |||
| 292 | 292 | ||
| 293 | (elisp-scope-define-symbol-role function (callable) | 293 | (elisp-scope-define-symbol-role function (callable) |
| 294 | :doc "Function names." | 294 | :doc "Function names." |
| 295 | :face 'elisp-function-reference | 295 | :face 'elisp-function |
| 296 | :help (lambda (beg end def) | 296 | :help (lambda (beg end def) |
| 297 | (cond ((equal beg def) "Local function definition") | 297 | (cond ((equal beg def) "Local function definition") |
| 298 | (def "Local function call") | 298 | (def "Local function call") |
| @@ -318,7 +318,7 @@ symbol role properties." | |||
| 318 | 318 | ||
| 319 | (elisp-scope-define-symbol-role macro (callable) | 319 | (elisp-scope-define-symbol-role macro (callable) |
| 320 | :doc "Macro names." | 320 | :doc "Macro names." |
| 321 | :face 'elisp-macro-call | 321 | :face 'elisp-macro |
| 322 | :help (lambda (beg end _def) | 322 | :help (lambda (beg end _def) |
| 323 | (if-let* ((sym (intern-soft (buffer-substring-no-properties beg end)))) | 323 | (if-let* ((sym (intern-soft (buffer-substring-no-properties beg end)))) |
| 324 | (apply-partially #'elisp--function-help-echo sym) | 324 | (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." | |||
| 328 | (defface elisp-symbol-role-definition '((t :foreground "#00008b" :inherit font-lock-function-name-face)) | 328 | (defface elisp-symbol-role-definition '((t :foreground "#00008b" :inherit font-lock-function-name-face)) |
| 329 | "Face for highlighting symbol role definitions in Emacs Lisp code.") | 329 | "Face for highlighting symbol role definitions in Emacs Lisp code.") |
| 330 | 330 | ||
| 331 | (defface elisp-function-reference '((t :inherit font-lock-function-call-face)) | 331 | (defface elisp-function '((t :inherit font-lock-function-call-face)) |
| 332 | "Face for highlighting function calls in Emacs Lisp code.") | 332 | "Face for highlighting function calls in Emacs Lisp code.") |
| 333 | 333 | ||
| 334 | (defface elisp-non-local-exit '((t :inherit elisp-function-reference :underline "red")) | 334 | (defface elisp-non-local-exit '((t :inherit elisp-function :underline "red")) |
| 335 | "Face for highlighting calls to functions that do not return.") | 335 | "Face for highlighting calls to functions that do not return.") |
| 336 | 336 | ||
| 337 | (defface elisp-unknown-call '((t :inherit elisp-function-reference :foreground "#2f4f4f")) | 337 | (defface elisp-unknown-call '((t :inherit elisp-function :foreground "#2f4f4f")) |
| 338 | "Face for highlighting unknown functions/macros in Emacs Lisp code.") | 338 | "Face for highlighting unknown functions/macros in Emacs Lisp code.") |
| 339 | 339 | ||
| 340 | (defface elisp-macro-call '((t :inherit font-lock-keyword-face)) | 340 | (defface elisp-macro '((t :inherit font-lock-keyword-face)) |
| 341 | "Face for highlighting macro calls in Emacs Lisp code.") | 341 | "Face for highlighting macro calls in Emacs Lisp code.") |
| 342 | 342 | ||
| 343 | (defface elisp-special-form '((t :inherit elisp-macro-call)) | 343 | (defface elisp-special-form '((t :inherit elisp-macro)) |
| 344 | "Face for highlighting special forms in Emacs Lisp code.") | 344 | "Face for highlighting special forms in Emacs Lisp code.") |
| 345 | 345 | ||
| 346 | (defface elisp-throw-tag '((t :inherit font-lock-constant-face)) | 346 | (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 @@ | |||
| 1 | ;;; semantic-highlighting.el --- -*- lexical-binding: t; -*- | 1 | ;;; semantic-highlighting.el --- -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | (defun foo (bar) | 3 | (defun foo (bar) |
| 4 | ;; ^ (elisp-macro-call font-lock-keyword-face) | 4 | ;; ^ (elisp-macro font-lock-keyword-face) |
| 5 | ;; ^ (elisp-defun font-lock-function-name-face) | 5 | ;; ^ (elisp-defun font-lock-function-name-face) |
| 6 | ;; ^ elisp-binding-variable | 6 | ;; ^ elisp-binding-variable |
| 7 | (let ((cpa current-prefix-arg)) | 7 | (let ((cpa current-prefix-arg)) |
| @@ -11,42 +11,42 @@ | |||
| 11 | (or cpa (ignore bar))) | 11 | (or cpa (ignore bar))) |
| 12 | ;; ^ (elisp-special-form font-lock-keyword-face) | 12 | ;; ^ (elisp-special-form font-lock-keyword-face) |
| 13 | ;; ^ elisp-bound-variable | 13 | ;; ^ elisp-bound-variable |
| 14 | ;; ^ elisp-function-reference | 14 | ;; ^ elisp-function |
| 15 | ;; ^ elisp-bound-variable | 15 | ;; ^ elisp-bound-variable |
| 16 | ) | 16 | ) |
| 17 | 17 | ||
| 18 | (add-face-text-property | 18 | (add-face-text-property |
| 19 | ;; ^ elisp-function-reference | 19 | ;; ^ elisp-function |
| 20 | (point) (mark) | 20 | (point) (mark) |
| 21 | ;; ^ elisp-function-reference | 21 | ;; ^ elisp-function |
| 22 | ;; ^ elisp-function-reference | 22 | ;; ^ elisp-function |
| 23 | (if not-good | 23 | (if not-good |
| 24 | ;; ^ (elisp-special-form font-lock-keyword-face) | 24 | ;; ^ (elisp-special-form font-lock-keyword-face) |
| 25 | ;; ^ elisp-free-variable | 25 | ;; ^ elisp-free-variable |
| 26 | 'error | 26 | 'error |
| 27 | ;; ^ elisp-face | 27 | ;; ^ elisp-face |
| 28 | (message "Good.") | 28 | (message "Good.") |
| 29 | ;; ^ elisp-function-reference | 29 | ;; ^ elisp-function |
| 30 | 'success)) | 30 | 'success)) |
| 31 | ;; ^ elisp-face | 31 | ;; ^ elisp-face |
| 32 | 32 | ||
| 33 | (require 'cl-lib) | 33 | (require 'cl-lib) |
| 34 | ;; ^ (elisp-function-reference font-lock-keyword-face) | 34 | ;; ^ (elisp-function font-lock-keyword-face) |
| 35 | ;; ^ (elisp-feature font-lock-constant-face) | 35 | ;; ^ (elisp-feature font-lock-constant-face) |
| 36 | 36 | ||
| 37 | ;; Taken from `completion-shorthand-try-completion' in minibuffer.el: | 37 | ;; Taken from `completion-shorthand-try-completion' in minibuffer.el: |
| 38 | (defun foobaz (string table pred point) | 38 | (defun foobaz (string table pred point) |
| 39 | ;; ^ (elisp-macro-call font-lock-keyword-face) | 39 | ;; ^ (elisp-macro font-lock-keyword-face) |
| 40 | ;; ^ (elisp-defun font-lock-function-name-face) | 40 | ;; ^ (elisp-defun font-lock-function-name-face) |
| 41 | ;; ^ ^ ^ ^ elisp-binding-variable | 41 | ;; ^ ^ ^ ^ elisp-binding-variable |
| 42 | (cl-loop with expanded | 42 | (cl-loop with expanded |
| 43 | ;; ^ (elisp-macro-call font-lock-keyword-face) | 43 | ;; ^ (elisp-macro font-lock-keyword-face) |
| 44 | ;; ^ elisp-binding-variable | 44 | ;; ^ elisp-binding-variable |
| 45 | for (short . long) in | 45 | for (short . long) in |
| 46 | ;; ^ elisp-binding-variable | 46 | ;; ^ elisp-binding-variable |
| 47 | ;; ^ elisp-binding-variable | 47 | ;; ^ elisp-binding-variable |
| 48 | (with-current-buffer minibuffer--original-buffer | 48 | (with-current-buffer minibuffer--original-buffer |
| 49 | ;; ^ (elisp-macro-call font-lock-keyword-face) | 49 | ;; ^ (elisp-macro font-lock-keyword-face) |
| 50 | ;; ^ elisp-free-variable | 50 | ;; ^ elisp-free-variable |
| 51 | read-symbol-shorthands) | 51 | read-symbol-shorthands) |
| 52 | ;; ^ elisp-free-variable | 52 | ;; ^ elisp-free-variable |
| @@ -54,27 +54,27 @@ | |||
| 54 | ;; ^ elisp-binding-variable | 54 | ;; ^ elisp-binding-variable |
| 55 | (and (> point (length short)) | 55 | (and (> point (length short)) |
| 56 | ;; ^ (elisp-special-form font-lock-keyword-face) | 56 | ;; ^ (elisp-special-form font-lock-keyword-face) |
| 57 | ;; ^ elisp-function-reference | 57 | ;; ^ elisp-function |
| 58 | ;; ^ elisp-bound-variable | 58 | ;; ^ elisp-bound-variable |
| 59 | ;; ^ elisp-function-reference | 59 | ;; ^ elisp-function |
| 60 | ;; ^ elisp-bound-variable | 60 | ;; ^ elisp-bound-variable |
| 61 | (string-prefix-p short string) | 61 | (string-prefix-p short string) |
| 62 | ;; ^ elisp-function-reference | 62 | ;; ^ elisp-function |
| 63 | ;; ^ elisp-bound-variable | 63 | ;; ^ elisp-bound-variable |
| 64 | ;; ^ elisp-bound-variable | 64 | ;; ^ elisp-bound-variable |
| 65 | (try-completion (setq expanded | 65 | (try-completion (setq expanded |
| 66 | ;; ^ elisp-function-reference | 66 | ;; ^ elisp-function |
| 67 | ;; ^ (elisp-special-form font-lock-keyword-face) | 67 | ;; ^ (elisp-special-form font-lock-keyword-face) |
| 68 | ;; ^ elisp-bound-variable | 68 | ;; ^ elisp-bound-variable |
| 69 | (concat long | 69 | (concat long |
| 70 | ;; ^ elisp-function-reference | 70 | ;; ^ elisp-function |
| 71 | ;; ^ elisp-bound-variable | 71 | ;; ^ elisp-bound-variable |
| 72 | (substring | 72 | (substring |
| 73 | ;; ^ elisp-function-reference | 73 | ;; ^ elisp-function |
| 74 | string | 74 | string |
| 75 | ;; ^ elisp-bound-variable | 75 | ;; ^ elisp-bound-variable |
| 76 | (length short)))) | 76 | (length short)))) |
| 77 | ;; ^ elisp-function-reference | 77 | ;; ^ elisp-function |
| 78 | ;; ^ elisp-bound-variable | 78 | ;; ^ elisp-bound-variable |
| 79 | table pred)) | 79 | table pred)) |
| 80 | ;; ^ elisp-bound-variable | 80 | ;; ^ elisp-bound-variable |
| @@ -82,44 +82,44 @@ | |||
| 82 | when probe | 82 | when probe |
| 83 | ;; ^ elisp-bound-variable | 83 | ;; ^ elisp-bound-variable |
| 84 | do (message "Shorthand expansion") | 84 | do (message "Shorthand expansion") |
| 85 | ;; ^ elisp-function-reference | 85 | ;; ^ elisp-function |
| 86 | and return (cons expanded (max (length long) | 86 | and return (cons expanded (max (length long) |
| 87 | ;; ^ elisp-function-reference | 87 | ;; ^ elisp-function |
| 88 | ;; ^ elisp-bound-variable | 88 | ;; ^ elisp-bound-variable |
| 89 | ;; ^ elisp-function-reference | 89 | ;; ^ elisp-function |
| 90 | ;; ^ elisp-function-reference | 90 | ;; ^ elisp-function |
| 91 | ;; ^ elisp-bound-variable | 91 | ;; ^ elisp-bound-variable |
| 92 | (+ (- point (length short)) | 92 | (+ (- point (length short)) |
| 93 | ;; ^ elisp-function-reference | 93 | ;; ^ elisp-function |
| 94 | ;; ^ elisp-function-reference | 94 | ;; ^ elisp-function |
| 95 | ;; ^ elisp-function-reference | 95 | ;; ^ elisp-function |
| 96 | ;; ^ elisp-bound-variable | 96 | ;; ^ elisp-bound-variable |
| 97 | (length long)))))) | 97 | (length long)))))) |
| 98 | ;; ^ elisp-function-reference | 98 | ;; ^ elisp-function |
| 99 | ;; ^ elisp-bound-variable | 99 | ;; ^ elisp-bound-variable |
| 100 | 100 | ||
| 101 | (let ((foo 'bar)) | 101 | (let ((foo 'bar)) |
| 102 | ;; ^ (elisp-special-form font-lock-keyword-face) | 102 | ;; ^ (elisp-special-form font-lock-keyword-face) |
| 103 | ;; ^ elisp-binding-variable | 103 | ;; ^ elisp-binding-variable |
| 104 | (cl-flet ((foo () 'baz)) | 104 | (cl-flet ((foo () 'baz)) |
| 105 | ;; ^ (elisp-macro-call font-lock-keyword-face) | 105 | ;; ^ (elisp-macro font-lock-keyword-face) |
| 106 | ;; ^ elisp-function-reference | 106 | ;; ^ elisp-function |
| 107 | (foo) | 107 | (foo) |
| 108 | ;; ^ elisp-function-reference | 108 | ;; ^ elisp-function |
| 109 | (cl-macrolet ((foo () 'foo)) | 109 | (cl-macrolet ((foo () 'foo)) |
| 110 | ;; ^ (elisp-macro-call font-lock-keyword-face) | 110 | ;; ^ (elisp-macro font-lock-keyword-face) |
| 111 | ;; ^ elisp-macro-call | 111 | ;; ^ elisp-macro |
| 112 | (foo)))) | 112 | (foo)))) |
| 113 | ;; ^ elisp-macro-call | 113 | ;; ^ elisp-macro |
| 114 | 114 | ||
| 115 | (when-let* ((foo (symbol-at-point)) | 115 | (when-let* ((foo (symbol-at-point)) |
| 116 | ;; ^ (elisp-macro-call font-lock-keyword-face) | 116 | ;; ^ (elisp-macro font-lock-keyword-face) |
| 117 | ;; ^ elisp-binding-variable | 117 | ;; ^ elisp-binding-variable |
| 118 | ;; ^ elisp-function-reference | 118 | ;; ^ elisp-function |
| 119 | current-prefix-arg | 119 | current-prefix-arg |
| 120 | ;; ^ elisp-shadowing-variable | 120 | ;; ^ elisp-shadowing-variable |
| 121 | ((commandp foo))) | 121 | ((commandp foo))) |
| 122 | ;; ^ elisp-function-reference | 122 | ;; ^ elisp-function |
| 123 | ;; ^ elisp-bound-variable | 123 | ;; ^ elisp-bound-variable |
| 124 | foo) | 124 | foo) |
| 125 | ;; ^ elisp-bound-variable | 125 | ;; ^ elisp-bound-variable |