Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

syntax highlighting in emacs

by thens (Scribe)
on Dec 29, 2003 at 09:27 UTC ( [id://317434]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

thens has asked for the wisdom of the Perl Monks concerning the following question:

This is not really a perl question. More related to emacs. I have this problem where emacs does not higlight properly after encountering the following scenarios.
  1.  next if /^#/;
  2.  $str = '^\d{8}$' # Match exactly 8 digits.

Any code after this is not indented/highlighted properly.

A workaround for case # 1 is  next if  /^\#/;

Can you suggest any setting in cperl-mode or a workaround in perl to make emacs highlight properly anything after case #2

-T

Replies are listed 'Best First'.
Re: syntax highlighting in emacs
by maa (Pilgrim) on Dec 29, 2003 at 09:37 UTC

    Hi,
    does this happen all the time?

    Your example #2 has a missing semi-colon before the comment... dunno if that's all you're missing tho!

Re: syntax highlighting in emacs
by bschmer (Friar) on Dec 29, 2003 at 09:38 UTC
    Hmm. Case #2 works fine in the version of emacs that I am running (21.2.1). Where does the highliting break down?
Re: syntax highlighting in emacs
by mpeppler (Vicar) on Dec 29, 2003 at 13:02 UTC
    Workaround for #2 is:
    $str = '^\d{8}$' # ' Match exactly 8 digits.
    i.e. include a single quote in a comment on the same line. It's not perfect, but it works for me.

    Michael

      Thanks. It Works !!

      If it is of any help my xemacs version is 21.1.

      -T

Re: syntax highlighting in emacs
by matthewb (Curate) on Dec 29, 2003 at 21:10 UTC
    Can you suggest any setting in cperl-mode or a workaround in perl to make emacs highlight properly anything after case #2

    I checked out the latest emacs sources from Savannah recently (calls itself 21.3.50.3) and was delighted to note that the version of cperl-mode that was included (v. 5) fixed the formatting problems you describe. I had no problem using this cperl-mode with older versions of emacs; YMMV.

    Previous versions of cperl-mode suffered from occasional hiccups, many of which may be worked-around by inserting a comment after the offending line.

    MB

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://317434]
Approved by Thelonius
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.