unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "E. Choroba" <choroba@matfyz.cz>
To: 49192@debbugs.gnu.org
Subject: bug#49192: cperl-mode: Syntax highlighting wrong for modifier "for /regex/" (patched)
Date: Wed, 23 Jun 2021 19:05:59 +0200 (CEST)	[thread overview]
Message-ID: <1efe76b8-9c64-d647-881d-83d23e6188a@ufal.mff.cuni.cz> (raw)

[-- 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


             reply	other threads:[~2021-06-23 17:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23 17:05 E. Choroba [this message]
2021-06-24 16:15 ` bug#49192: cperl-mode: Syntax highlighting wrong for modifier "for /regex/" (patched) Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1efe76b8-9c64-d647-881d-83d23e6188a@ufal.mff.cuni.cz \
    --to=choroba@matfyz.cz \
    --cc=49192@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).