GNU bug report logs -
#21684
25.0.50; undo in query-replace w/o exit
Previous Next
Reported by: Tino Calancha <f92capac <at> gmail.com>
Date: Wed, 14 Oct 2015 13:24:01 UTC
Severity: wishlist
Tags: patch
Found in version 25.0.50
Fixed in version 26.1
Done: Glenn Morris <rgm <at> gnu.org>
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 21684 in the body.
You can then email your comments to 21684 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#21684
; Package
emacs
.
(Wed, 14 Oct 2015 13:24:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tino Calancha <f92capac <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 14 Oct 2015 13:24:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
of 2015-10-14
Repository revision: 38f99a02b83e9e408970cb7abdb685725b2004f9
Quite often, performing query-replace, i just hit the [space] quicky
with no much attention. If i replace one string by mistake, i can
comeback to it with "^", but if i edit the string with "E" to reset it
to its original value, the interactive query-replace session ends.
I found useful if we can undo such replacements without exiting the
query-replace.
The attached patch implement such behaviour for `query-replace'.
Having this also working for `query-replace-regexp' would be very nice,
but harder to implement.
[replace.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Wed, 14 Oct 2015 16:31:03 GMT)
Full text and
rfc822 format available.
Message #8 received at 21684 <at> debbugs.gnu.org (full text, mbox):
> Quite often, performing query-replace, i just hit the [space] quicky
> with no much attention. If i replace one string by mistake, i can
> comeback to it with "^", but if i edit the string with "E" to reset it to
> its original value, the interactive query-replace session ends.
>
> I found useful if we can undo such replacements without exiting the
> query-replace.
>
> The attached patch implement such behaviour for `query-replace'.
> Having this also working for `query-replace-regexp' would be very nice,
> but harder to implement.
This would be a useful feature. But I wonder why it's harder to
implement for regexps? If you need, you could add all previous
replacements strings to the same stack at the end of data elements in
the stack like we did when necessary by adding new data at the end of the
similar isearch stack elements in isearch-cmds. This would simplify
restoring the previous replaced strings from the stack.
PS: an alternative solution would be to call ordinary (undo) since
perform-replace places undo boundaries with (undo-boundary), but
it seems this would be a less reliable approach?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Sat, 17 Oct 2015 13:02:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 21684 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> I wonder why it's harder to implement for regexps?
Basically for my lack of expertise in this code: i was trying
to extend my patch to support regexp without success.
> you could add all previous replacements strings
> to the same stack at the end of data elements
> like we did when necessary by adding new data at
> the end of the similar isearch stack elements in isearch-cmds.
Thank you, it sounds a good idea!!
See new patch (replace-2.patch): AFAICS is working as i wanted.
Please try it and feel free to give me any comments if you
find some issues to fix/improve.
[replace-2.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Sat, 17 Oct 2015 21:52:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 21684 <at> debbugs.gnu.org (full text, mbox):
> See new patch (replace-2.patch): AFAICS is working as i wanted.
> Please try it and feel free to give me any comments if you
> find some issues to fix/improve.
Thank you, your patch is working well. One issue to improve I noticed that
when a previous replacement is skipped with "n" then undo "U" acts exactly
as backup "^" by going to the previous place, and doing no undo actually.
Maybe better would be for undo "U" to only undo and skip non-replacement
entries in the stack? (Implementation-wise this means looping until
finding a previous non-replacement entry in the stack).
A minor comment is that to save cons cells you could just put both new
elements shallow as elements 3 and 4 in the stack instead of adding
a list of them.
Another minor suggestions is for better names you could rename
the prefix -solved-regexp to -replaced, i.e. replace
search-string-solved-regexp, next-replacement-solved-regexp with
search-string-replaced, next-replacement-replaced.
Also we need this feature to be documented in etc/NEWS.
Have you already signed FSF copyright assignment papers?
Your patch for bug#21663 is short enough to be installed without the
copyright paperwork, but your changes for bug#21684 require it.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Sun, 18 Oct 2015 09:43:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 21684 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>Maybe better would be for undo "U" to only undo and skip non-replacement
>entries in the stack? (Implementation-wise this means looping until
>finding a previous non-replacement entry in the stack).
I agree, its better undo 'just' undo. Fixed in the new patch
(replace-3.patch).
>A minor comment is that to save cons cells you could just put both new
>elements shallow as elements 3 and 4 in the stack instead of adding
>a list of them.
Sure, thank you for remind me this. Applied.
>Another minor suggestions is for better names you could rename
>the prefix -solved-regexp to -replaced
Done. Thank you.
>Also we need this feature to be documented in etc/NEWS.
>Have you already signed FSF copyright assignment papers?
I didn't. I would like to sign. Maybe someone could guide me how to
complete such process.
[replace-3.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Sun, 18 Oct 2015 15:59:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 21684 <at> debbugs.gnu.org (full text, mbox):
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> >Maybe better would be for undo "U" to only undo and skip non-replacement
> >entries in the stack? (Implementation-wise this means looping until
> >finding a previous non-replacement entry in the stack).
> I agree, its better undo 'just' undo. Fixed in the new patch
> (replace-3.patch).
What change in functionality is being considered here?
--
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Mon, 19 Oct 2015 01:18:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 21684 <at> debbugs.gnu.org (full text, mbox):
> What change in functionality is being considered here?
Hi Richard,
the purpose is provide 'undo' into `query-replace'/`query-replace-regexp'.
Original code do not support such functionality in a convenient way.
For instance, in the scratch buffer:
M-x query-replace RET f RET @ RET [space] RET [space] RET C-/
(C-/ undo last replacement but end session: [space] would insert one space)
Indeed, you may correct last replacement with existing code without exit current
search replace, as follows:
I)
M-x query-replace RET f RET @ RET [space] RET [space] "^" C-r
(now you can edit last replacement; comeback to query-replace session with C-M-c)
C-M-c [space] [space] ...
This seems too complicated/slow to just undo last 1-2 replacements.
In my experience as an user 99% of the times, the situation is that i hit [space]
many times and fast, and then i realize i just want to undo last 1-2
replacements and keep going. It would be useful if that can be done just
with one key.
The patch replace-3.patch in this thread implements such interactive undo and binds
the new funtionality to keys "u" and "U".
Every time you hit "u" the latest replacement is undo: now you can hit "n" to skip
it (tipically) or [space] to replace it again, or maybe "u" to undo
another previous replacement (if any). The query-replace session is not
exit.
Tino
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Mon, 19 Oct 2015 22:09:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 21684 <at> debbugs.gnu.org (full text, mbox):
> The patch replace-3.patch in this thread implements such interactive undo
> and binds the new funtionality to keys "u" and "U".
Please note that usually the upper-case "U" applies to all
elements in the set such as e.g. in Dired the lower-case "u"
is bound to a single-mark dired-unmark whereas the upper-case "U"
is bound to dired-unmark-all-marks, etc.
For query-replace this means that better would be to bind the
upper-case "U" to a new operation undo-all that could be easy to
implement in the same branch with (or (eq def 'undo) (eq def 'undo-all))
and looping until the top of the stack when (eq def 'undo-all).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Tue, 20 Oct 2015 12:01:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 21684 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> Please note that usually the upper-case "U" applies to all
> elements in the set.
> For query-replace this means that better would be to bind the
> upper-case "U" to a new operation undo-all
Good point. Thank you very much.
Included in new patch (replace-4.patch).
[replace-4.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Tue, 20 Oct 2015 12:59:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 21684 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
In previous patch 'undo-all just show the total number of undid
replacements if the first element was replaced.
New patch (replace-5.patch) fix that: undo-all always show the accumulated
number of undone performed.
[replace-5.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Mon, 26 Oct 2015 04:10:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 21684 <at> debbugs.gnu.org (full text, mbox):
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Thanks. It seems useful.
(Please forgive my delay.)
--
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Tue, 23 Feb 2016 08:42:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 21684 <at> debbugs.gnu.org (full text, mbox):
Tino Calancha <f92capac <at> gmail.com> writes:
> Good point. Thank you very much.
> Included in new patch (replace-4.patch).
Looks good. Could you also add documentation for this (to the manual)
and a NEWS entry?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Tue, 23 Feb 2016 16:44:01 GMT)
Full text and
rfc822 format available.
Message #41 received at 21684 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> Looks good. Could you also add documentation for this (to the manual)
> and a NEWS entry?
Sure. Added NEWS entry and updated emacs manual.
[0001-Undo-in-query-replace-without-exit.patch (text/plain, attachment)]
[0002-Add-NEWS-and-documentation-for-last-commit.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Tue, 23 Feb 2016 17:55:02 GMT)
Full text and
rfc822 format available.
Message #44 received at 21684 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 24 Feb 2016 01:46:14 +0900 (JST)
> From: Tino Calancha <f92capac <at> gmail.com>
> Cc: Tino Calancha <f92capac <at> gmail.com>, 21684 <at> debbugs.gnu.org
>
> > Looks good. Could you also add documentation for this (to the manual)
> > and a NEWS entry?
> Sure. Added NEWS entry and updated emacs manual.
Thanks. A minor nit below:
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -435,6 +435,11 @@ is intended for adding to 'kill-emacs-query-functions'.
> in favor of the global `M-s h' bindings introduced in Emacs-23.1.
> They'll disappear soon.
>
> ++++
> +** New bindings for 'query-replace-map'.
> +`undo', undo the last replacement; bind to `u'.
> +`undo-all', undo all replacements; Bind to `U'.
"Bound", not "bind"; and the capitalization needs to be fixed.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Wed, 24 Feb 2016 01:38:02 GMT)
Full text and
rfc822 format available.
Message #47 received at 21684 <at> debbugs.gnu.org (full text, mbox):
Tino Calancha <f92capac <at> gmail.com> writes:
>> Looks good. Could you also add documentation for this (to the manual)
>> and a NEWS entry?
> Sure. Added NEWS entry and updated emacs manual.
Thanks; I've now applied this to the trunk. Seems to be working great,
and it's a feature I've missed for years.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Wed, 24 Feb 2016 13:11:02 GMT)
Full text and
rfc822 format available.
Message #50 received at 21684 <at> debbugs.gnu.org (full text, mbox):
> Thanks; I've now applied this to the trunk. Seems to be working great,
> and it's a feature I've missed for years.
Great! It has being my pleasure.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Tue, 31 May 2016 22:33:01 GMT)
Full text and
rfc822 format available.
Message #53 received at 21684 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen wrote:
> Thanks; I've now applied this to the trunk. Seems to be working great,
> and it's a feature I've missed for years.
Was a copyright assignment ever completed?
I don't see one on file.
http://debbugs.gnu.org/21684#14
Juri Linkov wrote:
> Have you already signed FSF copyright assignment papers?
>
> Your patch for bug#21663 is short enough to be installed without the
> copyright paperwork, but your changes for bug#21684 require it.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Wed, 01 Jun 2016 02:42:02 GMT)
Full text and
rfc822 format available.
Message #56 received at 21684 <at> debbugs.gnu.org (full text, mbox):
On Tue, 31 May 2016, Glenn Morris wrote:
> Was a copyright assignment ever completed?
> I don't see one on file.
>
> http://debbugs.gnu.org/21684#14
Yes it was, around November 2015: copyright assignment #1056152
Tino
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Wed, 01 Jun 2016 17:47:01 GMT)
Full text and
rfc822 format available.
Message #59 received at 21684 <at> debbugs.gnu.org (full text, mbox):
Tino Calancha wrote:
>> Was a copyright assignment ever completed?
>> I don't see one on file.
>>
>> http://debbugs.gnu.org/21684#14
>
> Yes it was, around November 2015: copyright assignment #1056152
Thanks. The semi-public file that records these things must not be
up-to-date (not for the first time). Not your problem. I'll ask the
relevant people.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Wed, 01 Jun 2016 17:54:02 GMT)
Full text and
rfc822 format available.
Message #62 received at 21684 <at> debbugs.gnu.org (full text, mbox):
Glenn Morris <rgm <at> gnu.org> writes:
> Tino Calancha wrote:
>
>>> Was a copyright assignment ever completed?
>>> I don't see one on file.
>>>
>>> http://debbugs.gnu.org/21684#14
>>
>> Yes it was, around November 2015: copyright assignment #1056152
>
> Thanks. The semi-public file that records these things must not be
> up-to-date (not for the first time). Not your problem. I'll ask the
> relevant people.
It was the last time I fetched it, but the name is in a slightly
different format. :-)
Search for "Calancha". (I'm not sure I'm allowed to post the full name
from the assignment here.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Wed, 01 Jun 2016 17:57:01 GMT)
Full text and
rfc822 format available.
Message #65 received at 21684 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen wrote:
> It was the last time I fetched it, but the name is in a slightly
> different format. :-)
>
> Search for "Calancha". (I'm not sure I'm allowed to post the full name
> from the assignment here.)
I don't think my grep-fu is to blame here. I generally try a broad search.
I've asked assign <at> gnu. There seem to be several missing entries AFAICS.
bug marked as fixed in version 25.2, send any further explanations to
21684 <at> debbugs.gnu.org and Tino Calancha <f92capac <at> gmail.com>
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Wed, 01 Jun 2016 17:58:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21684
; Package
emacs
.
(Thu, 02 Jun 2016 16:45:02 GMT)
Full text and
rfc822 format available.
Message #70 received at 21684 <at> debbugs.gnu.org (full text, mbox):
Glenn Morris wrote:
> I've asked assign <at> gnu. There seem to be several missing entries AFAICS.
The file that records the info was indeed out-of-date (malfunctioning
cron job) and has now been fixed.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 01 Jul 2016 11:24:06 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 04 Dec 2016 02:50:08 GMT)
Full text and
rfc822 format available.
bug Marked as fixed in versions 26.1.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 04 Dec 2016 02:50:08 GMT)
Full text and
rfc822 format available.
bug No longer marked as fixed in versions 25.2.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 04 Dec 2016 02:50:08 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 01 Jan 2017 12:24:24 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 311 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.