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: Wed, 20 Jan 2021 14:48:27 -0800

Ok, no surprise that I got the function messed up. What I am using now
appears to be working:

-------------------------------------------------------------------
(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))))
    (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)))
    (list from to
          (and current-prefix-arg (not (eq current-prefix-arg '-)))
          (and current-prefix-arg (eq current-prefix-arg '-))))))
----------------------------------------------------------------------

Not sure what I did at this time for it to not work, sorry.

"yank" -> <mouse-2> mapped to "mouse-yank-at-click"


-----Original Message-----
From: Juri Linkov [mailto:juri@linkov.net] 
Sent: Tuesday, January 19, 2021 9:44 AM
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

> I'm having an issue with the new patch. <query-replace> fails!

Sorry, I tried your test case, but can't reproduce the problem.

> 1. Select entire region by dragging mouse.
> 2. Begin <query-replace>
>    In the command window: Query replace in region: 
> 3. Enter RL using the keyboard
>    In the command window: Query replace in region RL with: 
> 4. Now, with the mouse, select RL at line 12 ...
>    paramset P2 RL; <--- THIS ONE
>    ... then yank it to the command window and with keyboard enter X:

The most important line of your test case is the line above,
but I don't understand what you mean by yanking the selected text.
I tried to drag the selected text "RL" to the minibuffer window,
as all other apps allow to do, but Emacs fails to do the same.
Please help to clarify how do you yank the selected text.

>    In the command window: Query replace in region RL with: RLX
> 5. Enter
>    Only one of the two RL's in the region are selected, depending on
>    if the region was selected from top-to-bottom or bottom-to-top.
>
>    It should select both RL's!

It selects both RL's when I tried.

> Just in case I misread the diff, this is the function as I have manually
> patched it:
>
> (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))))
>     (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)))
>     (list from to
>         (and current-prefix-arg (not (eq current-prefix-arg '-)))
>         (and current-prefix-arg (eq current-prefix-arg '-))))))

This function is very much messed up.  Please try the function below:

(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 '-))))))






reply via email to

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