GNU bug report logs -
#35600
27.0.50; uncomment-region fails correctly to reverse the action of comment-region.
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Mon, 6 May 2019 10:12:01 UTC
Severity: normal
Found in version 27.0.50
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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).
This bug report was last modified 6 years and 14 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.