unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Drew Adams <drew.adams@oracle.com>
Cc: PEDRO ANDRES ARANDA GUTIERREZ <paranda@it.uc3m.es>,
	emacs-devel@gnu.org, Yuri Khan <yuri.v.khan@gmail.com>
Subject: Re: Just a thought about comment-line
Date: Sun, 31 May 2020 15:05:11 -0400	[thread overview]
Message-ID: <jwvimgc6iah.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <b70cd763-a0bb-4331-82e6-99909ae44d6d@default> (Drew Adams's message of "Sun, 31 May 2020 11:05:55 -0700 (PDT)")

>> It automatically decides whether to comment or to uncomment, indeed.
> Precisely.  It's a compromise, and not a great one (IMO).  Better to
> have two commands, one for block commenting and the other for
> end-of-line commenting.

I have never seen someone comment a comment.  Do you have a use case for it?

> It's not just that it has to correctly guess what you mean.  It's also
> that _you_ have to guess what it's guessing you mean. ;-)

That in nature of DWIM commands, yes.

>> Right, as a general rule, the LF char belongs to the line that it
>> terminates, so a position at BOL is really "between lines".
>> Of course, that would require a special case when START=END=BOL.
>
> That special case is what `comment-region-lines' handles.

At the detriment of the other case.

> It just does this:
> (comment-region BOL EOL PREFIX-ARG).

But that's what the OP complained about when you do

    C-a C-SPC
    C-n C-n M-x comment-region-lines RET

where it ends up commenting 3 lines, even though there are only 2 lines
enclosed in the region.


        Stefan




  reply	other threads:[~2020-05-31 19:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-31  7:39 Just a thought about comment-line PEDRO ANDRES ARANDA GUTIERREZ
2020-05-31  9:57 ` Yuri Khan
2020-05-31 16:58   ` Drew Adams
2020-05-31 17:15     ` Stefan Monnier
2020-05-31 18:05       ` Drew Adams
2020-05-31 19:05         ` Stefan Monnier [this message]
2020-05-31 21:53           ` Drew Adams
2020-05-31 17:42     ` Dmitry Gutov
2020-05-31 18:08       ` Drew Adams
2020-05-31 18:31         ` Dmitry Gutov
2020-05-31 21:54           ` Drew Adams
2020-06-01  5:18             ` PEDRO ANDRES ARANDA GUTIERREZ
2020-06-01  5:29               ` PEDRO ANDRES ARANDA GUTIERREZ
2020-05-31 14:40 ` Eli Zaretskii
2020-05-31 16:53 ` Drew Adams
2020-06-01  6:14 ` Clément Pit-Claudel

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=jwvimgc6iah.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=paranda@it.uc3m.es \
    --cc=yuri.v.khan@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).