diff options
author | Juri Linkov <juri@jurta.org> | 2013-05-28 02:02:37 +0300 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2013-05-28 02:02:37 +0300 |
commit | d289938a057ab8572fc60eb5367980eeef35d600 (patch) | |
tree | 90ca18e1aeef7cc5f824ce5ed8d8ac99887eeb4e /lisp/replace.el | |
parent | 66fc57e3cdc9ffc2bed7a457a39a210fcf773e98 (diff) | |
download | emacs-d289938a057ab8572fc60eb5367980eeef35d600.tar.gz |
* lisp/replace.el (perform-replace): Ignore invisible matches.
In addition to checking `query-replace-skip-read-only', also
filter out matches by calling `run-hook-with-args-until-failure'
on `isearch-filter-predicates', and also check `search-invisible'
for t or call `isearch-range-invisible'.
(replace-dehighlight): Call `isearch-clean-overlays'.
Fixes: debbugs:11746
Diffstat (limited to 'lisp/replace.el')
-rw-r--r-- | lisp/replace.el | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 1bebff448fa..7c26f1ed063 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -2003,10 +2003,18 @@ make, or the user didn't cancel the call." match)))))) ;; Optionally ignore matches that have a read-only property. - (unless (and query-replace-skip-read-only - (text-property-not-all - (nth 0 real-match-data) (nth 1 real-match-data) - 'read-only nil)) + (when (and (or (not query-replace-skip-read-only) + (not (text-property-not-all + (nth 0 real-match-data) (nth 1 real-match-data) + 'read-only nil))) + ;; Optionally filter out matches. + (run-hook-with-args-until-failure + 'isearch-filter-predicates + (nth 0 real-match-data) (nth 1 real-match-data)) + ;; Optionally ignore invisible matches. + (or (eq search-invisible t) + (not (isearch-range-invisible + (nth 0 real-match-data) (nth 1 real-match-data))))) ;; Calculate the replacement string, if necessary. (when replacements @@ -2251,6 +2259,8 @@ make, or the user didn't cancel the call." (delete-overlay replace-overlay)) (when query-replace-lazy-highlight (lazy-highlight-cleanup lazy-highlight-cleanup) - (setq isearch-lazy-highlight-last-string nil))) + (setq isearch-lazy-highlight-last-string nil)) + ;; Close overlays opened by `isearch-range-invisible' in `perform-replace'. + (isearch-clean-overlays)) ;;; replace.el ends here |