mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
; cperl-mode.el: Fix fontification error with signatures
This fixes the second issue in Bug#79269. * lisp/progmodes/cperl-mode.el (cperl-init-faces): Move handling of signatures with initializers from the "anchor" to the "anchored" matcher * test/lisp/progmodes/cperl-mode-resources/proto-and-attrs.pl (sub_7): Test case for Bug#79269, wrong face report * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-fontify-attrs-and-signatures): Make sure that the test catches sub_7 for Bug#79269
This commit is contained in:
parent
680ef7b5f0
commit
a419e92bc6
3 changed files with 16 additions and 5 deletions
|
|
@ -6374,9 +6374,7 @@ functions (which they are not). Inherits from `default'.")
|
|||
(sequence (eval cperl--signature-rx)
|
||||
(eval cperl--ws*-rx))
|
||||
;; ... or the start of a "sloppy" signature
|
||||
(sequence (eval cperl--sloppy-signature-rx)
|
||||
;; arbitrarily continue "a few lines"
|
||||
(repeat 0 200 (not (in "{"))))
|
||||
(sequence (eval cperl--sloppy-signature-rx))
|
||||
;; make sure we have a reasonably
|
||||
;; short match for an incomplete sub
|
||||
(not (in ";{("))
|
||||
|
|
@ -6392,7 +6390,13 @@ functions (which they are not). Inherits from `default'.")
|
|||
(group (eval cperl--basic-variable-rx))))
|
||||
(progn
|
||||
(goto-char (match-beginning 2)) ; pre-match: Back to sig
|
||||
(match-end 2))
|
||||
;; While typing, forward-sexp might fail with a scan error.
|
||||
;; If so, stop looking for declarations at (match-end 2)
|
||||
(condition-case nil
|
||||
(save-excursion
|
||||
(forward-sexp)
|
||||
(point))
|
||||
(error (match-end 2))))
|
||||
nil
|
||||
(1 font-lock-variable-name-face)))
|
||||
;; -------- flow control
|
||||
|
|
|
|||
|
|
@ -41,6 +41,13 @@ sub sub_6
|
|||
{
|
||||
}
|
||||
|
||||
# Braces in initializers (Bug79269)
|
||||
sub sub_7
|
||||
($foo = { },
|
||||
$bar //= "baz")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
# Part 2: Same constructs for anonymous subs
|
||||
# A plain named subroutine without any optional stuff
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ attributes, prototypes and signatures."
|
|||
(should (equal (get-text-property (match-beginning 0) 'face)
|
||||
'font-lock-function-name-face))
|
||||
(let ((start-of-sub (match-beginning 0))
|
||||
(end-of-sub (save-excursion (search-forward "}") (point))))
|
||||
(end-of-sub (save-excursion (search-forward "}\n") (point))))
|
||||
|
||||
;; Prototypes are shown as strings
|
||||
(when (search-forward-regexp " ([$%@*]*) " end-of-sub t)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue