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, 15 Jan 2021 10:05:04 -0800

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

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:
   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!

----------------------------------------------------
module RL ( electrical in, out );
   parameter real R1 = 7000.0;
   parameter real C  = 1p;
   
   analog begin
      I(in,out) <+ V(in,out) / R1;
      I(out)    <+ C * ddt( V(out) );
   end
   
endmodule // Sub

paramset P2 RL;
parameter real R=1000;
.R1= R;
endparamset
----------------------------------------------------

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



-----Original Message-----
From: Juri Linkov [mailto:juri@linkov.net] 
Sent: Friday, January 15, 2021 12:55 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've removed the earlier patch and installed these changes. Now testing
it!
> Thanks.
>
> -----Original Message-----
>  (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))))

It seems this is what we need to push to be able to close this bug report.
Indeed, it fixes only query-replace commands.  But fixing all commands
that use the minibuffer is not as easy as adding 'save-mark-and-excursion'
like in the patch above.

The problem is that 'read-from-minibuffer' is implemented in C.
If it was implemented in Lisp, it would be easy to add just
'save-mark-and-excursion', but in C this is impossible.






reply via email to

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