From: "Bob Floyd" <bobfloyd@comcast.net>
To: "'Juri Linkov'" <juri@linkov.net>
Cc: 45617@debbugs.gnu.org
Subject: bug#45617: <query-replace> loses the edit region. Works in 23.3, broke in 26.3
Date: Wed, 20 Jan 2021 15:23:00 -0800 [thread overview]
Message-ID: <000401d6ef83$32407e50$96c17af0$@net> (raw)
In-Reply-To: <877do8eull.fsf@mail.linkov.net>
Sorry, sorry, my bad. Ignore my last email!
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 '-))))))
----------------------------------------------------
And this test:
-----------------------------------------------------
void
DHroot::ModuleToGoverningParamsets::
Insert
(IObj<BDHdfnsScope> const& _iDfnGoverned, IObj<BDHscope> const&
_iBDHparamset)
{
std::pair<ModuleToGoverningParamsets::TIterator,bool> _pr
( TBase::Insert( _iDfnGoverned, ParamsetsGoverningModule() ) );
ParamsetsGoverningModule& _prmsets( (*_pr.first).second );
_prmsets.Insert( _iBDHparamset, Unused() );
}
----------------------------------------------------
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!!!
-----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 '-))))))
next prev parent reply other threads:[~2021-01-20 23:23 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-03 1:05 bug#45617: <query-replace> loses the edit region. Works in 23.3, broke in 26.3 Bob Floyd
2021-01-03 14:47 ` Eli Zaretskii
2021-01-03 19:18 ` Bob Floyd
2021-01-04 17:26 ` Eli Zaretskii
2021-01-04 17:37 ` Juri Linkov
2021-01-04 22:40 ` Bob Floyd
2021-01-05 18:27 ` Juri Linkov
2021-01-05 19:45 ` Bob Floyd
2021-01-06 17:44 ` Juri Linkov
2021-01-06 18:19 ` Eli Zaretskii
2021-01-06 22:10 ` Bob Floyd
2021-01-13 18:53 ` Juri Linkov
2021-01-15 1:22 ` Bob Floyd
2021-01-15 8:54 ` Juri Linkov
2021-01-15 11:23 ` Eli Zaretskii
2021-01-19 17:45 ` Juri Linkov
2021-01-19 18:39 ` Eli Zaretskii
2021-01-15 18:05 ` Bob Floyd
2021-01-19 17:43 ` Juri Linkov
2021-01-20 22:48 ` Bob Floyd
2021-01-20 23:23 ` Bob Floyd [this message]
2021-01-21 21:50 ` Juri Linkov
2021-01-22 17:31 ` Bob Floyd
2021-01-23 17:20 ` Juri Linkov
2021-01-23 18:03 ` Bob Floyd
2021-01-23 18:31 ` Juri Linkov
2021-01-24 20:40 ` Bob Floyd
2021-01-25 17:07 ` Juri Linkov
2021-01-25 18:13 ` Bob Floyd
2021-01-25 18:54 ` Juri Linkov
2021-01-25 19:34 ` Bob Floyd
2021-01-25 19:51 ` Juri Linkov
2021-01-26 0:34 ` Bob Floyd
2021-01-27 9:43 ` Juri Linkov
2021-01-28 16:31 ` Bob Floyd
2021-01-28 18:42 ` Juri Linkov
2021-01-28 21:32 ` Bob Floyd
2021-01-29 8:56 ` Juri Linkov
2021-01-15 18:09 ` Bob Floyd
2021-01-07 18:46 ` Juri Linkov
2021-01-07 19:36 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000401d6ef83$32407e50$96c17af0$@net' \
--to=bobfloyd@comcast.net \
--cc=45617@debbugs.gnu.org \
--cc=juri@linkov.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.