[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: comment-uncomment-line-or-region.el
From: |
Andreas Roehler |
Subject: |
Re: comment-uncomment-line-or-region.el |
Date: |
Tue, 19 Sep 2006 21:21:37 +0200 |
User-agent: |
KNode/0.9.2 |
Reiner Steib wrote:
> On Tue, Sep 19 2006, Andreas Roehler wrote:
>
>> ;; Tries to be a quick commenting/uncommenting
>> ;; facility, as it respects region - active-mark and
>> ;; transient-mark-mode - but doesn't depend on them. If
>> ;; on a line, wanting to comment or uncomment them,
>> ;; you don't have to care if transient-mark-mode is on.
>
> What's the advantage compared to (the do-what-I-mean behavior
> of)
> `comment-region' [1]? Especially when using the new temporary
> transient mark mode commands in (to be) Emacs 22? [2]
>
> [1]
> ,----[ `C-h k M-;' ]
> | M-; runs the command comment-region
> | which is an interactive autoloaded Lisp function in
> | `newcomment'.
> | It is bound to M-;.
> | (comment-region BEG END &optional ARG)
> |
> | Comment or uncomment each line in the region.
> | With just C-u prefix arg, uncomment each line in region BEG
> | .. END. Numeric prefix ARG means use ARG comment characters.
> | If ARG is negative, delete that many comment characters
> | instead. By default, comments start at the left margin, are
> | terminated on each line, even for syntax in which newline
> | does not end the comment and blank lines
> | do not get comments. This can be changed with
> | `comment-style'.
> |
> | The strings used as comment starts are built from
> | `comment-start' without trailing spaces and
> | `comment-padding'.
> `----
>
> [2]
> ,----[ NEWS ]
> | One method is to type C-SPC C-SPC; this enables Transient
> | Mark mode
> | and sets the mark at point. The other method is to type C-u
> | C-x C-x. This enables Transient Mark mode temporarily but
> | does not alter the mark or the region.
> |
> | After these commands, Transient Mark mode remains enabled
> | until you
> | deactivate the mark. That typically happens when you type a
> | command that alters the buffer, but you can also deactivate
> | the mark by typing C-g.
> `----
>
> Bye, Reiner.
> Crosspost & Followup-To: gnu.emacs.help
The advantage AFAICT: you just don't have to care
for all this mentioned above:
Now switching of transient-mark-mode at all.
On a line, just hit the key.
Two lines? Hit two times or keep it a moment.
That's all.
You want to mark the region first to see it before?
Fine. It will work.
Beside this `comment-dwim' is a complex command which
covers a range of purposes. I don't intend to
discourage using it if you need it.
But why to start a Mercedes Benz just to roll to the
grocery next corner?
Thanks
__
Andreas Roehler