From: Harald Jörg Date: Tue, 20 Jun 2023 20:51:29 +0000 (+0200) Subject: ; cperl-mode.el: Eliminate cperl-font-lock-multiline X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bc6068fe9451f62157c25c9568923ef6c49ed967;p=emacs.git ; cperl-mode.el: Eliminate cperl-font-lock-multiline This undocumented variable was always set to t. There was no function to change the variable. * lisp/progmodes/cperl-mode.el: Eliminate top-level variables cperl-font-lock-multiline and cperl-font-lock-multiline-start. (cperl-mode): Don't set cperl-font-lock-multiline. (cperl-windowed-init): Don't set cperl-font-lock-multiline. (cperl-init-faces): Eliminate (if cperl-font-lock-multiline) conditionals. --- diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 6548ba3bd36..66f01109e3f 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -1476,8 +1476,6 @@ the last)." ;; Fix for msb.el (defvar cperl-msb-fixed nil) (defvar cperl-use-major-mode 'cperl-mode) -(defvar cperl-font-lock-multiline-start nil) -(defvar cperl-font-lock-multiline nil) (defvar cperl-font-locking nil) (defvar cperl-compilation-error-regexp-list @@ -1686,7 +1684,6 @@ or as help on variables `cperl-tips', `cperl-problems', (when (< emacs-major-version 27) (setq-local open-paren-in-column-0-is-defun-start nil)) ;; Until Emacs is multi-threaded, we do not actually need it local: - (make-local-variable 'cperl-font-lock-multiline-start) (make-local-variable 'cperl-font-locking) (setq-local outline-regexp cperl-outline-regexp) (setq-local outline-level 'cperl-outline-level) @@ -1759,7 +1756,6 @@ or as help on variables `cperl-tips', `cperl-problems', ;; to re-apply them. (setq cperl-syntax-done-to start) (cperl-fontify-syntactically end)))) - (setq cperl-font-lock-multiline t) ; Not localized... (setq-local font-lock-multiline t) (setq-local font-lock-fontify-region-function #'cperl-font-lock-fontify-region-function) @@ -3609,7 +3605,7 @@ move point but does change match data." delim-begin delim-end) "Process a here-document's delimiters and body. The parameters MIN, MAX, END, OVERSHOOT, STOP-POINT, ERR-L are -used for recursive calls to `cperl-find-pods-here' to handle the +used for recursive calls to `cperl-find-pods-heres' to handle the rest of the line which contains the delimiter. MATCHED-POS and TODO-POS are initial values for this function's result. END-OF-HERE-DOC is the end of a previous here-doc in the same @@ -5623,7 +5619,6 @@ comment, or POD." (cond ((featurep 'ps-print) (or cperl-faces-init (progn - (setq cperl-font-lock-multiline t) (cperl-init-faces)))) ((not cperl-faces-init) (add-hook 'font-lock-mode-hook @@ -5768,20 +5763,9 @@ default function." "([^()]*)\\)?" ; prototype cperl-maybe-white-and-comment-rex ; whitespace/comments? "[{;]") - 2 (if cperl-font-lock-multiline - '(if (eq (char-after (cperl-1- (match-end 0))) ?\{ ) + 2 '(if (eq (char-after (cperl-1- (match-end 0))) ?\{ ) 'font-lock-function-name-face - 'font-lock-variable-name-face) - ;; need to manually set 'multiline' for older font-locks - '(progn - (if (< 1 (count-lines (match-beginning 0) - (match-end 0))) - (put-text-property - (+ 3 (match-beginning 0)) (match-end 0) - 'syntax-type 'multiline)) - (if (eq (char-after (cperl-1- (match-end 0))) ?\{ ) - 'font-lock-function-name-face - 'font-lock-variable-name-face)))) + 'font-lock-variable-name-face)) `(,(rx (sequence symbol-start (or "package" "require" "use" "import" "no" "bootstrap") @@ -5856,12 +5840,7 @@ default function." ;; "\\((" ;; cperl-maybe-white-and-comment-rex ;; "\\)?\\([$@%*]\\([a-zA-Z0-9_:]+\\|[^a-zA-Z0-9_]\\)\\)") - ;; (5 ,(if cperl-font-lock-multiline - (1 ,(if cperl-font-lock-multiline - 'font-lock-variable-name-face - '(progn (setq cperl-font-lock-multiline-start - (match-beginning 0)) - 'font-lock-variable-name-face))) + (1 font-lock-variable-name-face) (,(rx (sequence point (eval cperl--ws*-rx) "," @@ -5882,35 +5861,18 @@ default function." ;; Bug in font-lock: limit is used not only to limit ;; searches, but to set the "extend window for ;; facification" property. Thus we need to minimize. - ,(if cperl-font-lock-multiline - '(if (match-beginning 1) - (save-excursion - (goto-char (match-beginning 1)) - (condition-case nil - (forward-sexp 1) - (error - (condition-case nil - (forward-char 200) - (error nil)))) ; typeahead - (1- (point))) ; report limit - (forward-char -2)) ; disable continued expr - '(if (match-beginning 1) - (point-max) ; No limit for continuation - (forward-char -2))) ; disable continued expr - ,(if cperl-font-lock-multiline - nil - '(progn ; Do at end - ;; "my" may be already fontified (POD), - ;; so cperl-font-lock-multiline-start is nil - (if (or (not cperl-font-lock-multiline-start) - (> 2 (count-lines - cperl-font-lock-multiline-start - (point)))) - nil - (put-text-property - (1+ cperl-font-lock-multiline-start) (point) - 'syntax-type 'multiline)) - (setq cperl-font-lock-multiline-start nil))) + '(if (match-beginning 1) + (save-excursion + (goto-char (match-beginning 1)) + (condition-case nil + (forward-sexp 1) + (error + (condition-case nil + (forward-char 200) + (error nil)))) ; typeahead + (1- (point))) ; report limit + (forward-char -2)) ; disable continued expr + nil (1 font-lock-variable-name-face))) ;; foreach my $foo ( `(,(rx symbol-start "for" (opt "each")