From: Glauber Alex Dias Prado <smade4@gmail.com>
To: weber <hugows@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Swapping comments and code in the region
Date: Sat, 23 Aug 2008 09:10:31 -0300 [thread overview]
Message-ID: <861w0ggceg.fsf@gmail.com> (raw)
In-Reply-To: <df6a313c-6a4a-4dea-84e6-bc3eca0eb427@k13g2000hse.googlegroups.com> (weber's message of "Fri, 22 Aug 2008 05:51:08 -0700 (PDT)")
weber <hugows@gmail.com> writes:
> On Aug 22, 8:44 pm, Nick Sandow <njs...@internode.on.net> wrote:
>> Hi,
>>
>> I think it would be handy to have a function that made comments into
>> code, and code into comments.
>>
>> That is, if the region consisted of the following 2 lines:
>>
>> foo();
>> // bar();
>>
>> ...they would become:
>>
>> // foo();
>> bar();
>>
>> Does anyone know of a package or command out there that does this?
>>
>> Thanks
>
> Something like this does the trick here:
>
> (defun comment-invert-region (beg end)
> (interactive "r")
> (goto-char beg)
> (while (< (point-at-eol) end)
> (comment-or-uncomment-region (point-at-bol) (1+ (point-at-eol)))
> (forward-line 1)))
>
> Cheers,
> HUgo
There is also comment-dwim , not exactly this but allows for "toggling"
of comments.
Cheers,
Glauber.
next prev parent reply other threads:[~2008-08-23 12:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.17303.1219387442.18990.help-gnu-emacs@gnu.org>
2008-08-22 12:51 ` Swapping comments and code in the region weber
2008-08-23 12:10 ` Glauber Alex Dias Prado [this message]
2008-09-09 21:09 ` Xah
2008-08-22 23:44 Nick Sandow
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=861w0ggceg.fsf@gmail.com \
--to=smade4@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=hugows@gmail.com \
/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.