aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorProtesilaos Stavrou2021-01-19 08:11:39 +0100
committerLars Ingebrigtsen2021-01-19 08:11:39 +0100
commitb62a1e358befe996a4e2f4038ef48a9dd44901f8 (patch)
tree0210699be4fb6c61daf719b475aa73e213112e9b
parent4e64d023563988a570b6c2ac60d48af7f2d64a68 (diff)
downloademacs-b62a1e358befe996a4e2f4038ef48a9dd44901f8.tar.gz
emacs-b62a1e358befe996a4e2f4038ef48a9dd44901f8.zip
Add 'perl-non-scalar-variable' face to perl-mode
* etc/NEWS: Document the new face (bug#45840). * lisp/progmodes/perl-mode.el (perl-non-scalar-variable): Define new face. (perl-font-lock-keywords-2): Apply 'perl-non-scalar-variable' face.
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/progmodes/perl-mode.el11
2 files changed, 15 insertions, 2 deletions
diff --git a/etc/NEWS b/etc/NEWS
index d632283e7f3..8fc5f3e046c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -352,6 +352,12 @@ When emacsclient connects, Emacs will (by default) output a message
352about how to exit the client frame. If 'server-client-instructions' 352about how to exit the client frame. If 'server-client-instructions'
353is set to nil, this message is inhibited. 353is set to nil, this message is inhibited.
354 354
355** Perl mode
356
357---
358*** New face 'perl-non-scalar-variable'.
359This is used to fontify non-scalar variables.
360
355** Python mode 361** Python mode
356 362
357*** 'python-shell-interpreter' now defaults to python3 on systems with python3. 363*** 'python-shell-interpreter' now defaults to python3 on systems with python3.
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index 2a2a4978c62..d047dd543c2 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -95,6 +95,12 @@
95 :prefix "perl-" 95 :prefix "perl-"
96 :group 'languages) 96 :group 'languages)
97 97
98(defface perl-non-scalar-variable
99 '((t :inherit font-lock-variable-name-face :underline t))
100 "Face used for non-scalar variables."
101 :version "28.1"
102 :group 'perl)
103
98(defvar perl-mode-abbrev-table nil 104(defvar perl-mode-abbrev-table nil
99 "Abbrev table in use in perl-mode buffers.") 105 "Abbrev table in use in perl-mode buffers.")
100(define-abbrev-table 'perl-mode-abbrev-table ()) 106(define-abbrev-table 'perl-mode-abbrev-table ())
@@ -187,11 +193,12 @@
187 ;; 193 ;;
188 ;; Fontify function, variable and file name references. 194 ;; Fontify function, variable and file name references.
189 ("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face) 195 ("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face)
190 ;; Additionally underline non-scalar variables. Maybe this is a bad idea. 196 ;; Additionally fontify non-scalar variables. `perl-non-scalar-variable'
197 ;; will underline them by default.
191 ;;'("[$@%*][#{]?\\(\\sw+\\)" 1 font-lock-variable-name-face) 198 ;;'("[$@%*][#{]?\\(\\sw+\\)" 1 font-lock-variable-name-face)
192 ("[$*]{?\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-variable-name-face) 199 ("[$*]{?\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-variable-name-face)
193 ("\\([@%]\\|\\$#\\)\\(\\sw+\\(::\\sw+\\)*\\)" 200 ("\\([@%]\\|\\$#\\)\\(\\sw+\\(::\\sw+\\)*\\)"
194 (2 (cons font-lock-variable-name-face '(underline)))) 201 (2 'perl-non-scalar-variable))
195 ("<\\(\\sw+\\)>" 1 font-lock-constant-face) 202 ("<\\(\\sw+\\)>" 1 font-lock-constant-face)
196 ;; 203 ;;
197 ;; Fontify keywords with/and labels as we do in `c++-font-lock-keywords'. 204 ;; Fontify keywords with/and labels as we do in `c++-font-lock-keywords'.