all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: 21921@debbugs.gnu.org
Subject: bug#21921: New function comment-line also comments first line after region
Date: Sun, 15 Nov 2015 12:45:02 +0100	[thread overview]
Message-ID: <87a8qffpvl.fsf@gmx.us> (raw)
In-Reply-To: <56477C57.6090109@live.com>

Hi Clément,

Thanks for details report.

Clément Pit--Claudel <clement.pitclaudel@live.com> writes:

> Its documentation says:
>
>   If region is active, comment lines in active region instead.
>
> However, it seems that it also comments out the line just after the end
> of the region.
>
> For example, given the following text
>
> abc
> def
> ghi
>
> Placing the cursor before `a', then pressing C-SPC C-n C-n, causes two
> lines to be marked: (> is highlighting, | is point)
>
>>abc
>>def
> |ghi
>
> Yet pressing C-x C-; (comment-region) comments out all three lines.

Because the end of region is at point.  Try to run this:

        (list (point)  (region-beginning) (region-end))

Also, from the docstring,

      Unlike ‘comment-dwim’, this always comments whole lines.

You'd get what you'd expect if you run comment-dwim (M-;)

> Similarly, again starting from 
>
> abc
> def
> ghi
>
> placing the point before `g' and pressing C-SPC C-p C-p causes two lines
> to be marked:

Again, in fact the region start at 'g'.  Check e.g. with C-x C-x.  But
it's not obvious from the face.

>>|abc
>>def
> ghi
>
> Yet pressing C-x C-; comments out all three lines. I find this second example especially confusing.
>
> Is this behaviour only surprising to me?

Perhaps the confusion is caused by region not being displayed at column
zero.

The behavior is correct IMO.

For your particular examples, comment-dwim does what you want, it seems.

Hope it helps,
Rasmus

-- 
Spil noget med Slayer!






  reply	other threads:[~2015-11-15 11:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-14 18:24 bug#21921: New function comment-line also comments first line after region Clément Pit--Claudel
2015-11-15 11:45 ` Rasmus [this message]
2015-11-16  9:02   ` Artur Malabarba
2015-11-16 17:59     ` Rasmus
2015-11-17 20:47       ` Andreas Röhler
2017-06-04 13:24   ` npostavs

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=87a8qffpvl.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=21921@debbugs.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.