* bug#49192: cperl-mode: Syntax highlighting wrong for modifier "for /regex/" (patched)
@ 2021-06-23 17:05 E. Choroba
2021-06-24 16:15 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: E. Choroba @ 2021-06-23 17:05 UTC (permalink / raw)
To: 49192
[-- Attachment #1: Type: text/plain, Size: 219 bytes --]
The following lines are highlighted correctly:
print while /./;
print if /./;
But the following two aren't:
print for /./;
print foreach /./;
(In reality, probably only useful with /g).
Patch attached.
Ch.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch; name=0001-cperl-mode-Fix-syntax-highlighting-for-a-regex-after.patch, Size: 1253 bytes --]
From 30138fee85f28f6371fe4b726d8a29c839a2fc78 Mon Sep 17 00:00:00 2001
From: "E. Choroba" <choroba@matfyz.cz>
Date: Wed, 23 Jun 2021 18:57:06 +0200
Subject: [PATCH] cperl-mode: Fix syntax highlighting for a regex after a for
modifier
The following lines should be highlighted the same:
print while /a/;
print if /a/;
print for /a/;
"for" behaved differently, the regex wasn't highlighted at all.
---
lisp/progmodes/cperl-mode.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index fa384bcad6..3370df6491 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -3981,7 +3981,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
(not (memq (preceding-char)
'(?$ ?@ ?& ?%)))
(looking-at
- "\\(while\\|if\\|unless\\|until\\|and\\|or\\|not\\|xor\\|split\\|grep\\|map\\|print\\|say\\|return\\)\\>"))))
+ "\\(while\\|if\\|unless\\|until\\|for\\(each\\)?\\|and\\|or\\|not\\|xor\\|split\\|grep\\|map\\|print\\|say\\|return\\)\\>"))))
(and (eq (preceding-char) ?.)
(eq (char-after (- (point) 2)) ?.))
(bobp))
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#49192: cperl-mode: Syntax highlighting wrong for modifier "for /regex/" (patched)
2021-06-23 17:05 bug#49192: cperl-mode: Syntax highlighting wrong for modifier "for /regex/" (patched) E. Choroba
@ 2021-06-24 16:15 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-24 16:15 UTC (permalink / raw)
To: E. Choroba; +Cc: 49192
"E. Choroba" <choroba@matfyz.cz> writes:
> But the following two aren't:
>
> print for /./;
> print foreach /./;
>
> (In reality, probably only useful with /g).
>
> Patch attached.
Thanks; applied to Emacs 28.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-24 16:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 17:05 bug#49192: cperl-mode: Syntax highlighting wrong for modifier "for /regex/" (patched) E. Choroba
2021-06-24 16:15 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).