bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45617: <query-replace> loses the edit region. Works in 23.3, broke i


From: Bob Floyd
Subject: bug#45617: <query-replace> loses the edit region. Works in 23.3, broke in 26.3
Date: Fri, 22 Jan 2021 09:31:57 -0800

Yes, I'm using the function in my test.

Ah, I think I see why you do not see the issue:

When I start a fresh copy of emacs and follow the steps it works correctly.
When I repeat the steps a 2nd, 3rd ... time, then it breaks. 

After the 1st time <query-replace> shows this in the command window:
  Query replace in region (default _iDfnGoverned → _iBDHdfnGoverned):

> "Notice the selection region changes to lines 1-4 and is never restored."
> I don't see that the selection region changes to lines 1-4.  I see only
> that the selection region is deactivated after I yank the selection
> using middle mouse click <mouse-2>.

I believe you will see the selection region change when repeating the steps.

At least I hope so! If not, am I able to embed a jpg in a reply to one of
these emails?

-----Original Message-----
From: Juri Linkov [mailto:juri@linkov.net] 
Sent: Thursday, January 21, 2021 1:51 PM
To: Bob Floyd
Cc: 'Eli Zaretskii'; 45617@debbugs.gnu.org
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in
23.3, broke in 26.3

> Sorry, sorry, my bad. Ignore my last email!

Indeed, in your previous email the function was still messed up,
but the right function is below, hope you used it in your test:

> I'm now using the last version:
> ----------------------------------------------------
> (defun query-replace-read-args (prompt regexp-flag &optional noerror)
>   (unless noerror
>     (barf-if-buffer-read-only))
>   (save-mark-and-excursion
>     (let* ((from (query-replace-read-from prompt regexp-flag))
>            (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
>                  (query-replace-read-to from prompt regexp-flag))))
>       (list from to
>             (or (and current-prefix-arg (not (eq current-prefix-arg '-)))
>                 (and (plist-member (text-properties-at 0 from)
> 'isearch-regexp-function)
>                      (get-text-property 0 'isearch-regexp-function from)))
>             (and current-prefix-arg (eq current-prefix-arg '-))))))
> ----------------------------------------------------
> Do this:
>
> 1. Select entire region by dragging left mouse down from the BOTTOM to the
> TOP.
> 2. Begin <query-replace>
>    In the command window: Query replace in region: 
> 3. Double left mouse click on "_iDfnGoverned" at line 4 to select it:
>     (IObj<BDHdfnsScope> const& _iDfnGoverned <---THIS ONE , IObj<BDHscope>
> const& _iBDHparamset)
> 4. middle mouse click in the command window to insert, then enter:
>    Query replace in region: _iDfnGoverned with: 
>    Notice the selection region changes to lines 1-4 and is never restored.
> 5. middle mouse click in the command window to insert it again and edit:
>    Query replace in region _iDfnGoverned with: _iBDHdfnGoverned
> 6. Enter
>    Nothing happens!
>
> Middle mouse click: <mouse-2> mouse-yank-at-click
>
> Hope you can reproduce this!!!

Still can't reproduce this, everything works fine, all matches are replaced.
But I don't understand this line:
"Notice the selection region changes to lines 1-4 and is never restored."
I don't see that the selection region changes to lines 1-4.  I see only
that the selection region is deactivated after I yank the selection
using middle mouse click <mouse-2>.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]