all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
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: Mon, 25 Jan 2021 11:34:16 -0800	[thread overview]
Message-ID: <000301d6f351$1275aa10$3760fe30$@net> (raw)
In-Reply-To: <87im7ku9t2.fsf@mail.linkov.net>

>This is strange because if there is no region selected, this means that
>it should replace everywhere in the whole buffer (but only when point is
>at the beginning of the buffer).

Agreed, but that is what it does. Perhaps a clue?

I put the message in below as you suggest, but the result is as though no
region is selected - it replaces everywhere in the whole buffer:

(interactive
   (let ((common
	  (query-replace-read-args
	   (concat "Query replace"
		   (if current-prefix-arg
		       (if (eq current-prefix-arg '-) " backward" " word")
		     "")
		   (if (use-region-p) " in region" ""))
	   nil)))
     (list (nth 0 common) (nth 1 common) (nth 2 common)
	   ;; These are done separately here
	   ;; so that command-history will record these expressions
	   ;; rather than the values they had this time.
	   (if (use-region-p) (region-beginning))
	   (if (use-region-p) (region-end))
	   (nth 3 common)
	   (if (use-region-p) (region-noncontiguous-p)))))
  (message "region: %S %S" start end)
  (perform-replace from-string to-string t nil delimited nil nil start end
backward region-noncontiguous-p))

And *Messages* only contains:

Mark saved where search started
Mark set [2 times]
Replaced 11 occurences

The region I selected contained only 3 occurences.

Have I put your message in the correct place?

-----Original Message-----
From: Juri Linkov [mailto:juri@linkov.net] 
Sent: Monday, January 25, 2021 10:54 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

> It was doing the expected, correct, query replace, for the first, oh,
maybe
> six times, then got into the broken state and when I repeat the above
> sequence it behaves as if there was no region selected and no replacements
> are offered (Replaced 0 occurences).

This is strange because if there is no region selected, this means that
it should replace everywhere in the whole buffer (but only when point is
at the beginning of the buffer).

> It seems like something was not restored correctly. I cannot say I
precisely
> followed the above steps for the first times when it was working - I
wanted
> to vary the sequence a bit (sometimes entering from the keyboard,
sometimes
> selecting text from a lower line in the selection) to see if I could break
> it. I cannot be more specific about exactly which sequence broke it, only
> that now, when it's broken, it consistently does not work!

It could help you to debug when you insert the following line
in 'query-replace' immediately before the 'perform-replace' call:

  (message "region: %S %S" start end)

Then after query-replace you could check in the *Messages* buffer
and see the exact region boundaries used.  If there are 'nil' values,
this might mean there is a bug in save-mark-and-excursion.






  reply	other threads:[~2021-01-25 19:34 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
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 [this message]
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='000301d6f351$1275aa10$3760fe30$@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.