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)
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
(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)
(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.
'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 ".")
(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
"FILETYPE"
"FILEVERSION"
"PRODUCTVERSION") 'symbols)
- 1 font-lock-type-face)
+ 1 'font-lock-type-face)
(list (regexp-opt '("BEGIN" "BLOCK" "END" "VALUE") 'symbols)
- 1 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\\)\\>"
(list (concat "[^_]"
(regexp-opt installshield-system-variables-list 'symbols)
"[^_]")
- 1 font-lock-variable-name-face)
+ 1 'font-lock-variable-name-face)
;; system functions
(list (concat "[^_]"
(regexp-opt installshield-system-functions-list 'symbols)
"[^_]")
- 1 font-lock-function-name-face)
+ 1 'font-lock-function-name-face)
;; type keywords
(list (concat "[^_]"
(regexp-opt installshield-types-list 'symbols)
"[^_]")
- 1 font-lock-type-face)
+ 1 'font-lock-type-face)
;; function argument constants
(list (concat "[^_]"
(regexp-opt installshield-funarg-constants-list 'symbols)
"[^_]")
- 1 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.")
(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
'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
(< (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)
;; 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))))
(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
(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
((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))
(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)))
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
(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
(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,
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
(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))
(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
(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
(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
(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 ?\$ )
(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)
(- (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)))
(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:
'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
(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)
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)))
(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.
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))
(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))
(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))
(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))
(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)))))
(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))
(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
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)
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"
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)
(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
(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
(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
(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."
;; "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))
(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)
"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
(<= 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."
(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.
'(?\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
""
: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.
(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
(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.
(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.
("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)
(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.
(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.
(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
(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
(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
(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
(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
(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
(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
(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
(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
(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
(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
(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
(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
(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
(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
(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
(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))))))
(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)
(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))
(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)
(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))
(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`"))
(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)