* Re: Swapping comments and code in the region
[not found] <mailman.17303.1219387442.18990.help-gnu-emacs@gnu.org>
@ 2008-08-22 12:51 ` weber
2008-08-23 12:10 ` Glauber Alex Dias Prado
2008-09-09 21:09 ` Xah
1 sibling, 1 reply; 4+ messages in thread
From: weber @ 2008-08-22 12:51 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Swapping comments and code in the region
@ 2008-08-22 23:44 Nick Sandow
0 siblings, 0 replies; 4+ messages in thread
From: Nick Sandow @ 2008-08-22 23:44 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Swapping comments and code in the region
2008-08-22 12:51 ` Swapping comments and code in the region weber
@ 2008-08-23 12:10 ` Glauber Alex Dias Prado
0 siblings, 0 replies; 4+ messages in thread
From: Glauber Alex Dias Prado @ 2008-08-23 12:10 UTC (permalink / raw)
To: weber; +Cc: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Swapping comments and code in the region
[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-09-09 21:09 ` Xah
1 sibling, 0 replies; 4+ messages in thread
From: Xah @ 2008-09-09 21:09 UTC (permalink / raw)
To: help-gnu-emacs
On Aug 22, 4: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
there's comment-or-uncomment-region, which behaves not exactly as you
described but similar.
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-09-09 21:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
2008-09-09 21:09 ` Xah
2008-08-22 23:44 Nick Sandow
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).