all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: 35600@debbugs.gnu.org
Subject: bug#35600: 27.0.50; uncomment-region fails correctly to reverse the action of comment-region.
Date: Mon, 6 May 2019 10:11:00 +0000	[thread overview]
Message-ID: <20190506101100.GA4300@ACM> (raw)

Hello, Emacs.

In the master branch:

With indent-tabs-mode t, and tab-width (say) 8, start off with the
following two line of Emacs lisp:

    (if (null bs-state)
	(ignore)
    ^
  <tab>


(the first of these lines being indented by four spaces, the second by a
<tab>).

Mark the two lines, and execute M-x comment-region.  We get this:

    ;; (if (null bs-state)
    ;;  (ignore)
       ^
     <tab>

(where all the space is space characters except for the <tab> just
before "(ignore)").

Now execute M-x uncomment-region.  This should restore the region to
what it started as.  Instead one gets:

    (if (null bs-state)
    	(ignore)
^^^^  ^
SPCs <tab>

, there now being four spurious spaces before the <tab> preceding
"(ignore)".  This is a bug.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

In uncomment-region-default-1, the variable `spt' gets set to the result
of comment-search-forward, the ";" at the beginning of the comment on
the current line.  The function then narrows to between `spt' and BO
next line.

In this narrowed region, the function removes the comment starter.
Because of the narrowing, it cannot take any account of the spaces at
the start of the line.

Possibly, uncomment-region needs to be amended so that that narrowing
includes any space preceding the comment starter, and that space gets
properly handled.

-- 
Alan Mackenzie (Nuremberg, Germany).





             reply	other threads:[~2019-05-06 10:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 10:11 Alan Mackenzie [this message]
2019-05-07  8:59 ` bug#35600: [Patch]: Re: bug#35600: 27.0.50; uncomment-region fails correctly to reverse the action of comment-region Alan Mackenzie
     [not found] ` <handler.35600.B.155713747728843.ack@debbugs.gnu.org>
2019-05-10  7:36   ` Alan Mackenzie

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=20190506101100.GA4300@ACM \
    --to=acm@muc.de \
    --cc=35600@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.