emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master dde0320: * lisp/replace.el (replace-highlight): Add


From: Juri Linkov
Subject: [Emacs-diffs] master dde0320: * lisp/replace.el (replace-highlight): Add save-match-data (bug#36328)
Date: Fri, 5 Jul 2019 15:11:41 -0400 (EDT)

branch: master
commit dde0320020429a2d2917895fc0e2f5a24ffe6348
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/replace.el (replace-highlight): Add save-match-data (bug#36328)
    
    * lisp/term/tty-colors.el (tty-color-canonicalize):
    Replace string-match with string-match-p.
    
    Thanks to Jayden Navarro <address@hidden> and Alan Mackenzie 
<address@hidden>
---
 lisp/replace.el         | 6 +++++-
 lisp/term/tty-colors.el | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/replace.el b/lisp/replace.el
index 9d1b7bf..db305ad 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2316,7 +2316,11 @@ It is called with three arguments, as if it were
            (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 307586f..5af8170 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -820,7 +820,7 @@ Value is the modified color alist for FRAME."
   "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)))
 



reply via email to

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