1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

perl-mode.el: Avoid obsolete font-lock face vars

* lisp/progmodes/perl-mode.el (perl-mode-abbrev-table): Merge defvar
into the definition.
(perl-font-lock-keywords-1, perl-font-lock-keywords-2): Avoid obsolete
font-lock face vars.
This commit is contained in:
Stefan Monnier 2025-04-04 23:53:10 -04:00
parent d582ed9dc9
commit cd41247dc1

View file

@ -96,9 +96,8 @@
"Face used for non-scalar variables."
:version "28.1")
(defvar perl-mode-abbrev-table nil
"Abbrev table in use in `perl-mode' buffers.")
(define-abbrev-table 'perl-mode-abbrev-table ())
(define-abbrev-table 'perl-mode-abbrev-table ()
"Abbrev table in use in perl-mode buffers.")
(defvar-keymap perl-mode-map
:doc "Keymap used in Perl mode."
@ -165,19 +164,19 @@
;;
;; Fontify function and package names in declarations.
("\\<\\(package\\|sub\\)\\>[ \t]*\\(\\(?:\\sw\\|::\\)+\\)?"
(1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))
(1 'font-lock-keyword-face) (2 'font-lock-function-name-face nil t))
("\\(?:^\\|[^$@%&\\]\\)\\<\\(import\\|no\\|require\\|use\\)\\>[ \t]*\\(\\(?:\\sw\\|::\\)+\\)?"
(1 font-lock-keyword-face) (2 font-lock-constant-face nil t)))
(1 'font-lock-keyword-face) (2 'font-lock-constant-face nil t)))
"Subdued level highlighting for Perl mode.")
(defconst perl-font-lock-keywords-2
(append
'(;; Fontify function, variable and file name references. They have to be
;; handled first because they might conflict with keywords.
("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face)
("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 'font-lock-function-name-face)
;; Additionally fontify non-scalar variables. `perl-non-scalar-variable'
;; will underline them by default.
("[$*]{?\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-variable-name-face)
("[$*]{?\\(\\sw+\\(::\\sw+\\)*\\)" 1 'font-lock-variable-name-face)
("\\([@%]\\|\\$#\\)\\(\\sw+\\(::\\sw+\\)*\\)"
(2 'perl-non-scalar-variable)))
perl-font-lock-keywords-1
@ -191,13 +190,13 @@
"\\>")
;;
;; Fontify declarators and prefixes as types.
("\\<\\(has\\|local\\|my\\|our\\|state\\)\\>" . font-lock-keyword-face) ; declarators
("<\\(\\sw+\\)>" 1 font-lock-constant-face)
("\\<\\(has\\|local\\|my\\|our\\|state\\)\\>" . 'font-lock-keyword-face) ; declarators
("<\\(\\sw+\\)>" 1 'font-lock-constant-face)
;;
;; Fontify keywords with/and labels as we do in `c++-font-lock-keywords'.
("\\<\\(continue\\|goto\\|last\\|next\\|redo\\)\\>[ \t]*\\(\\sw+\\)?"
(1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
("^[ \t]*\\(\\sw+\\)[ \t]*:[^:]" 1 font-lock-constant-face)))
(1 'font-lock-keyword-face) (2 'font-lock-constant-face nil t))
("^[ \t]*\\(\\sw+\\)[ \t]*:[^:]" 1 'font-lock-constant-face)))
"Gaudy level highlighting for Perl mode.")
(defvar perl-font-lock-keywords perl-font-lock-keywords-1
@ -631,7 +630,7 @@ create a new comment."
;; Outline support
(defvar perl-outline-regexp
(concat (mapconcat 'cadr perl-imenu-generic-expression "\\|")
(concat (mapconcat #'cadr perl-imenu-generic-expression "\\|")
"\\|^=cut\\>"))
(defun perl-outline-level ()