From: Juri Linkov <juri@linkov.net>
To: Nicolas Richard <youngfrog@members.fsf.org>
Cc: 20690@debbugs.gnu.org
Subject: bug#20690: 25.0.50; query-replace: incorrect history when replacing the NUL character.
Date: Mon, 01 Jun 2015 23:39:45 +0300 [thread overview]
Message-ID: <871thvcgdq.fsf@mail.linkov.net> (raw)
In-Reply-To: <86d21jzsft.fsf@members.fsf.org> (Nicolas Richard's message of "Fri, 29 May 2015 10:41:42 +0200")
> ;; We do a query-replace to remove NUL characters and replace them by
> ;; an empty string:
> M-% [query-replace]
> C-q [quoted-insert]
> 0 <return> <return> [exit-minibuffer]
> <return> [exit-minibuffer]
> ;; now we try to do it again, by relying on the history
> M-% [query-replace]
> <up> [previous-line-or-history-element]
> <return> [exit-minibuffer]
> ;; At this point, emacs asks what to replace "two NUL chars" with,
> ;; instead of removing NULs like the previous query-replace did.
>
> I suggest the following changes :
Thank you for the fix! I noticed that besides fixing the NUL character problem
your patch also changes the behaviour when there are no NUL characters, i.e.:
> +(defun query-replace--split-string (string)
> + "Split string STRING at a character with property `separator'"
> + (let* ((length (length string))
> + (split-pos (text-property-any 0 length 'separator t string)))
> + (if (not split-pos)
> + string
======
This used to be (substring-no-properties string)
> - (let* ((to (if (and (string-match separator from)
> - (get-text-property (match-beginning 0) 'separator from))
> - (substring-no-properties from (match-end 0))))
> - (from (if to (substring-no-properties from 0 (match-beginning 0))
> - (substring-no-properties from))))
=======================
Like you can see here above that stripes properties from the from string.
next prev parent reply other threads:[~2015-06-01 20:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-29 8:41 bug#20690: 25.0.50; query-replace: incorrect history when replacing the NUL character Nicolas Richard
2015-06-01 20:39 ` Juri Linkov [this message]
2015-06-02 9:30 ` Nicolas Richard
2015-06-22 22:59 ` Juri Linkov
2015-06-23 5:11 ` Nicolas Richard
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=871thvcgdq.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=20690@debbugs.gnu.org \
--cc=youngfrog@members.fsf.org \
/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.