SPUG: perltidy HTML colorer

Matt Tucker tuck at whistlingfish.net
Wed Dec 26 20:09:09 CST 2001


-- Don Schneider <dons at amazon.com> spake thusly:

> For me, even with these, the emacs colorizer still gets confused by
> commas in a qq statement which uses balanced parentheses, braces,
> brackets, etc:
> 
>    print qq[      get rid of this, it confuses the colorizer.\n];
> 
> Using non-balanced delimiters is better, although everything after
> the comma isn't colorized as a string:
> 
>    print qq|      the next sentence is less true:\n|;
>    print qq|      get rid of this, it confuses the colorizer.\n|;
> 
> 
> Escaping the comma makes the colorizer happy:
> 
>    print qq[      the next sentence is false:\n];
>    print qq[      get rid of this\, it confuses the colorizer.\n];
> 
> 
> Any suggestions?

Odd. For me, all of those constructs are handled correctly (both from
the standpoint of colorization and balancing/indenting). I also have no
idea why a _comma_ of all things would be causing problems.

What versions of Emacs and cperl-mode do you have? What other
cperl-mode customization settings do you have? Are you doing anything
unusual in cperl-mode-hook? You wouldn't happen to be altering the
cperl-mode-syntax-table and setting comma to a quote character or
anything like that, would you?  :-)

And finally, is it possible to reproduce this in vanilla mode ('emacs
-q --no-site-file' or 'xemacs -vanilla')?

I also, by the way, have set up the following hack in .emacs for
situations where cperl-mode gets confused about colorization (which
happens more often in XEmacs than GNU Emacs):

;; Define a refontification command
(defun cperl-refontify-buffer ()
  "Reload cperl mode and fontify current buffer"
  (interactive)
  (font-lock-fontify-buffer)
  )

(eval-after-load "cperl-mode"
  '(progn
	 (cperl-define-key "\M-f" 'cperl-refontify-buffer [(meta f)])))

Many people, by the way, would probably prefer a different keystroke.
However, that's easy to change.

This hack allows me to do Alt-F at any point to refontify the buffer. I
probably use it more often than I should (since it shouldn't really be
necessary), but it works for now until I can get around to fixing
lazy-lock in XEmacs. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://mail.pm.org/archives/spug-list/attachments/20011226/b3d08e25/attachment.bin


More information about the spug-list mailing list