1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-23 22:20:24 -08:00

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.
This commit is contained in:
Harald Jörg 2023-07-01 15:25:33 +02:00
parent 2195935870
commit d42b45dcc7
2 changed files with 13 additions and 9 deletions

View file

@ -1330,7 +1330,9 @@ subsequent attributes. This regexp does not have capture groups.")
`(sequence "(" `(sequence "("
(0+ (any "$@%&*;\\[]")) (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 (defconst cperl--signature-rx
`(sequence "(" `(sequence "("
@ -3539,7 +3541,7 @@ position of the end of the unsafe construct."
(setq end (point))))) (setq end (point)))))
(or end pos))))) (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. "Syntactically mark (and fontify) attributes of a subroutine.
Should be called with the point before leading colon of an attribute." Should be called with the point before leading colon of an attribute."
;; Works *before* syntax recognition is done ;; 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)) 'attrib-group (if (looking-at "{") t 0))
(and pos (and pos
(progn (progn
(< 1 (count-lines (+ 3 pos) (point))) ; end of `sub'
;; Apparently, we do not need `multiline': faces added now ;; Apparently, we do not need `multiline': faces added now
(put-text-property (+ 3 pos) (cperl-1+ (point)) (put-text-property (+ 3 pos) (cperl-1+ (point))
'syntax-type 'sub-decl)))) 'syntax-type 'sub-decl))))

View file

@ -184,11 +184,12 @@ attributes, prototypes and signatures."
(when (match-beginning 2) (when (match-beginning 2)
(should (equal (get-text-property (match-beginning 2) 'face) (should (equal (get-text-property (match-beginning 2) 'face)
'font-lock-string-face)))) 'font-lock-string-face))))
(goto-char end-of-sub)
;; Subroutine signatures ;; Subroutine signatures
(goto-char start-of-sub)
(when (search-forward "$bar" end-of-sub t) (when (search-forward "$bar" end-of-sub t)
(should (equal (get-text-property (match-beginning) 'face) (should (equal (get-text-property (match-beginning 0) 'face)
'font-lock-variable-name-face))))) 'font-lock-variable-name-face)))
(goto-char end-of-sub)))
;; Anonymous subroutines ;; Anonymous subroutines
(while (search-forward-regexp "= sub" nil t) (while (search-forward-regexp "= sub" nil t)
(let ((start-of-sub (match-beginning 0)) (let ((start-of-sub (match-beginning 0))
@ -205,11 +206,12 @@ attributes, prototypes and signatures."
(when (match-beginning 2) (when (match-beginning 2)
(should (equal (get-text-property (match-beginning 2) 'face) (should (equal (get-text-property (match-beginning 2) 'face)
'font-lock-string-face)))) 'font-lock-string-face))))
(goto-char end-of-sub)
;; Subroutine signatures ;; Subroutine signatures
(goto-char start-of-sub)
(when (search-forward "$bar" end-of-sub t) (when (search-forward "$bar" end-of-sub t)
(should (equal (get-text-property (match-beginning) 'face) (should (equal (get-text-property (match-beginning 0) 'face)
'font-lock-variable-name-face)))))))) 'font-lock-variable-name-face)))
(goto-char end-of-sub))))))
(ert-deftest cperl-test-fontify-special-variables () (ert-deftest cperl-test-fontify-special-variables ()
"Test fontification of variables like $^T or ${^ENCODING}. "Test fontification of variables like $^T or ${^ENCODING}.
@ -314,6 +316,7 @@ issued by CPerl mode."
(defvar perl-continued-statement-offset) (defvar perl-continued-statement-offset)
(defvar perl-indent-level) (defvar perl-indent-level)
(defvar perl-indent-parens-as-block)
(defconst cperl--tests-heredoc-face (defconst cperl--tests-heredoc-face
(if (equal cperl-test-mode 'perl-mode) 'perl-heredoc (if (equal cperl-test-mode 'perl-mode) 'perl-heredoc