]> git.eshelyaron.com Git - emacs.git/commitdiff
Make font-lock face variables obsolete
authorStefan Kangas <stefankangas@gmail.com>
Wed, 18 Dec 2024 02:46:04 +0000 (03:46 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 23 Dec 2024 15:13:12 +0000 (16:13 +0100)
Using these variables as "another mechanism for changing face
appearance" never really worked, since mode authors were free to use the
face instead of the variable (i.e. quoting the symbol).  This means that
when users customized the variables, it would change its appearance only
in some cases, which is a rather surprising interface.

Indeed, it turns out that some modes have not always been consistent,
and mixed using the variable and the face, increasing the confusion even
further.  Thus, the only thing users could rely on to always work was to
leave the variables at their default value, and to customize the face.

We now recommend customizing the face, and are obsoleting these
variables.  This will lead to some minor code-churn, but it is believed
that it will be ultimately worth it.  To fix existing Lisp code, you
should typically only need to quote the symbol, as this commit shows.

It might be the case that we will have to keep the obsolete variables,
that have been with us since Emacs 19, around for a longer time-period
than normal, to allow package authors to adapt.

* lisp/font-lock.el (font-lock-comment-face)
(font-lock-comment-delimiter-face, font-lock-string-face)
(font-lock-doc-face, font-lock-doc-markup-face, font-lock-keyword-face)
(font-lock-builtin-face, font-lock-function-name-face)
(font-lock-variable-name-face, font-lock-type-face)
(font-lock-constant-face, font-lock-warning-face)
(font-lock-negation-char-face, font-lock-preprocessor-face): Make face
variables obsolete in favor of customizing the faces directly
instead.  (Bug#71469)

* doc/lispref/modes.texi (Faces for Font Lock): Don't document above
obsolete variables.

* lisp/cedet/data-debug.el (data-debug-insert-hash-table)
(data-debug-insert-widget-properties, data-debug-insert-string)
(data-debug-insert-number):
* lisp/emacs-lisp/lisp-mode.el (elisp--font-lock-backslash)
(lisp-font-lock-syntactic-face-function):
* lisp/emacs-lisp/package.el (describe-package-1):
* lisp/generic-x.el (rc-generic-mode, rul-generic-mode):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/progmodes/cc-fonts.el (c-font-lock-invalid-single-quotes)
(c-maybe-font-lock-wrong-style-comments, c-font-lock-declarators)
(c-font-lock-c++-lambda-captures, c-font-lock-c++-modules):
* lisp/progmodes/cperl-mode.el (cperl-find-sub-attrs)
(cperl-look-at-leading-count, cperl-process-here-doc)
(cperl-find-pods-heres):
* lisp/progmodes/gdb-mi.el (gdb-init-1, gdb-update, gdb-running)
(gdb-starting, gdb-stopped, gdb-internals)
(gdb-breakpoints--add-breakpoint-row, gdb-locals-handler-custom)
(gdb-registers-handler-custom, gdb-get-source-file):
* lisp/progmodes/js.el (js--font-lock-keywords-1)
(js--font-lock-keywords-2, js-font-lock-syntactic-face-function):
* lisp/progmodes/lua-ts-mode.el (lua-ts--comment-font-lock):
* lisp/progmodes/meta-mode.el (meta-indent-in-string-p):
* lisp/progmodes/prolog.el (prolog-font-lock-keywords):
* lisp/progmodes/python.el (python-font-lock-syntactic-face-function):
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--comment-font-lock):
* lisp/progmodes/sh-script.el (sh-font-lock-syntactic-face-function):
* lisp/textmodes/tex-mode.el (doctex-font-lock-syntactic-face-function):
* test/lisp/faces-tests.el (faces--test-color-at-point):
* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-extra-delimiters)
(cperl-test-bug-47112, cperl-test-bug-65834, cperl-test-bug-66145)
(cperl-test-bug-66161, cperl-test-bug-69604):
* test/lisp/progmodes/python-tests.el
(python-ts-mode-compound-keywords-face)
(python-ts-mode-named-assignment-face-1)
(python-ts-mode-assignment-face-2, python-ts-mode-nested-types-face-1)
(python-ts-mode-union-types-face-1, python-ts-mode-union-types-face-2)
(python-ts-mode-types-face-1, python-ts-mode-types-face-2)
(python-ts-mode-types-face-3, python-ts-mode-isinstance-type-face-1)
(python-ts-mode-isinstance-type-face-2)
(python-ts-mode-isinstance-type-face-3)
(python-ts-mode-superclass-type-face, python-ts-mode-class-patterns-face)
(python-ts-mode-dotted-decorator-face-1)
(python-ts-mode-dotted-decorator-face-2)
(python-ts-mode-builtin-call-face)
(python-ts-mode-interpolation-nested-string)
(python-ts-mode-level-fontification-wo-interpolation)
(python-ts-mode-disabled-string-interpolation)
(python-ts-mode-interpolation-doc-string):
* test/lisp/progmodes/ruby-mode-tests.el
(ruby-heredoc-font-lock, ruby-heredoc-highlights-interpolations)
(ruby-exit!-font-lock, ruby-regexp-interpolation-is-highlighted)
(ruby-recognize-symbols-starting-with-at-character)
(ruby-hash-character-not-interpolation)
(ruby-interpolation-suppresses-quotes-inside)
(ruby-interpolation-suppresses-one-double-quote)
(ruby-interpolation-inside-percent-literal)
(ruby-interpolation-inside-percent-literal-with-paren)
(ruby-interpolation-inside-another-interpolation)
(ruby-interpolation-inside-double-quoted-percent-literals)
(ruby-no-interpolation-in-single-quoted-literals):
Don't use above obsolete variables.
* lisp/progmodes/cc-fonts.el (font-lock-constant-face): Don't
declare now-unused variable.

(cherry picked from commit 3d3c1094604ceb6133a15226aec9b568f7923ee7)

21 files changed:
doc/lispref/modes.texi
lisp/emacs-lisp/lisp-mode.el
lisp/emacs-lisp/package.el
lisp/font-lock.el
lisp/generic-x.el
lisp/org/org-table.el
lisp/progmodes/cc-fonts.el
lisp/progmodes/cperl-mode.el
lisp/progmodes/gdb-mi.el
lisp/progmodes/js.el
lisp/progmodes/lua-ts-mode.el
lisp/progmodes/meta-mode.el
lisp/progmodes/prolog.el
lisp/progmodes/python.el
lisp/progmodes/ruby-ts-mode.el
lisp/progmodes/sh-script.el
lisp/textmodes/tex-mode.el
test/lisp/faces-tests.el
test/lisp/progmodes/cperl-mode-tests.el
test/lisp/progmodes/python-tests.el
test/lisp/progmodes/ruby-mode-tests.el

index d2d51d0fd99a14a987f805623d048aedf325b35e..6662da72d6ded4c675320cc32fc9b08f9565a203 100644 (file)
@@ -3869,10 +3869,6 @@ faces specifically for Font Lock to use to highlight text.  These
 modes for syntactic highlighting outside of Font Lock mode (@pxref{Major
 Mode Conventions}).
 
-  Each of these symbols is both a face name, and a variable whose
-default value is the symbol itself.  Thus, the default value of
-@code{font-lock-comment-face} is @code{font-lock-comment-face}.
-
   The faces are listed with descriptions of their typical usage, and in
 order of greater to lesser prominence.  If a mode's syntactic
 categories do not fit well with the usage descriptions, the faces can be
index dfbd2178258ac34516d9da79484743817e99208e..264464d70425570cb5c738c6083e05a804d7ed10 100644 (file)
@@ -305,7 +305,7 @@ This will generate compile-time constants from BINDINGS."
                                 (buffer-substring-no-properties
                                  beg0 end0)))))
                 (buffer-substring-no-properties (1+ beg0) end0))
-         `(face ,font-lock-warning-face
+         '(face font-lock-warning-face
                 help-echo "This \\ has no effect"))))
 
 (defun lisp--match-confusable-symbol-character  (limit)
@@ -657,9 +657,9 @@ Lisp font lock syntactic face function."
           (let ((listbeg (nth 1 state)))
             (if (or (lisp-string-in-doc-position-p listbeg startpos)
                     (lisp-string-after-doc-keyword-p listbeg startpos))
-                font-lock-doc-face
-              font-lock-string-face))))
-    font-lock-comment-face))
+                'font-lock-doc-face
+              'font-lock-string-face))))
+    'font-lock-comment-face))
 
 (defun lisp-adaptive-fill ()
   "Return fill prefix found at point.
index 7a8e5a685d9b0593f951c9b4fcf9373a071d198b..ba2d16ebed2a31089d913385cf4824fede417008 100644 (file)
@@ -2867,7 +2867,7 @@ Helper function for `describe-package'."
                                   'action #'package-delete-button-action
                                   'package-desc desc)))
           (incompatible-reason
-           (insert (propertize "Incompatible" 'font-lock-face font-lock-warning-face)
+           (insert (propertize "Incompatible" 'font-lock-face 'font-lock-warning-face)
                    " because it depends on ")
            (if (stringp incompatible-reason)
                (insert "Emacs " incompatible-reason ".")
index b8a4d97cc6a20604a0465dc6a6d785917e5f5a0e..dd33c2382fcd7c1662825b1cab9dc28ed040bb9c 100644 (file)
@@ -303,62 +303,96 @@ If a number, only buffers greater than this size have fontification messages."
                  (other :tag "always" t))
   :group 'font-lock
   :version "24.1")
+
 \f
+;; Obsolete face variables.
 
-;; Originally these variable values were face names such as `bold' etc.
-;; Now we create our own faces, but we keep these variables for compatibility
-;; and they give users another mechanism for changing face appearance.
-;; We now allow a FACENAME in `font-lock-keywords' to be any expression that
-;; returns a face.  So the easiest thing is to continue using these variables,
-;; rather than sometimes evalling FACENAME and sometimes not.  sm.
-
-;; Note that in new code, in the vast majority of cases there is no
-;; need to create variables that specify face names.  Simply using
-;; faces directly is enough.  Font-lock is not a template to be
-;; followed in this area.
+(make-obsolete-variable
+ 'font-lock-comment-face
+ "use the quoted symbol instead: \\='font-lock-comment-face" "31.1")
 (defvar font-lock-comment-face         'font-lock-comment-face
   "Face name to use for comments.")
 
+(make-obsolete-variable
+ 'font-lock-comment-delimiter-face
+ "use the quoted symbol instead: \\='font-lock-comment-delimiter-face" "31.1")
 (defvar font-lock-comment-delimiter-face 'font-lock-comment-delimiter-face
   "Face name to use for comment delimiters.")
 
+(make-obsolete-variable
+ 'font-lock-string-face
+ "use the quoted symbol instead: \\='font-lock-string-face" "31.1")
 (defvar font-lock-string-face          'font-lock-string-face
   "Face name to use for strings.")
 
+(make-obsolete-variable
+ 'font-lock-doc-face
+ "use the quoted symbol instead: \\='font-lock-doc-face" "31.1")
 (defvar font-lock-doc-face             'font-lock-doc-face
   "Face name to use for documentation.")
 
+(make-obsolete-variable
+ 'font-lock-doc-markup-face
+ "use the quoted symbol instead: \\='font-lock-doc-markup-face" "31.1")
 (defvar font-lock-doc-markup-face       'font-lock-doc-markup-face
   "Face name to use for documentation mark-up.")
 
+(make-obsolete-variable
+ 'font-lock-keyword-face
+ "use the quoted symbol instead: \\='font-lock-keyword-face" "31.1")
 (defvar font-lock-keyword-face         'font-lock-keyword-face
   "Face name to use for keywords.")
 
+(make-obsolete-variable
+ 'font-lock-builtin-face
+ "use the quoted symbol instead: \\='font-lock-builtin-face" "31.1")
 (defvar font-lock-builtin-face         'font-lock-builtin-face
   "Face name to use for builtins.")
 
+(make-obsolete-variable
+ 'font-lock-function-name-face
+ "use the quoted symbol instead: \\='font-lock-function-name-face" "31.1")
 (defvar font-lock-function-name-face   'font-lock-function-name-face
   "Face name to use for function names.")
 
+(make-obsolete-variable
+ 'font-lock-variable-name-face
+ "use the quoted symbol instead: \\='font-lock-variable-name-face" "31.1")
 (defvar font-lock-variable-name-face   'font-lock-variable-name-face
   "Face name to use for variable names.")
 
+(make-obsolete-variable
+ 'font-lock-type-face
+ "use the quoted symbol instead: \\='font-lock-type-face" "31.1")
 (defvar font-lock-type-face            'font-lock-type-face
   "Face name to use for type and class names.")
 
+(make-obsolete-variable
+ 'font-lock-constant-face
+ "use the quoted symbol instead: \\='font-lock-constant-face" "31.1")
 (defvar font-lock-constant-face                'font-lock-constant-face
   "Face name to use for constant and label names.")
 
+(make-obsolete-variable
+ 'font-lock-warning-face
+ "use the quoted symbol instead: \\='font-lock-warning-face" "31.1")
 (defvar font-lock-warning-face         'font-lock-warning-face
   "Face name to use for things that should stand out.")
 
+(make-obsolete-variable
+ 'font-lock-negation-char-face
+ "use the quoted symbol instead: \\='font-lock-negation-char-face" "31.1")
 (defvar font-lock-negation-char-face   'font-lock-negation-char-face
   "Face name to use for easy to overlook negation.
 This can be an \"!\" or the \"n\" in \"ifndef\".")
 
+(make-obsolete-variable
+ 'font-lock-preprocessor-face
+ "use the quoted symbol instead: \\='font-lock-preprocessor-face" "31.1")
 (defvar font-lock-preprocessor-face    'font-lock-preprocessor-face
   "Face name to use for preprocessor directives.")
 
+\f
 ;; Fontification variables:
 
 (defvar font-lock-keywords nil
index 373bfad92dd0adc6757cece0c9932125d82ae7b1..d2f3ad30245966cf20a9712513b88cf4660150fb 100644 (file)
@@ -702,9 +702,9 @@ like an INI file.  You can add this hook to `find-file-hook'."
                         "FILETYPE"
                         "FILEVERSION"
                         "PRODUCTVERSION") 'symbols)
-          font-lock-type-face)
+           1 'font-lock-type-face)
      (list (regexp-opt '("BEGIN" "BLOCK" "END" "VALUE") 'symbols)
-          font-lock-function-name-face)
+           1 'font-lock-function-name-face)
      '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face)
      '("^#[ \t]*define[ \t]+\\(\\sw+\\)("       1 font-lock-function-name-face)
      '("^#[ \t]*\\(elif\\|if\\)\\>"
@@ -1323,22 +1323,22 @@ like an INI file.  You can add this hook to `find-file-hook'."
      (list (concat "[^_]"
                   (regexp-opt installshield-system-variables-list 'symbols)
                   "[^_]")
-          font-lock-variable-name-face)
+           1 'font-lock-variable-name-face)
      ;; system functions
      (list (concat "[^_]"
                   (regexp-opt installshield-system-functions-list 'symbols)
                   "[^_]")
-          font-lock-function-name-face)
+           1 'font-lock-function-name-face)
      ;; type keywords
      (list (concat "[^_]"
                   (regexp-opt installshield-types-list 'symbols)
                   "[^_]")
-          font-lock-type-face)
+           1 'font-lock-type-face)
      ;; function argument constants
      (list (concat "[^_]"
                   (regexp-opt installshield-funarg-constants-list 'symbols)
                   "[^_]")
-          font-lock-variable-name-face))) ; is this face the best choice?
+           1 'font-lock-variable-name-face))) ; is this face the best choice?
   '("\\.[rR][uU][lL]\\'")
   '(generic-rul-mode-setup-function)
   "Generic mode for InstallShield RUL files.")
index 8a0943a48b9b7e2bd4ef9311e2df1c84cb85554c..dad5b0af1cc475fbc5792dc441b9f1b9ffcf7147 100644 (file)
@@ -3412,7 +3412,7 @@ Parameters get priority."
          (when title
            (unless (bobp) (insert "\n"))
            (insert
-            (org-add-props (cdr title) nil 'face font-lock-comment-face))
+             (org-add-props (cdr title) nil 'face 'font-lock-comment-face))
            (setq titles (remove title titles)))
          (when (equal key (car entry)) (setq startline (org-current-line)))
          (let ((s (concat
index 83afe081b8586ea368b6a65cfa482e100f72c406..b18561667f8122005cfd6aebf45afbbe373a993b 100644 (file)
         'font-lock-reference-face)
        (t 'font-lock-constant-face)))
 
-(cc-bytecomp-defvar font-lock-constant-face)
-
 (defconst c-label-face-name
   (cond ((c-face-name-p 'font-lock-label-face)
         ;; If it happens to occur in the future.  (Well, the more
@@ -712,7 +710,7 @@ stuff.  Used on level 1 and higher."
                    (< (point) end))
        (if (and (equal (c-get-char-property (point) 'syntax-table) '(1))
                 (not (c-get-char-property (point) 'c-digit-separator)))
-           (c-put-font-lock-face (point) (1+ (point)) font-lock-warning-face))
+           (c-put-font-lock-face (point) (1+ (point)) 'font-lock-warning-face))
        (forward-char))
       (parse-partial-sexp end limit nil nil state 'syntax-table)))
     nil)
@@ -743,7 +741,7 @@ stuff.  Used on level 1 and higher."
        ;; Font lock the block comment ender with warning face.
        (when (not (nth 4 s))
          (c-put-font-lock-face (- (point) (length c-block-comment-ender))
-                               (point) font-lock-warning-face)))
+                               (point) 'font-lock-warning-face)))
        (t ; In a line comment, or a "valid" block comment
        (setq s (parse-partial-sexp (point) limit nil nil s 'syntax-table))))
 
@@ -760,14 +758,14 @@ stuff.  Used on level 1 and higher."
          (setq s (parse-partial-sexp (point) limit nil nil s 'syntax-table)))
         ((nth 4 s)                     ; In an invalid comment
         ;; Fontify the invalid comment opener.
-         (c-put-font-lock-face (nth 8 s) (point) font-lock-warning-face)
+         (c-put-font-lock-face (nth 8 s) (point) 'font-lock-warning-face)
          ;; Move to end of comment or LIMIT.
          (setq s (parse-partial-sexp (point) limit nil nil s 'syntax-table))
          ;; Fontify an invalid block comment ender, if that's what we have.
          (when (and (not c-block-comment-flag)
                     (not (nth 4 s)))   ; We're outside the comment
            (c-put-font-lock-face (- (point) (length c-block-comment-ender))
-                                 (point) font-lock-warning-face)))))))
+                                 (point) 'font-lock-warning-face)))))))
   nil)
 
 (c-lang-defconst c-basic-matchers-before
@@ -1173,7 +1171,7 @@ casts and declarations are fontified.  Used on level 2 and higher."
               (c-put-font-lock-face
                (point)
                (progn (c-forward-over-token) (point))
-               font-lock-function-name-face)))))
+               'font-lock-function-name-face)))))
        (and template-class
            (eq init-char ?=)           ; C++ "<class X = Y>"?
            (progn
@@ -2066,7 +2064,7 @@ casts and declarations are fontified.  Used on level 2 and higher."
                                       ((and capture-default
                                             (eq mode capture-default))
                                        'font-lock-warning-face)
-                                      ((eq mode ?=) font-lock-constant-face)
+                                      ((eq mode ?=) 'font-lock-constant-face)
                                       (t 'font-lock-variable-name-face))))
            (c-syntactic-re-search-forward "," limit 'bound t))
 
@@ -2194,7 +2192,7 @@ casts and declarations are fontified.  Used on level 2 and higher."
                    (c-put-font-lock-face
                     (1+ beg) (if end (1- end) (point)) font-lock-string-face)
                  (c-put-font-lock-face
-                  beg (or end (point)) font-lock-string-face))
+                  beg (or end (point)) 'font-lock-string-face))
                (c-forward-syntactic-ws limit)
                t)
               (t nil)))
@@ -2234,9 +2232,9 @@ casts and declarations are fontified.  Used on level 2 and higher."
                                        c-reference-face-name)))
            ;; No semicolon, so put warning faces on any delimiters.
            (when beg
-             (c-put-font-lock-face beg (1+ beg) font-lock-warning-face))
+             (c-put-font-lock-face beg (1+ beg) 'font-lock-warning-face))
            (when end
-             (c-put-font-lock-face (1- end) end font-lock-warning-face))))))))
+             (c-put-font-lock-face (1- end) end 'font-lock-warning-face))))))))
 
 (c-lang-defconst c-simple-decl-matchers
   "Simple font lock matchers for types and declarations.  These are used
index f37ab070ad50fb6685c9b52c2c583acb401e14da..f8e565eb8f7bc262cb78480ea6c80f9c3b9ad2e9 100644 (file)
@@ -4027,10 +4027,10 @@ an attribute.  ST-L and POS are a cached from a previous call."
          (and (match-beginning 1)
               (cperl-postpone-fontification
                (match-beginning 0) (cperl-1+ (match-beginning 0))
-               'face font-lock-constant-face))
+                'face 'font-lock-constant-face))
          (setq start1 (match-beginning 3) end1 (match-end 3))
          (cperl-postpone-fontification start1 end1
-                                       'face font-lock-constant-face)
+                                        'face 'font-lock-constant-face)
          (goto-char end1)              ; end or before `('
          (if (match-end 4)             ; Have attribute arguments...
              (progn
@@ -4099,7 +4099,7 @@ If IS-X-REX is non-nil, then process a regular expression which has an
       (if (eq ?\{ (preceding-char)) nil
        (cperl-postpone-fontification
         (1- (point)) (point)
-        'face font-lock-warning-face))))
+         'face 'font-lock-warning-face))))
 
 ;; Do some smarter-highlighting
 ;; XXXX Currently ignores alphanum/dash delims,
@@ -4216,7 +4216,7 @@ END-OF-HERE-DOC is the end of a previous here-doc in the same
 line, or nil if this is the first.  DELIM-BEGIN and DELIM-END are
 the positions where the here-document's delimiter has been found.
 This is part of `cperl-find-pods-heres' (below)."
-  (let* ((my-cperl-delimiters-face font-lock-constant-face)
+  (let* ((my-cperl-delimiters-face 'font-lock-constant-face)
          (delimiter (buffer-substring-no-properties delim-begin delim-end))
          (qtag (regexp-quote delimiter))
          (use-syntax-state (and cperl-syntax-state
@@ -4355,23 +4355,18 @@ recursive calls in starting lines of here-documents."
                    (cdr cperl-syntax-state)))
         ;; (st-l '(nil)) (err-l '(nil)) ; Would overwrite - propagates from a function call to a function call!
         (st-l (list nil)) (err-l (list nil))
-        ;; Somehow font-lock may be not loaded yet...
-        ;; (e.g., when building TAGS via command-line call)
-        (font-lock-string-face (if (boundp 'font-lock-string-face)
-                                   font-lock-string-face
-                                 'font-lock-string-face))
-        (my-cperl-delimiters-face
-         font-lock-constant-face)
+         (my-cperl-delimiters-face
+          'font-lock-constant-face)
         (my-cperl-REx-spec-char-face   ; [] ^.$ and wrapper-of ({})
-          font-lock-function-name-face)
+          'font-lock-function-name-face)
         (my-cperl-REx-0length-face ; 0-length, (?:)etc, non-literal \
-          font-lock-builtin-face)
+          'font-lock-builtin-face)
         (my-cperl-REx-ctl-face         ; (|)
-          font-lock-keyword-face)
+          'font-lock-keyword-face)
         (my-cperl-REx-modifiers-face   ; //gims
          'cperl-nonoverridable-face)
         (my-cperl-REx-length1-face     ; length=1 escaped chars, POSIX classes
-          font-lock-type-face)
+          'font-lock-type-face)
         (stop-point (if ignore-max
                         (point-max)
                       max))
@@ -4636,7 +4631,7 @@ recursive calls in starting lines of here-documents."
                        (end-of-line)
                        ;; Highlight the format line
                        (cperl-postpone-fontification b1 (point)
-                                                     'face font-lock-string-face)
+                                                      'face 'font-lock-string-face)
                        (cperl-commentify b1 (point) nil)
                        (cperl-put-do-not-fontify b1 (point) t))))
                  ;; We do not search to max, since we may be called from
@@ -4647,7 +4642,7 @@ recursive calls in starting lines of here-documents."
                    (progn
                      ;; Highlight the ending delimiter
                      (cperl-postpone-fontification (point) (+ (point) 1)
-                                                   'face font-lock-string-face)
+                                                    'face 'font-lock-string-face)
                      (cperl-commentify (point) (+ (point) 1) nil)
                      (cperl-put-do-not-fontify (point) (+ (point) 1) t))
                  (setq warning-message
@@ -4918,7 +4913,7 @@ recursive calls in starting lines of here-documents."
                                   (not (looking-at "split\\>")))
                               (error t))))
                      (cperl-postpone-fontification
-                      b e 'face font-lock-warning-face)
+                       b e 'face 'font-lock-warning-face)
                    (if (or i2          ; Has 2 args
                            (and cperl-fontify-m-as-s
                                 (or
@@ -5034,8 +5029,8 @@ recursive calls in starting lines of here-documents."
                                                 (eq (char-after (1+ (point))) ?\?))
                                               my-cperl-REx-0length-face
                                             my-cperl-REx-ctl-face)
-                                        font-lock-warning-face))
-                                  (error font-lock-warning-face)))
+                                         'font-lock-warning-face))
+                                   (error 'font-lock-warning-face)))
                                ((eq was-subgr ?\| )
                                 my-cperl-REx-ctl-face)
                                ((eq was-subgr ?\$ )
@@ -5049,7 +5044,7 @@ recursive calls in starting lines of here-documents."
                                                         (1+ b))
                                                     (eq (point)
                                                         (1- e))) 1 t)))
-                                      font-lock-variable-name-face)
+                                       'font-lock-variable-name-face)
                                   my-cperl-REx-spec-char-face))
                                ((memq was-subgr (append "^." nil) )
                                 my-cperl-REx-spec-char-face)
@@ -5077,7 +5072,7 @@ recursive calls in starting lines of here-documents."
                                 (- (point) 2) (- (point) 1) 'face
                                 (if (memq qtag
                                           (append "ghijkmoqvFHIJKMORTVY" nil))
-                                    font-lock-warning-face
+                                     'font-lock-warning-face
                                   my-cperl-REx-0length-face))
                                (if (and (eq (char-after b) qtag)
                                         (memq qtag (append ".])^$|*?+" nil)))
@@ -5218,7 +5213,7 @@ recursive calls in starting lines of here-documents."
                              (while tag
                                (cperl-postpone-fontification
                                 (car (car tag)) (cdr (car tag))
-                                'face font-lock-variable-name-face) ;my-cperl-REx-length1-face
+                                 'face 'font-lock-variable-name-face) ;my-cperl-REx-length1-face
                                (setq tag (cdr tag)))
                              (setq was-subgr nil)) ; did facing already
                             ;; Now rare stuff:
@@ -5236,7 +5231,7 @@ recursive calls in starting lines of here-documents."
                                   'syntax-table cperl-st-punct))
                              (cperl-postpone-fontification
                               (1- (point)) (point)
-                              'face font-lock-warning-face))
+                               'face 'font-lock-warning-face))
                             ((match-beginning 5) ; before (?{}) (??{})
                              (setq tag (match-end 0))
                              (if (or (setq qtag
@@ -5252,7 +5247,7 @@ recursive calls in starting lines of here-documents."
                                           (format "%s" qtag)))
                                (cperl-postpone-fontification
                                 (1- tag) (1- (point))
-                                'face font-lock-variable-name-face)
+                                 'face 'font-lock-variable-name-face)
                                (cperl-postpone-fontification
                                 REx-subgr-start (1- tag)
                                 'face my-cperl-REx-spec-char-face)
@@ -5290,7 +5285,7 @@ recursive calls in starting lines of here-documents."
                               REx-subgr-start REx-subgr-end nil)
                              (cperl-postpone-fontification
                               REx-subgr-start REx-subgr-end
-                              'face font-lock-comment-face))))))
+                               'face 'font-lock-comment-face))))))
                    (if (and is-REx is-x-REx)
                        (put-text-property (1+ b) (1- e)
                                           'syntax-subtype 'x-REx)))
index 6a9735fbc2515e457ee52323fe58d751e23c9cad..6bc720805b76701de7e80f3d93e9fd7dec804d16 100644 (file)
@@ -1102,7 +1102,7 @@ detailed description of this mode.
   (setq gdb-buffer-type 'gdbmi)
   ;;
   (gdb-force-mode-line-update
-   (propertize "initializing..." 'face font-lock-variable-name-face))
+   (propertize "initializing..." 'face 'font-lock-variable-name-face))
 
   ;; This needs to be done before we ask GDB for anything that might
   ;; trigger questions about debuginfod queries.
@@ -2122,7 +2122,7 @@ If `gdb-thread-number' is nil, just wrap NAME in asterisks."
 If NO-PROC is non-nil, do not try to contact the GDB process."
   (when gdb-first-prompt
     (gdb-force-mode-line-update
-     (propertize "initializing..." 'face font-lock-variable-name-face))
+     (propertize "initializing..." 'face 'font-lock-variable-name-face))
     (gdb-init-1)
     (setq gdb-first-prompt nil))
 
@@ -2678,7 +2678,7 @@ Sets `gdb-thread-number' to new id."
       (setq gdb-frame-number nil)))
   (setq gdb-inferior-status "running")
   (gdb-force-mode-line-update
-   (propertize gdb-inferior-status 'face font-lock-type-face))
+   (propertize gdb-inferior-status 'face 'font-lock-type-face))
   (when (not gdb-non-stop)
     (setq gud-running t))
   (setq gdb-active-process t))
@@ -2697,7 +2697,7 @@ Sets `gdb-thread-number' to new id."
     (setq gud-async-running nil))
 
   (gdb-force-mode-line-update
-   (propertize gdb-inferior-status 'face font-lock-type-face))
+   (propertize gdb-inferior-status 'face 'font-lock-type-face))
   (setq gdb-active-process t)
   (setq gud-running t)
   (gud-hide-current-line-indicator nil))
@@ -2734,7 +2734,7 @@ current thread and update GDB buffers."
 
     (setq gdb-inferior-status (or reason "unknown"))
     (gdb-force-mode-line-update
-     (propertize gdb-inferior-status 'face font-lock-warning-face))
+     (propertize gdb-inferior-status 'face 'font-lock-warning-face))
     (if (string-equal reason "exited-normally")
        (setq gdb-active-process nil))
 
@@ -2795,7 +2795,7 @@ current thread and update GDB buffers."
                  (gdb-mi--c-string-from-string output-field)))
             (put-text-property
              0 (length error-message)
-             'face font-lock-warning-face
+              'face 'font-lock-warning-face
              error-message)
             error-message)))))
 
@@ -3205,10 +3205,10 @@ See `def-gdb-auto-update-handler'."
                           (if (string-equal flag "y")
                               (eval-when-compile
                                 (propertize "y" 'font-lock-face
-                                            font-lock-warning-face))
+                                            'font-lock-warning-face))
                             (eval-when-compile
                               (propertize "n" 'font-lock-face
-                                          font-lock-comment-face))))
+                                          'font-lock-comment-face))))
                         addr
                         (or (gdb-mi--field bkpt 'times) "")
                         (if (and type (string-match ".*watchpoint" type))
@@ -3218,7 +3218,7 @@ See `def-gdb-auto-update-handler'."
                               (concat "in "
                                       (propertize (or func "unknown")
                                                   'font-lock-face
-                                                  font-lock-function-name-face)
+                                                  'font-lock-function-name-face)
                                       (gdb-frame-location bkpt)))))
                        ;; Add clickable properties only for
                        ;; breakpoints with file:line information
@@ -4565,8 +4565,8 @@ left-to-right display order of the properties."
                                             local-map ,gdb-edit-locals-map-1)
                                value))
         (setf (gdb-table-right-align table) t)
-        (setq name (propertize name 'font-lock-face font-lock-variable-name-face))
-        (setq type (propertize type 'font-lock-face font-lock-type-face))
+        (setq name (propertize name 'font-lock-face 'font-lock-variable-name-face))
+        (setq type (propertize type 'font-lock-face 'font-lock-type-face))
         (gdb-table-add-row
          table
          (gdb-locals-table-columns-list `((name  . ,name)
@@ -4685,9 +4685,9 @@ executes FUNCTION."
              table
              (list
               (propertize register-name
-                          'font-lock-face font-lock-variable-name-face)
+                          'font-lock-face 'font-lock-variable-name-face)
               (if (member register-number gdb-changed-registers)
-                  (propertize value 'font-lock-face font-lock-warning-face)
+                  (propertize value 'font-lock-face 'font-lock-warning-face)
                 value))
              `(mouse-face highlight
                           help-echo "mouse-2: edit value"
@@ -5320,7 +5320,7 @@ buffers, if required."
         gdb-main-file
         (display-buffer (gud-find-file gdb-main-file))))
   (gdb-force-mode-line-update
-   (propertize "ready" 'face font-lock-variable-name-face)))
+   (propertize "ready" 'face 'font-lock-variable-name-face)))
 
 ;;from put-image
 (defun gdb-put-string (putstring pos &optional dprop &rest sprops)
index afc43fb966a73b053b2ea9ab9fb2f12139f3f4fe..1c5865169d7a2e2352ccf65ee6863f8945f92c7e 100644 (file)
@@ -299,15 +299,15 @@ Match group 1 is the name of the macro.")
 (defconst js--font-lock-keywords-1
   (list
    "\\_<import\\_>"
-   (list js--function-heading-1-re 1 font-lock-function-name-face)
-   (list js--function-heading-2-re 1 font-lock-function-name-face))
+   (list js--function-heading-1-re 1 'font-lock-function-name-face)
+   (list js--function-heading-2-re 1 'font-lock-function-name-face))
   "Level one font lock keywords for `js-mode'.")
 
 (defconst js--font-lock-keywords-2
   (append js--font-lock-keywords-1
-          (list (list js--keyword-re 1 font-lock-keyword-face)
-                (cons js--basic-type-re font-lock-type-face)
-                (cons js--constant-re font-lock-constant-face)))
+          (list (list js--keyword-re 1 'font-lock-keyword-face)
+                (cons js--basic-type-re 'font-lock-type-face)
+                (cons js--constant-re 'font-lock-constant-face)))
   "Level two font lock keywords for `js-mode'.")
 
 ;; js--pitem is the basic building block of the lexical
@@ -1854,12 +1854,12 @@ This performs fontification according to `js--class-styles'."
 (defun js-font-lock-syntactic-face-function (state)
   "Return syntactic face given STATE."
   (if (nth 3 state)
-      font-lock-string-face
+      'font-lock-string-face
     (if (save-excursion
           (goto-char (nth 8 state))
           (looking-at "/\\*\\*"))
-        font-lock-doc-face
-      font-lock-comment-face)))
+        'font-lock-doc-face
+      'font-lock-comment-face)))
 
 (defconst js--syntax-propertize-regexp-regexp
   (rx
index 24be7f1a09cce64aba02e542828fea76253dee7d..9d2969d6ac443e629acdca5467ee0d15c0101774 100644 (file)
@@ -153,11 +153,11 @@ values of OVERRIDE."
                (string-match "\\`--" node-text))
       (treesit-fontify-with-override node-start
                                      delimiter-end
-                                     font-lock-comment-delimiter-face
+                                     'font-lock-comment-delimiter-face
                                      override))
     (treesit-fontify-with-override (max delimiter-end start)
                                    (min node-end end)
-                                   font-lock-comment-face
+                                   'font-lock-comment-face
                                    override)))
 
 (defvar lua-ts--font-lock-settings
index 6b34997799f77fa56c9a7b1adc091e8967eec80c..208068765926f364df779b585ce588440d2a7556 100644 (file)
@@ -535,7 +535,7 @@ If the list was changed, sort the list and remove duplicates first."
 (defun meta-indent-in-string-p ()
   "Tell if the point is in a string."
   (or (nth 3 (syntax-ppss))
-      (eq (get-text-property (point) 'face) font-lock-string-face)))
+      (eq (get-text-property (point) 'face) 'font-lock-string-face)))
 
 (defun meta-indent-looking-at-code (regexp)
   "Same as `looking-at' but checks that the point is not in a string."
index 1371e380e6f56a29d38481e8a1c64f5ffbad9bb3..45b86eb4accf3cb67aa1f628b0e056617db5ccc3 100644 (file)
@@ -1922,12 +1922,12 @@ Argument BOUND is a buffer position limiting searching."
         ;; "Native" Prolog patterns
         (head-predicates
          (list (format "^\\(%s\\)\\((\\|[ \t]*:-\\)" prolog-atom-regexp)
-               1 font-lock-function-name-face))
+               1 'font-lock-function-name-face))
                                        ;(list (format "^%s" prolog-atom-regexp)
                                        ;      0 font-lock-function-name-face))
         (head-predicates-1
          (list (format "\\.[ \t]*\\(%s\\)" prolog-atom-regexp)
-               1 font-lock-function-name-face) )
+               1 'font-lock-function-name-face))
         (variables
          '("\\<\\([_A-Z][a-zA-Z0-9_]*\\)"
            1 font-lock-variable-name-face))
@@ -1941,7 +1941,7 @@ Argument BOUND is a buffer position limiting searching."
         (predspecs                      ; module:predicate/cardinality
          (list (format "\\<\\(%s:\\|\\)%s/[0-9]+"
                        prolog-atom-regexp prolog-atom-regexp)
-               0 font-lock-function-name-face 'prepend))
+               0 'font-lock-function-name-face 'prepend))
         (keywords                       ; directives (queries)
          (list
           (if (eq prolog-system 'mercury)
index 71591af2118cf7637c432136f548b23cb0b7011b..7191e764832f9499f3d17cfbd7790dc2a825c160 100644 (file)
@@ -563,9 +563,9 @@ The type returned can be `comment', `string' or `paren'."
   "Return syntactic face given STATE."
   (if (nth 3 state)
       (if (python-info-docstring-p state)
-          font-lock-doc-face
-        font-lock-string-face)
-    font-lock-comment-face))
+          'font-lock-doc-face
+        'font-lock-string-face)
+    'font-lock-comment-face))
 
 (defconst python--f-string-start-regexp
   (rx bow
index 7d108ed9841c6e44c2992417905a23af56bb8e39..58a7eab0d1a8a35af9d5ff3d7c5d1c7236c02084 100644 (file)
@@ -223,9 +223,9 @@ values of OVERRIDE."
              (<= plus-1 end)
              (string-match-p "\\`#" text))
         (treesit-fontify-with-override node-start plus-1
-                                       font-lock-comment-delimiter-face override))
+                                       'font-lock-comment-delimiter-face override))
     (treesit-fontify-with-override (max plus-1 start) (min node-end end)
-                                   font-lock-comment-face override)))
+                                   'font-lock-comment-face override)))
 
 (defun ruby-ts--font-lock-settings (language)
   "Tree-sitter font-lock settings for Ruby."
index b145525915f9eb053b236f3ccbed5fce37ba8b28..89f3ffea7b7274e5fee13de4d5bcf2a1420ec702 100644 (file)
@@ -1128,9 +1128,9 @@ subshells can nest."
   (let ((q (nth 3 state)))
     (if q
         (if (characterp q)
-            (if (eq q ?\`) 'sh-quoted-exec font-lock-string-face)
+            (if (eq q ?\`) 'sh-quoted-exec 'font-lock-string-face)
           'sh-heredoc)
-      font-lock-comment-face)))
+      'font-lock-comment-face)))
 
 (defgroup sh-indentation nil
   "Variables controlling indentation in shell scripts.
index 21593733e1b8b3e67bb073d9e394c6f75a1592a8..05b2343552cc0f7e2c58a5758dcace9f1f6f88ca 100644 (file)
@@ -3017,7 +3017,7 @@ There might be text before point."
                     '(?\n nil))))
       ;; Anything else is just as for LaTeX.
       (tex-font-lock-syntactic-face-function state)
-    font-lock-doc-face))
+    'font-lock-doc-face))
 
 (eval-when-compile
   (defconst doctex-syntax-propertize-rules
index 529eb846bbd704c374346859f1e2936b532ebbbd..db199bdd5b7d9e1791fed2f1b3319a909b18ec0a 100644 (file)
   ""
   :group 'faces--test)
 
+(defmacro faces---with-tmp-face (face bg fg &rest body)
+  (declare (indent 3))
+  `(let ((old-fg (face-foreground ,face))
+         (old-bg (face-background ,face)))
+     (unwind-protect
+         (progn (set-face-foreground ,face ,fg)
+                (set-face-background ,face ,bg)
+                ,@body)
+       (set-face-foreground ,face old-fg)
+       (set-face-background ,face old-bg))))
+
 (ert-deftest faces--test-color-at-point ()
   (with-temp-buffer
     (insert (propertize "STRING" 'face '(faces--test2 faces--test1)))
     (should (equal (foreground-color-at-point) "black")))
   (with-temp-buffer
     (emacs-lisp-mode)
-    (setq-local font-lock-comment-face 'faces--test1)
-    (setq-local font-lock-constant-face 'faces--test2)
-    (insert ";; `symbol'")
-    (font-lock-fontify-region (point-min) (point-max))
-    (goto-char (point-min))
-    (should (equal (background-color-at-point) "black"))
-    (should (equal (foreground-color-at-point) "black"))
-    (goto-char 6)
-    (should (equal (background-color-at-point) "black"))
-    (should (equal (foreground-color-at-point) "black"))))
+    (faces---with-tmp-face 'font-lock-comment-face "black" "black"
+      (faces---with-tmp-face 'font-lock-constant-face "black" "black"
+        (insert ";; `symbol'")
+        (font-lock-fontify-region (point-min) (point-max))
+        (goto-char (point-min))
+        (should (equal (background-color-at-point) "black"))
+        (should (equal (foreground-color-at-point) "black"))
+        (goto-char 6)
+        (should (equal (background-color-at-point) "black"))
+        (should (equal (foreground-color-at-point) "black"))))))
 
 (ert-deftest faces--test-face-id ()
   ;; Face ID of 0 is the 'default' face; no face should have the same ID.
index 7a6e0b3b64a0faa77b6a852ff515baf1c259ca74..e51ad2ec2d5e1a954ee603a6a405ddb75e012ac1 100644 (file)
@@ -925,26 +925,26 @@ have extra paired delimiters."
     (goto-char (point-min))
     (search-forward-regexp "\\(label:\\)")
     (should (equal (get-text-property (match-beginning 1) 'face)
-                   font-lock-constant-face))
+                   'font-lock-constant-face))
     (search-forward-regexp "\\(comment\\)")
     (should (equal (get-text-property (match-beginning 1) 'face)
-                   font-lock-comment-face))
+                   'font-lock-comment-face))
     (search-forward-regexp "\\(sanity\\)")
     (should (equal (get-text-property (match-beginning 1) 'face)
-                   font-lock-variable-name-face))
+                   'font-lock-variable-name-face))
     ;; Now switch off the minor mode and redo
     (cperl-extra-paired-delimiters-mode -1)
     (font-lock-ensure)
     (goto-char (point-min))
     (search-forward-regexp "\\(label:\\)")
     (should (equal (get-text-property (match-beginning 1) 'face)
-                   font-lock-string-face))
+                   'font-lock-string-face))
     (search-forward-regexp "\\(comment\\)")
     (should (equal (get-text-property (match-beginning 1) 'face)
-                   font-lock-string-face))
+                   'font-lock-string-face))
     (search-forward-regexp "\\(sanity\\)")
     (should (equal (get-text-property (match-beginning 1) 'face)
-                   font-lock-variable-name-face))))
+                   'font-lock-variable-name-face))))
 
 
 ;;; Function test: Building an index for imenu
@@ -1364,13 +1364,13 @@ as that quote like operator."
     (search-forward "bar")
     (should (equal (get-text-property (match-beginning 0) 'face)
                    'font-lock-string-face))
-    ; perl-mode doesn't highlight
+    ;; perl-mode doesn't highlight
     (when (eq cperl-test-mode #'cperl-mode)
       (search-forward "_")
       (should (equal (get-text-property (match-beginning 0) 'face)
                      (if (eq cperl-test-mode #'cperl-mode)
                          'font-lock-constant-face
-                       font-lock-string-face))))))
+                       'font-lock-string-face))))))
 
 (ert-deftest cperl-test-hyperactive-electric-else ()
   "Demonstrate cperl-electric-else behavior.
@@ -1511,10 +1511,10 @@ detected as left-shift operator."
     (font-lock-ensure)
     (search-forward "retur")             ; leaves point before the "n"
     (should (equal (get-text-property (point) 'face)
-                   font-lock-keyword-face))
+                   'font-lock-keyword-face))
     (search-forward "# comm")           ; leaves point before "ent"
     (should (equal (get-text-property (point) 'face)
-                   font-lock-comment-face))))
+                   'font-lock-comment-face))))
 
 (ert-deftest cperl-test-bug-66145 ()
   "Verify that hashes and arrays are only fontified in code.
@@ -1528,7 +1528,7 @@ beginning with `cperl-test-unicode`."
                  ("comment" . font-lock-comment-face)
                  ("here"    . ,(if (equal cperl-test-mode 'perl-mode)
                                    'perl-heredoc
-                                 font-lock-string-face)))))
+                                 'font-lock-string-face)))))
     (with-temp-buffer
       (insert-file-contents (ert-resource-file "cperl-bug-66145.pl"))
       (funcall cperl-test-mode)
@@ -1552,7 +1552,7 @@ cperl-mode fontifies text after the delimiter as Perl code."
     (font-lock-ensure)
     (search-forward "TODO")             ; leaves point before the colon
     (should (equal (get-text-property (point) 'face)
-                   font-lock-comment-face))))
+                   'font-lock-comment-face))))
 
 (ert-deftest cperl-test-bug-69604 ()
   "Verify that $\" in a double-quoted string does not end the string.
@@ -1571,7 +1571,7 @@ not appropriate."
         (goto-char (point-min))
         (search-forward "in string")
         (should (equal (get-text-property (point) 'face)
-                       font-lock-string-face))))))
+                       'font-lock-string-face))))))
 
 (ert-deftest cperl-test-bug-72296 ()
   "Verify that the perl modes correctly handle the flip-flop operator.
index ae37bcfffce44af892fa87ea2ae59c810b64c49f..0cade4b23ab0a8ce1af7a3e8276c2cc52b6d6f47 100644 (file)
@@ -7594,14 +7594,14 @@ always located at the beginning of buffer."
     (python-ts-tests-with-temp-buffer
      (concat "t " test " t")
      (forward-to-word 1)
-     (should (eq (face-at-point) font-lock-keyword-face))
+     (should (eq (face-at-point) 'font-lock-keyword-face))
      (forward-to-word 1)
-     (should (eq (face-at-point) font-lock-keyword-face)))))
+     (should (eq (face-at-point) 'font-lock-keyword-face)))))
 
 (ert-deftest python-ts-mode-named-assignment-face-1 ()
   (python-ts-tests-with-temp-buffer
    "var := 3"
-   (should (eq (face-at-point) font-lock-variable-name-face))))
+   (should (eq (face-at-point) 'font-lock-variable-name-face))))
 
 (ert-deftest python-ts-mode-assignment-face-2 ()
   (python-ts-tests-with-temp-buffer
@@ -7609,14 +7609,14 @@ always located at the beginning of buffer."
    (dolist (test '("var" "rest"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-variable-name-face))))
+     (should (eq (face-at-point) 'font-lock-variable-name-face))))
 
   (python-ts-tests-with-temp-buffer
    "def func(*args):"
    (dolist (test '("args"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (not (eq (face-at-point) font-lock-variable-name-face))))))
+     (should (not (eq (face-at-point) 'font-lock-variable-name-face))))))
 
 (ert-deftest python-ts-mode-nested-types-face-1 ()
   (python-ts-tests-with-temp-buffer
@@ -7624,7 +7624,7 @@ always located at the beginning of buffer."
    (dolist (test '("dict" "list" "tuple" "str" "int" "None" "None"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))))
+     (should (eq (face-at-point) 'font-lock-type-face)))))
 
 (ert-deftest python-ts-mode-union-types-face-1 ()
   (python-ts-tests-with-temp-buffer
@@ -7632,7 +7632,7 @@ always located at the beginning of buffer."
    (dolist (test '("tuple" "tuple" "list" "Lvl1" "Lvl2" "Lvl3" "Lvl4" "Lvl5" "None" "Lvl2"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))))
+     (should (eq (face-at-point) 'font-lock-type-face)))))
 
 (ert-deftest python-ts-mode-union-types-face-2 ()
   (python-ts-tests-with-temp-buffer
@@ -7640,24 +7640,24 @@ always located at the beginning of buffer."
    (dolist (test '("Type0" "Type1" "Type2" "Type3" "Type4" "None"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))
+     (should (eq (face-at-point) 'font-lock-type-face)))
 
    (goto-char (point-min))
    (dolist (test '("pack0" "pack1" "pack2"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (not (eq (face-at-point) font-lock-type-face))))))
+     (should (not (eq (face-at-point) 'font-lock-type-face))))))
 
 (ert-deftest python-ts-mode-types-face-1 ()
   (python-ts-tests-with-temp-buffer
    "def f(val: Callable[[Type0], (Type1, Type2)]):"
    (search-forward "val")
    (goto-char (match-beginning 0))
-   (should (eq (face-at-point) font-lock-variable-name-face))
+   (should (eq (face-at-point) 'font-lock-variable-name-face))
    (dolist (test '("Callable" "Type0" "Type1" "Type2"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))))
+     (should (eq (face-at-point) 'font-lock-type-face)))))
 
 (ert-deftest python-ts-mode-types-face-2 ()
   (python-ts-tests-with-temp-buffer
@@ -7665,12 +7665,12 @@ always located at the beginning of buffer."
    (dolist (test '("Type0" "Type1"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))
+     (should (eq (face-at-point) 'font-lock-type-face)))
    (goto-char (point-min))
    (dolist (test '("pack0" "pack1" "pack2" "pack3"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (not (eq (face-at-point) font-lock-type-face))))))
+     (should (not (eq (face-at-point) 'font-lock-type-face))))))
 
 (ert-deftest python-ts-mode-types-face-3 ()
   (python-ts-tests-with-temp-buffer
@@ -7678,12 +7678,12 @@ always located at the beginning of buffer."
    (dolist (test '("Iterator" "Type0"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))
+     (should (eq (face-at-point) 'font-lock-type-face)))
    (goto-char (point-min))
    (dolist (test '("collections" "abc"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (not (eq (face-at-point) font-lock-type-face))))))
+     (should (not (eq (face-at-point) 'font-lock-type-face))))))
 
 (ert-deftest python-ts-mode-isinstance-type-face-1 ()
   (python-ts-tests-with-temp-buffer
@@ -7695,13 +7695,13 @@ always located at the beginning of buffer."
      (let ((case-fold-search nil))
        (search-forward test))
      (goto-char (match-beginning 0))
-     (should (not (eq (face-at-point) font-lock-type-face))))
+     (should (not (eq (face-at-point) 'font-lock-type-face))))
 
    (goto-char (point-min))
    (dolist (test '("Type0" "str" "dict" "Type1"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))))
+     (should (eq (face-at-point) 'font-lock-type-face)))))
 
 (ert-deftest python-ts-mode-isinstance-type-face-2 ()
   (python-ts-tests-with-temp-buffer
@@ -7709,7 +7709,7 @@ always located at the beginning of buffer."
    (dolist (test '("int" "list" "Iterable"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))))
+     (should (eq (face-at-point) 'font-lock-type-face)))))
 
 (ert-deftest python-ts-mode-isinstance-type-face-3 ()
   (python-ts-tests-with-temp-buffer
@@ -7720,13 +7720,13 @@ always located at the beginning of buffer."
    (dolist (test '("typevar1" "typevar2" "pkg0" "self" "typevar3" "typevar4"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (not (eq (face-at-point) font-lock-type-face))))
+     (should (not (eq (face-at-point) 'font-lock-type-face))))
 
    (goto-char (point-min))
    (dolist (test '("Type1" "tuple" "Coll" "Type2"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))))
+     (should (eq (face-at-point) 'font-lock-type-face)))))
 
 (ert-deftest python-ts-mode-superclass-type-face ()
   (python-ts-tests-with-temp-buffer
@@ -7735,13 +7735,13 @@ always located at the beginning of buffer."
    (dolist (test '("Base1" "Base2" "Sequence" "T1" "T2"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))
+     (should (eq (face-at-point) 'font-lock-type-face)))
 
    (goto-char (point-min))
    (dolist (test '("pack0"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (not (eq (face-at-point) font-lock-type-face))))))
+     (should (not (eq (face-at-point) 'font-lock-type-face))))))
 
 (ert-deftest python-ts-mode-class-patterns-face ()
   (python-ts-tests-with-temp-buffer
@@ -7756,13 +7756,13 @@ always located at the beginning of buffer."
    (dolist (test '("str" "Type0" "bytes" "Type1" "int" "float"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))
+     (should (eq (face-at-point) 'font-lock-type-face)))
 
    (goto-char (point-min))
    (dolist (test '("pack0" "pack1"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (not (eq (face-at-point) font-lock-type-face))))))
+     (should (not (eq (face-at-point) 'font-lock-type-face))))))
 
 (ert-deftest python-ts-mode-dotted-decorator-face-1 ()
   (python-ts-tests-with-temp-buffer
@@ -7773,7 +7773,7 @@ always located at the beginning of buffer."
    (dolist (test '("pytest" "mark" "skip" "pytest" "mark" "skip"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))))
+     (should (eq (face-at-point) 'font-lock-type-face)))))
 
 (ert-deftest python-ts-mode-dotted-decorator-face-2 ()
   (python-ts-tests-with-temp-buffer
@@ -7784,14 +7784,14 @@ always located at the beginning of buffer."
    (dolist (test '("pytest" "mark" "skip"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-type-face)))))
+     (should (eq (face-at-point) 'font-lock-type-face)))))
 
 (ert-deftest python-ts-mode-builtin-call-face ()
   (python-ts-tests-with-temp-buffer
    "all()"
    ;; enable 'function' feature from 4th level
    (setopt treesit-font-lock-level 4)
-   (should (eq (face-at-point) font-lock-builtin-face))))
+   (should (eq (face-at-point) 'font-lock-builtin-face))))
 
 (ert-deftest python-ts-mode-interpolation-nested-string ()
   (python-ts-tests-with-temp-buffer
@@ -7799,20 +7799,20 @@ always located at the beginning of buffer."
 
    (search-forward "True")
    (goto-char (match-beginning 0))
-   (should (eq (face-at-point) font-lock-constant-face))
+   (should (eq (face-at-point) 'font-lock-constant-face))
 
    (goto-char (point-min))
    (dolist (test '("f" "{" "+" "}"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (not (eq (face-at-point) font-lock-string-face))))
+     (should (not (eq (face-at-point) 'font-lock-string-face))))
 
 
    (goto-char (point-min))
    (dolist (test '("beg" "'string'" "\""))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-string-face)))))
+     (should (eq (face-at-point) 'font-lock-string-face)))))
 
 (ert-deftest python-ts-mode-level-fontification-wo-interpolation ()
   (python-ts-tests-with-temp-buffer
@@ -7821,12 +7821,12 @@ always located at the beginning of buffer."
    (setopt treesit-font-lock-level 2)
    (search-forward "f")
    (goto-char (match-beginning 0))
-   (should (not (eq (face-at-point) font-lock-string-face)))
+   (should (not (eq (face-at-point) 'font-lock-string-face)))
 
    (dolist (test '("\"" "beg" "{" "True" "var" "}" "\""))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-string-face)))))
+     (should (eq (face-at-point) 'font-lock-string-face)))))
 
 (ert-deftest python-ts-mode-disabled-string-interpolation ()
   (python-ts-tests-with-temp-buffer
@@ -7840,12 +7840,12 @@ always located at the beginning of buffer."
 
          (search-forward "f")
          (goto-char (match-beginning 0))
-         (should (not (eq (face-at-point) font-lock-string-face)))
+         (should (not (eq (face-at-point) 'font-lock-string-face)))
 
          (dolist (test '("\"" "beg" "{" "True" "var" "}" "\""))
            (search-forward test)
            (goto-char (match-beginning 0))
-           (should (eq (face-at-point) font-lock-string-face))))
+           (should (eq (face-at-point) 'font-lock-string-face))))
 
     (setf (nth 2 treesit-font-lock-feature-list)
           (append (nth 2 treesit-font-lock-feature-list) '(string-interpolation))))))
@@ -7856,25 +7856,25 @@ always located at the beginning of buffer."
 
    (search-forward "True")
    (goto-char (match-beginning 0))
-   (should (eq (face-at-point) font-lock-constant-face))
+   (should (eq (face-at-point) 'font-lock-constant-face))
 
    (goto-char (point-min))
    (dolist (test '("f" "{" "+" "}"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (not (eq (face-at-point) font-lock-string-face))))
+     (should (not (eq (face-at-point) 'font-lock-string-face))))
 
    (goto-char (point-min))
    (dolist (test '("\"\"\"" "beg" "end" "\"\"\""))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-doc-face)))
+     (should (eq (face-at-point) 'font-lock-doc-face)))
 
    (goto-char (point-min))
    (dolist (test '("'s1'" "'s2'"))
      (search-forward test)
      (goto-char (match-beginning 0))
-     (should (eq (face-at-point) font-lock-string-face)))))
+     (should (eq (face-at-point) 'font-lock-string-face)))))
 
 (provide 'python-tests)
 
index c9cde791baae1c3556bbea9e1fdfb99ea6a2b85f..737b4e7d9c60117eac4b05cbe3457751b2fe6ec6 100644 (file)
@@ -87,14 +87,14 @@ VALUES-PLIST is a list with alternating index and value elements."
 
 (ert-deftest ruby-heredoc-font-lock ()
   (let ((s "foo <<eos.gsub('^ *', '')"))
-    (ruby-assert-face s 9 font-lock-string-face)
+    (ruby-assert-face s 9 'font-lock-string-face)
     (ruby-assert-face s 10 nil)))
 
 (ert-deftest ruby-singleton-class-no-heredoc-font-lock ()
   (ruby-assert-face "class<<a" 8 nil))
 
 (ert-deftest ruby-heredoc-highlights-interpolations ()
-  (ruby-assert-face "s = <<EOS\n  #{foo}\nEOS" 15 font-lock-variable-name-face))
+  (ruby-assert-face "s = <<EOS\n  #{foo}\nEOS" 15 'font-lock-variable-name-face))
 
 (ert-deftest ruby-no-heredoc-inside-quotes ()
   (ruby-assert-state "\"<<\", \"\",\nfoo" 3 nil))
@@ -109,7 +109,7 @@ VALUES-PLIST is a list with alternating index and value elements."
   (ruby-assert-state "class <<self\nend" 3 nil))
 
 (ert-deftest ruby-exit!-font-lock ()
-  (ruby-assert-face "exit!" 5 font-lock-builtin-face))
+  (ruby-assert-face "exit!" 5 'font-lock-builtin-face))
 
 (ert-deftest ruby-deep-indent ()
   (let ((ruby-deep-arglist nil)
@@ -137,7 +137,7 @@ VALUES-PLIST is a list with alternating index and value elements."
   (ruby-assert-state "'(/', /\d+/" 3 ?/ 8))
 
 (ert-deftest ruby-regexp-interpolation-is-highlighted ()
-  (ruby-assert-face "/#{foobs}/" 4 font-lock-variable-name-face))
+  (ruby-assert-face "/#{foobs}/" 4 'font-lock-variable-name-face))
 
 (ert-deftest ruby-regexp-skips-over-interpolation ()
   (ruby-assert-state "/#{foobs.join('/')}/" 3 nil))
@@ -427,32 +427,32 @@ VALUES-PLIST is a list with alternating index and value elements."
     (should (string= "foo {|b| b + 2 }" (buffer-string)))))
 
 (ert-deftest ruby-recognize-symbols-starting-with-at-character ()
-  (ruby-assert-face ":@abc" 3 font-lock-constant-face))
+  (ruby-assert-face ":@abc" 3 'font-lock-constant-face))
 
 (ert-deftest ruby-hash-character-not-interpolation ()
   (ruby-assert-face "\"This is #{interpolation}\"" 15
-                    font-lock-variable-name-face)
+                    'font-lock-variable-name-face)
   (ruby-assert-face "\"This is \\#{no interpolation} despite the #\""
-                    15 font-lock-string-face)
-  (ruby-assert-face "\n#@comment, not ruby code" 5 font-lock-comment-face)
+                    15 'font-lock-string-face)
+  (ruby-assert-face "\n#@comment, not ruby code" 5 'font-lock-comment-face)
   (ruby-assert-state "\n#@comment, not ruby code" 4 t)
   (ruby-assert-face "# A comment cannot have #{an interpolation} in it"
-                    30 font-lock-comment-face)
+                    30 'font-lock-comment-face)
   (ruby-assert-face "# #{comment}\n \"#{interpolation}\"" 16
-                    font-lock-variable-name-face))
+                    'font-lock-variable-name-face))
 
 (ert-deftest ruby-interpolation-suppresses-quotes-inside ()
   (let ((s "\"<ul><li>#{@files.join(\"</li><li>\")}</li></ul>\""))
     (ruby-assert-state s 8 nil)
-    (ruby-assert-face s 9 font-lock-string-face)
-    (ruby-assert-face s 10 font-lock-variable-name-face)
-    (ruby-assert-face s 41 font-lock-string-face)))
+    (ruby-assert-face s 9 'font-lock-string-face)
+    (ruby-assert-face s 10 'font-lock-variable-name-face)
+    (ruby-assert-face s 41 'font-lock-string-face)))
 
 (ert-deftest ruby-interpolation-suppresses-one-double-quote ()
   (let ((s "\"foo#{'\"'}\""))
     (ruby-assert-state s 8 nil)
-    (ruby-assert-face s 8 font-lock-variable-name-face)
-    (ruby-assert-face s 11 font-lock-string-face)))
+    (ruby-assert-face s 8 'font-lock-variable-name-face)
+    (ruby-assert-face s 11 'font-lock-string-face)))
 
 (ert-deftest ruby-interpolation-suppresses-one-backtick ()
   (let ((s "`as#{'`'}das`"))
@@ -469,39 +469,39 @@ VALUES-PLIST is a list with alternating index and value elements."
 
 (ert-deftest ruby-interpolation-inside-percent-literal ()
   (let ((s "%( #{boo} )"))
-    (ruby-assert-face s 1 font-lock-string-face)
-    (ruby-assert-face s 4 font-lock-variable-name-face)
-    (ruby-assert-face s 10 font-lock-string-face)
+    (ruby-assert-face s 1 'font-lock-string-face)
+    (ruby-assert-face s 4 'font-lock-variable-name-face)
+    (ruby-assert-face s 10 'font-lock-string-face)
     (ruby-assert-state s 8 nil)))
 
 (ert-deftest ruby-interpolation-inside-percent-literal-with-paren ()
   :expected-result :failed
   (let ((s "%(^#{\")\"}^)"))
-    (ruby-assert-face s 3 font-lock-string-face)
-    (ruby-assert-face s 4 font-lock-variable-name-face)
-    (ruby-assert-face s 10 font-lock-string-face)
+    (ruby-assert-face s 3 'font-lock-string-face)
+    (ruby-assert-face s 4 'font-lock-variable-name-face)
+    (ruby-assert-face s 10 'font-lock-string-face)
     ;; It's confused by the closing paren in the middle.
     (ruby-assert-state s 8 nil)))
 
 (ert-deftest ruby-interpolation-inside-another-interpolation ()
   :expected-result :failed
   (let ((s "\"#{[a, b, c].map { |v| \"#{v}\" }.join}\""))
-    (ruby-assert-face s 1 font-lock-string-face)
-    (ruby-assert-face s 2 font-lock-variable-name-face)
-    (ruby-assert-face s 38 font-lock-string-face)
+    (ruby-assert-face s 1 'font-lock-string-face)
+    (ruby-assert-face s 2 'font-lock-variable-name-face)
+    (ruby-assert-face s 38 'font-lock-string-face)
     (ruby-assert-state s 8 nil)))
 
 (ert-deftest ruby-interpolation-inside-double-quoted-percent-literals ()
-  (ruby-assert-face "%Q{foo #@bar}" 8 font-lock-variable-name-face)
-  (ruby-assert-face "%W{foo #@bar}" 8 font-lock-variable-name-face)
-  (ruby-assert-face "%r{foo #@bar}" 8 font-lock-variable-name-face)
-  (ruby-assert-face "%x{foo #@bar}" 8 font-lock-variable-name-face))
+  (ruby-assert-face "%Q{foo #@bar}" 8 'font-lock-variable-name-face)
+  (ruby-assert-face "%W{foo #@bar}" 8 'font-lock-variable-name-face)
+  (ruby-assert-face "%r{foo #@bar}" 8 'font-lock-variable-name-face)
+  (ruby-assert-face "%x{foo #@bar}" 8 'font-lock-variable-name-face))
 
 (ert-deftest ruby-no-interpolation-in-single-quoted-literals ()
-  (ruby-assert-face "'foo #@bar'" 7 font-lock-string-face)
-  (ruby-assert-face "%q{foo #@bar}" 8 font-lock-string-face)
-  (ruby-assert-face "%w{foo #@bar}" 8 font-lock-string-face)
-  (ruby-assert-face "%s{foo #@bar}" 8 font-lock-string-face))
+  (ruby-assert-face "'foo #@bar'" 7 'font-lock-string-face)
+  (ruby-assert-face "%q{foo #@bar}" 8 'font-lock-string-face)
+  (ruby-assert-face "%w{foo #@bar}" 8 'font-lock-string-face)
+  (ruby-assert-face "%s{foo #@bar}" 8 'font-lock-string-face))
 
 (ert-deftest ruby-interpolation-after-dollar-sign ()
   (ruby-assert-face "\"$#{balance}\"" 2 'font-lock-string-face)