GNU bug report logs -
#20357
25.0.50; deactivate-mark behavior broken
Previous Next
Reported by: Oleh Krehel <ohwoeowho <at> gmail.com>
Date: Fri, 17 Apr 2015 10:27:01 UTC
Severity: normal
Found in version 25.0.50
Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20357 in the body.
You can then email your comments to 20357 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20357
; Package
emacs
.
(Fri, 17 Apr 2015 10:27:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Oleh Krehel <ohwoeowho <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 17 Apr 2015 10:27:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
This is a recent change, 24.5.2 doesn't have this bug.
How to reproduce:
1. Mark some text.
2. Call this:
(let (deactivate-mark)
(indent-region (region-beginning)
(region-end)))
Expected behavior: the mark isn't deactivated.
Actual behavior: the mark is deactivated.
Reply sent
to
Stefan Monnier <monnier <at> IRO.UMontreal.CA>
:
You have taken responsibility.
(Fri, 17 Apr 2015 14:32:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Oleh Krehel <ohwoeowho <at> gmail.com>
:
bug acknowledged by developer.
(Fri, 17 Apr 2015 14:32:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 20357-done <at> debbugs.gnu.org (full text, mbox):
> (let (deactivate-mark)
> (indent-region (region-beginning)
> (region-end)))
> Expected behavior: the mark isn't deactivated.
> Actual behavior: the mark is deactivated.
Oops, indeed. Fixed with the patch below,
Stefan
diff --git a/lisp/indent.el b/lisp/indent.el
index 74e73a6..18c1fd4 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -537,7 +537,7 @@ column to indent to; if it is nil, use one of the three methods above."
;; In most cases, reindenting modifies the buffer, but it may also
;; leave it unmodified, in which case we have to deactivate the mark
;; by hand.
- (deactivate-mark))
+ (setq deactivate-mark t))
(defun indent-relative-maybe ()
"Indent a new line like previous nonblank line.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20357
; Package
emacs
.
(Fri, 17 Apr 2015 16:04:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 20357-done <at> debbugs.gnu.org (full text, mbox):
Hi Stefan,
On Fri, Apr 17, 2015 at 4:31 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> (let (deactivate-mark)
>> (indent-region (region-beginning)
>> (region-end)))
>> Expected behavior: the mark isn't deactivated.
>> Actual behavior: the mark is deactivated.
>
> Oops, indeed. Fixed with the patch below,
>
> diff --git a/lisp/indent.el b/lisp/indent.el
> index 74e73a6..18c1fd4 100644
> --- a/lisp/indent.el
> +++ b/lisp/indent.el
> @@ -537,7 +537,7 @@ column to indent to; if it is nil, use one of the three methods above."
> ;; In most cases, reindenting modifies the buffer, but it may also
> ;; leave it unmodified, in which case we have to deactivate the mark
> ;; by hand.
> - (deactivate-mark))
> + (setq deactivate-mark t))
>
> (defun indent-relative-maybe ()
> "Indent a new line like previous nonblank line.
This is still not the correct behavior. Example code:
(with-temp-buffer
(insert "foobar")
(set-mark (point))
(goto-char (point-min))
(indent-region (point-min)
(point-max))
mark-active)
In 24.5 it returns nil, which is correct. While in 25 it returns t.
Oleh
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20357
; Package
emacs
.
(Fri, 17 Apr 2015 18:23:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 20357-done <at> debbugs.gnu.org (full text, mbox):
> (with-temp-buffer
> (insert "foobar")
> (set-mark (point))
> (goto-char (point-min))
> (indent-region (point-min)
> (point-max))
> mark-active)
> In 24.5 it returns nil, which is correct. While in 25 it returns t.
Why is it more correct to return nil than to return t?
> This is a recent change, 24.5.2 doesn't have this bug.
>
> (let (deactivate-mark)
> (indent-region (region-beginning)
> (region-end)))
>
> Expected behavior: the mark isn't deactivated.
At least in 24.4, the mark does get deactivated in my test.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20357
; Package
emacs
.
(Fri, 17 Apr 2015 18:31:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 20357-done <at> debbugs.gnu.org (full text, mbox):
On Fri, Apr 17, 2015 at 8:22 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> (with-temp-buffer
>> (insert "foobar")
>> (set-mark (point))
>> (goto-char (point-min))
>> (indent-region (point-min)
>> (point-max))
>> mark-active)
>> In 24.5 it returns nil, which is correct. While in 25 it returns t.
>
> Why is it more correct to return nil than to return t?
Because it's a long standing behavior that if you mark some stuff and
press TAB, the mark will be deactivated. And in 25, the mark actually
is deactivated outside of temp buffers, which is where I run my ERT
tests. So the tests are passing for 24.5 and failing for 25, while the
functions actually do work in both.
>
>> This is a recent change, 24.5.2 doesn't have this bug.
>>
>> (let (deactivate-mark)
>> (indent-region (region-beginning)
>> (region-end)))
>>
>> Expected behavior: the mark isn't deactivated.
>
> At least in 24.4, the mark does get deactivated in my test.
This may be possible. Previously, I was testing using the emacs24 ppa
install, that uses emacs-24.3.
I've started testing with emacs-snapshot only this week, and the tests
started failing.
But when I've tested with 24.5 or 25 on my own machine, the tests were
running fine.
Oleh
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20357
; Package
emacs
.
(Fri, 17 Apr 2015 19:17:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 20357-done <at> debbugs.gnu.org (full text, mbox):
>>> (with-temp-buffer
>>> (insert "foobar")
>>> (set-mark (point))
>>> (goto-char (point-min))
>>> (indent-region (point-min)
>>> (point-max))
>>> mark-active)
>>> In 24.5 it returns nil, which is correct. While in 25 it returns t.
>> Why is it more correct to return nil than to return t?
> Because it's a long standing behavior that if you mark some stuff and
> press TAB, the mark will be deactivated.
That's still the case. The difference is that now it's deactivated by
the command loop rather than by the command itself. Doing it in the
command loop is the normal behavior (the one used for most other
commands which cause the mark to be deactivated).
>>> This is a recent change, 24.5.2 doesn't have this bug.
>>> (let (deactivate-mark)
>>> (indent-region (region-beginning)
>>> (region-end)))
>>> Expected behavior: the mark isn't deactivated.
>> At least in 24.4, the mark does get deactivated in my test.
It's also deactivated in Emacs-23.4 in my tests.
> But when I've tested with 24.5 or 25 on my own machine, the tests were
> running fine.
I think we need to know more about what your tests really do.
Maybe they should just be fixed to test (or (not mark-active)
deactivate-mark) instead of only testing mark-active.
Stefan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 16 May 2015 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 115 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.