all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tyler Smith <tyler.smith@mail.mcgill.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Problem with removing comments
Date: 18 Dec 2007 15:20:36 GMT	[thread overview]
Message-ID: <slrnfmfp9v.rc.tyler.smith@blackbart.sedgenet> (raw)
In-Reply-To: 47678e4c$0$13119$9b4e6d93@newsspool2.arcor-online.net

On 2007-12-18, Markus Grunwald <markus.grunwald@gmx.de> wrote:
>
> What helped a bit was the documentation for comment-region: Now I can
> uncomment a region with C-u M-x comment-region. But I don't know how to
> "simulate" the "C-u" part in the "chb-uncomment-region-or-line" function.
> If that worked, I think everything should be ok...

I think you really do want comment-dwim, you just don't know it yet ;)
You can access comment-dwim with M-; so you can uncomment a line with
a few key strokes: "C-a C-spc C-e M-;" If that's too many key strokes,
it should be easy to wrap this in a function similar to what you've
tried, using either comment-dwim for a general case, or
uncomment-region for a function that only uncomments.

From the help:

comment-dwim is an interactive compiled Lisp function in `newcomment.el'.
It is bound to M-;.
(comment-dwim arg)

Call the comment command you want (Do What I Mean).
If the region is active and `transient-mark-mode' is on, call
  `comment-region' (unless it only consists of comments, in which
  case it calls `uncomment-region').
Else, if the current line is empty, insert a comment and indent it.
Else if a prefix arg is specified, call `comment-kill'.
Else, call `comment-indent'.
You can configure `comment-style' to change the way regions are commented.

HTH,

Tyler

*Written from Emacs22, but I don't think this changed from Emacs21?

      reply	other threads:[~2007-12-18 15:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-18  9:09 Problem with removing comments Markus Grunwald
2007-12-18 15:20 ` Tyler Smith [this message]

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

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

  git send-email \
    --in-reply-to=slrnfmfp9v.rc.tyler.smith@blackbart.sedgenet \
    --to=tyler.smith@mail.mcgill.ca \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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.