GNU bug report logs -
#348
perl mode color vs. /:/
Previous Next
Reported by: jidanni <at> jidanni.org
Date: Sun, 1 Jun 2008 23:15:04 UTC
Severity: normal
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 348 in the body.
You can then email your comments to 348 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#348
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
jidanni <at> jidanni.org
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
Perl mode needs an "m" here to get the colors right.
Cperl mode has no problem. emacs-version "22.2.1".
$ cat r.pl
m/.*:dndli([^:]+)10:/; my $tmp=$1; #color OK
/.*:dndli([^:]+)10:/; my $tmp=$1; #color stuck.
//;#to recover color, only to demonstrate that
for(split /:/){print; print "\n";} #color stuck again.
#By the way, add make the "OK" in the comment above become "OK." and
#color gets unstuck!
$ emacs -Q r.pl
Reply sent to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
Full text and
rfc822 format available.
Notification sent to
jidanni <at> jidanni.org
:
bug acknowledged by developer.
Full text and
rfc822 format available.
Message #10 received at 348-close <at> emacsbugs.donarmstrong.com (full text, mbox):
>>>>> "jidanni" == jidanni <jidanni <at> jidanni.org> writes:
> Perl mode needs an "m" here to get the colors right.
> Cperl mode has no problem. emacs-version "22.2.1".
> $ cat r.pl
> m/.*:dndli([^:]+)10:/; my $tmp=$1; #color OK
> /.*:dndli([^:]+)10:/; my $tmp=$1; #color stuck.
> //;#to recover color, only to demonstrate that
> for(split /:/){print; print "\n";} #color stuck again.
> #By the way, add make the "OK" in the comment above become "OK." and
> #color gets unstuck!
> $ emacs -Q r.pl
Thanks. I've installed the patch below which seems to fix
your examples. Hopefully it doesn't make things worse in too many
other circumstances.
Stefan
Index: lisp/progmodes/perl-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/perl-mode.el,v
retrieving revision 1.78
diff -u -r1.78 perl-mode.el
--- lisp/progmodes/perl-mode.el 6 May 2008 07:18:35 -0000 1.78
+++ lisp/progmodes/perl-mode.el 3 Jun 2008 07:18:03 -0000
@@ -252,7 +252,7 @@
;; <file*glob>
(defvar perl-font-lock-syntactic-keywords
;; TODO: here-documents ("<<\\(\\sw\\|['\"]\\)")
- '(;; Turn POD into b-style comments
+ `(;; Turn POD into b-style comments
("^\\(=\\)\\sw" (1 "< b"))
("^=cut[ \t]*\\(\n\\)" (1 "> b"))
;; Catch ${ so that ${var} doesn't screw up indentation.
@@ -267,12 +267,27 @@
;; Be careful not to match "sub { (...) ... }".
("\\<sub\\(?:[[:space:]]+[^{}[:punct:][:space:]]+\\)?[[:space:]]*(\\([^)]+\\))"
1 '(1))
- ;; Regexp and funny quotes.
- ("\\(?:[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)"
+ ;; Regexp and funny quotes. Distinguishing a / that starts a regexp
+ ;; match from the division operator is ...interesting.
+ ;; Basically, / is a regexp match if it's preceded by an infix operator
+ ;; (or some similar separator), or by one of the special keywords
+ ;; corresponding to builtin functions that can take their first arg
+ ;; without parentheses. Of course, that presume we're looking at the
+ ;; *opening* slash. We can mis-match the closing ones, because they are
+ ;; treated separately later in
+ ;; perl-font-lock-special-syntactic-constructs.
+ (,(concat "\\(?:\\(?:\\(?:^\\|[^$@&%[:word:]]\\)"
+ (regexp-opt '("split" "if" "unless" "until" "while" "split"
+ "grep" "map" "not" "or" "and"))
+ "\\)\\|[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)")
(2 (if (and (match-end 1)
(save-excursion
(goto-char (match-end 1))
- (skip-chars-backward " \t\n")
+ ;; Not 100% correct since we haven't finished setting up
+ ;; the syntax-table before point, but better than nothing.
+ (forward-comment (- (point-max)))
+ (put-text-property (point) (match-end 2)
+ 'jit-lock-multiline t)
(not (memq (char-before)
'(?? ?: ?. ?, ?\; ?= ?! ?~ ?\( ?\[)))))
nil ;; A division sign instead of a regexp-match.
bug archived.
Request was from
Debbugs Internal Request <don <at> donarmstrong.com>
to
internal_control <at> emacsbugs.donarmstrong.com
.
(Tue, 01 Jul 2008 14:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 16 years and 352 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.