all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#348: perl mode color vs. /:/
@ 2008-06-01 20:47 ` jidanni
  2008-06-03  7:25   ` bug#348: marked as done (perl mode color vs. /:/) Emacs bug Tracking System
  0 siblings, 1 reply; 2+ messages in thread
From: jidanni @ 2008-06-01 20:47 UTC (permalink / raw)
  To: bug-gnu-emacs

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







^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#348: marked as done (perl mode color vs. /:/)
  2008-06-01 20:47 ` bug#348: perl mode color vs. /:/ jidanni
@ 2008-06-03  7:25   ` Emacs bug Tracking System
  0 siblings, 0 replies; 2+ messages in thread
From: Emacs bug Tracking System @ 2008-06-03  7:25 UTC (permalink / raw)
  To: Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 835 bytes --]


Your message dated Tue, 03 Jun 2008 03:19:53 -0400
with message-id <jwvabi3t28y.fsf-monnier+emacsbugreports@gnu.org>
and subject line Re: bug#348: perl mode color vs. /:/
has caused the Emacs bug report #348,
regarding perl mode color vs. /:/
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
348: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=348
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 2321 bytes --]

From: jidanni@jidanni.org
To: bug-gnu-emacs@gnu.org
Subject: perl mode color vs. /:/
Date: Mon, 02 Jun 2008 04:47:28 +0800
Message-ID: <87bq2kkhlr.fsf@jidanni.org>

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




[-- Attachment #3: Type: message/rfc822, Size: 4384 bytes --]

From: Stefan Monnier <monnier@iro.umontreal.ca>
To: 348-close@emacsbugs.donarmstrong.com
Subject: Re: bug#348: perl mode color vs. /:/
Date: Tue, 03 Jun 2008 03:19:53 -0400
Message-ID: <jwvabi3t28y.fsf-monnier+emacsbugreports@gnu.org>

>>>>> "jidanni" == jidanni  <jidanni@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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-03  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <jwvabi3t28y.fsf-monnier+emacsbugreports@gnu.org>
2008-06-01 20:47 ` bug#348: perl mode color vs. /:/ jidanni
2008-06-03  7:25   ` bug#348: marked as done (perl mode color vs. /:/) Emacs bug Tracking System

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.