From: Harald Jörg Date: Sat, 1 Jul 2023 13:25:33 +0000 (+0200) Subject: cperl-mode: Fix byte-compilation warnings X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d42b45dcc7504deb9d1e7b730fed69e18f958533;p=emacs.git cperl-mode: Fix byte-compilation warnings * lisp/progmodes/cperl-mode.el (defconst): Reformat docstring to fit into 80 columns. (cperl-find-sub-attrs): Mark lexical parameters as unused. * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-fontify-attrs-and-signatures): Fix use of `match-beginning' (perl-indent-parens-as-block): Define as a variable. --- diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index fb636d0fb78..adfaeee8c97 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -1330,7 +1330,9 @@ subsequent attributes. This regexp does not have capture groups.") `(sequence "(" (0+ (any "$@%&*;\\[]")) ")") - "A regular expression for a subroutine prototype. Not as strict as the actual prototype syntax, but good enough to distinguish prototypes from signatures.") + "A regular expression for a subroutine prototype. Not as strict +as the actual prototype syntax, but good enough to distinguish +prototypes from signatures.") (defconst cperl--signature-rx `(sequence "(" @@ -3539,7 +3541,7 @@ position of the end of the unsafe construct." (setq end (point))))) (or end pos))))) -(defun cperl-find-sub-attrs (&optional st-l b-fname e-fname pos) +(defun cperl-find-sub-attrs (&optional st-l _b-fname _e-fname pos) "Syntactically mark (and fontify) attributes of a subroutine. Should be called with the point before leading colon of an attribute." ;; Works *before* syntax recognition is done @@ -3608,7 +3610,6 @@ Should be called with the point before leading colon of an attribute." 'attrib-group (if (looking-at "{") t 0)) (and pos (progn - (< 1 (count-lines (+ 3 pos) (point))) ; end of `sub' ;; Apparently, we do not need `multiline': faces added now (put-text-property (+ 3 pos) (cperl-1+ (point)) 'syntax-type 'sub-decl)))) diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 99d5a51b3ea..fced2171767 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -184,11 +184,12 @@ attributes, prototypes and signatures." (when (match-beginning 2) (should (equal (get-text-property (match-beginning 2) 'face) 'font-lock-string-face)))) - (goto-char end-of-sub) ;; Subroutine signatures + (goto-char start-of-sub) (when (search-forward "$bar" end-of-sub t) - (should (equal (get-text-property (match-beginning) 'face) - 'font-lock-variable-name-face))))) + (should (equal (get-text-property (match-beginning 0) 'face) + 'font-lock-variable-name-face))) + (goto-char end-of-sub))) ;; Anonymous subroutines (while (search-forward-regexp "= sub" nil t) (let ((start-of-sub (match-beginning 0)) @@ -205,11 +206,12 @@ attributes, prototypes and signatures." (when (match-beginning 2) (should (equal (get-text-property (match-beginning 2) 'face) 'font-lock-string-face)))) - (goto-char end-of-sub) ;; Subroutine signatures + (goto-char start-of-sub) (when (search-forward "$bar" end-of-sub t) - (should (equal (get-text-property (match-beginning) 'face) - 'font-lock-variable-name-face)))))))) + (should (equal (get-text-property (match-beginning 0) 'face) + 'font-lock-variable-name-face))) + (goto-char end-of-sub)))))) (ert-deftest cperl-test-fontify-special-variables () "Test fontification of variables like $^T or ${^ENCODING}. @@ -314,6 +316,7 @@ issued by CPerl mode." (defvar perl-continued-statement-offset) (defvar perl-indent-level) +(defvar perl-indent-parens-as-block) (defconst cperl--tests-heredoc-face (if (equal cperl-test-mode 'perl-mode) 'perl-heredoc