help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to uncomment Perl program in emacs?


From: Alan Mackenzie
Subject: Re: How to uncomment Perl program in emacs?
Date: Fri, 19 Aug 2005 08:44:58 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

Andy <address@hidden> wrote on 18 Aug 2005 14:23:59 -0700:
> I am right now using GNU emacs 20.3.1 on solaris.

First comment: that release is many years old; if you upgraded to a more
recent release (currently, that's 21.4), you might well like the new
features; there's little to dislike, and few, if any, compatibility
problems.  Also, if you have any more problems, the people who'll be
helping you will know the current release much better than older ones.

> I can comment and uncomment C codes by first simply highlighting the
> codes, and then Control-c Control-c for comment or Control-u Control-c
> Control-c for uncomment.

> But I can't apply the above method to comment or uncomment Perl codes.
> Alternatively, I can comment Perl codes by first highlighting the codes
> then "M-x comment-region".

OK, just a first check: You're using "Perl Mode", right?  That is, on the
mode line you see "(Perl)" just to the left of the line number?  The
thing is, there is at least one other mode ("CPerl Mode", I think) which
can be used instead.

> But I don't know how to uncomment Perl codes; at least, "M-x
> uncomment-region" doesn't work.

C-u M-x comment-region  ;-)

> Can anyone please help me to find a better way to comment/uncomment
> Perl codes, just like what can be done for C codes? Thanks a lot for
> your help!

Put this in your .emacs:

  (eval-after-load "perl-mode"
    '(define-key perl-mode-map "\C-c\C-c"  'comment-region))

(DON'T miss out the tick at the beginning of the second line.  It's
important.)

That should set up your mode so that you can use C-c C-c for perl.

Just one proviso: I've tried all this in Emacs 21.3, not 20.3.  It should
probably work in the older version, though.

> Andy

-- 
Alan Mackenzie (Munich, Germany)
Email: address@hidden; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").



reply via email to

[Prev in Thread] Current Thread [Next in Thread]