unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Alan Mackenzie <acm@muc.de>
Subject: Re: How to uncomment Perl program in emacs?
Date: Fri, 19 Aug 2005 08:44:58 +0000	[thread overview]
Message-ID: <a664ed.46.ln@acm.acm> (raw)
In-Reply-To: 1124400239.825424.94340@f14g2000cwb.googlegroups.com

Andy <gngandy@gmail.com> 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: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

  parent reply	other threads:[~2005-08-19  8:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-18 21:23 How to uncomment Perl program in emacs? Andy
2005-08-18 22:13 ` David Hansen
2005-08-19  2:45   ` Andy
2005-08-19  3:32     ` Henrik Enberg
2005-08-18 22:37 ` Edward O'Connor
     [not found] ` <mailman.4248.1124405039.20277.help-gnu-emacs@gnu.org>
2005-08-19  2:49   ` Andy
2005-08-19  7:16 ` ht000
2005-08-19  8:44 ` Alan Mackenzie [this message]
2005-08-19 16:06   ` Andy
2005-08-19 10:53 ` Michael Cadilhac
  -- strict thread matches above, loose matches on Subject: below --
2005-08-19  4:09 Dave Humphries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a664ed.46.ln@acm.acm \
    --to=acm@muc.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).