From: Juri Linkov <juri@linkov.net>
To: Alan Mackenzie <acm@muc.de>
Cc: Jayden Navarro <jayden@yugabyte.com>, 36328@debbugs.gnu.org
Subject: bug#36328: 26.2; Args out of range on search-and-replace of *.cc file
Date: Tue, 25 Jun 2019 22:58:56 +0300 [thread overview]
Message-ID: <87lfxpzbb3.fsf@mail.linkov.net> (raw)
In-Reply-To: <20190625094708.GB5471@ACM> (Alan Mackenzie's message of "Tue, 25 Jun 2019 09:47:08 +0000")
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
Hello, Alan.
> My feeling is that perform-replace (or, possibly, replace-highlight) is
> the best place to put a save-match-data.
Doing this in perform-replace means adding save-match-data in all places
where replace-highlight is called, so maybe better to add it only once
in replace-highlight like Jayden proposed initially.
But then it's important to add an explanatory comment since
the need of using of save-match-data is not self-evident here.
Do you think this comment is clear enough?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: replace-save-match-data.patch --]
[-- Type: text/x-diff, Size: 1142 bytes --]
diff --git a/lisp/replace.el b/lisp/replace.el
index 9d1b7bf747..50c74be8f6 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2316,7 +2316,11 @@ replace-highlight
(isearch-forward (not backward))
(isearch-other-end match-beg)
(isearch-error nil))
- (isearch-lazy-highlight-new-loop range-beg range-end))))
+ (save-match-data
+ ;; Preserve match-data for perform-replace since
+ ;; isearch-lazy-highlight-new-loop calls `sit-for' that
+ ;; does redisplay that might clobber match data (bug#36328).
+ (isearch-lazy-highlight-new-loop range-beg range-end)))))
(defun replace-dehighlight ()
(when replace-overlay
diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
index 307586f221..5af8170203 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -820,7 +820,7 @@ tty-color-canonicalize
"Return COLOR in canonical form.
A canonicalized color name is all-lower case, with any blanks removed."
(let ((case-fold-search nil))
- (if (string-match "[A-Z ]" color)
+ (if (string-match-p "[A-Z ]" color)
(replace-regexp-in-string " +" "" (downcase color))
color)))
next prev parent reply other threads:[~2019-06-25 19:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 23:03 bug#36328: 26.2; Args out of range on search-and-replace of *.cc file Jayden Navarro
[not found] ` <mailman.612.1561158667.10840.bug-gnu-emacs@gnu.org>
2019-06-22 13:25 ` Alan Mackenzie
2019-06-22 14:25 ` Jayden Navarro
2019-06-22 14:51 ` Juanma Barranquero
2019-06-22 16:09 ` Jayden Navarro
2019-06-22 20:50 ` Alan Mackenzie
2019-06-22 21:27 ` Jayden Navarro
2019-06-22 22:38 ` Jayden Navarro
2019-06-22 23:02 ` Jayden Navarro
2019-06-23 12:22 ` Alan Mackenzie
2019-06-23 16:14 ` Jayden Navarro
2019-06-23 19:32 ` Alan Mackenzie
2019-06-23 21:19 ` Juri Linkov
2019-06-23 21:42 ` Jayden Navarro
2019-06-24 19:05 ` Juri Linkov
2019-06-24 20:03 ` Jayden Navarro
2019-06-24 7:52 ` Alan Mackenzie
2019-06-24 19:18 ` Juri Linkov
2019-06-25 9:47 ` Alan Mackenzie
2019-06-25 19:58 ` Juri Linkov [this message]
2019-07-04 21:09 ` Juri Linkov
2019-07-05 6:11 ` Eli Zaretskii
2019-07-05 19:12 ` Juri Linkov
2019-10-02 23:53 ` Stefan Kangas
2019-06-23 20:10 ` bug#36328: [jayden@yugabyte.com: Re: bug#36328: 26.2; Args out of range on search-and-replace of *.cc file] Alan Mackenzie
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lfxpzbb3.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=36328@debbugs.gnu.org \
--cc=acm@muc.de \
--cc=jayden@yugabyte.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).