[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/fix-the-long-lines-display-bug 051d2a1e36: Improve isearch in au
From: |
Gregory Heytings |
Subject: |
feature/fix-the-long-lines-display-bug 051d2a1e36: Improve isearch in auto-narrow-mode. |
Date: |
Wed, 6 Jul 2022 08:42:33 -0400 (EDT) |
branch: feature/fix-the-long-lines-display-bug
commit 051d2a1e36a934175b7c487c592126f0aeb7591e
Author: Gregory Heytings <gregory@heytings.org>
Commit: Gregory Heytings <gregory@heytings.org>
Improve isearch in auto-narrow-mode.
* lisp/isearch.el (isearch-search): Set isearch-lazy-highlight to nil before
widening in auto-narrow-mode.
* lisp/files.el (auto-narrow--isearch-lazy-highlight): New internal
variable.
(auto-narrow-pre-command-function, auto-narrow-post-command-function): Use
it.
---
lisp/files.el | 7 ++++++-
lisp/isearch.el | 5 ++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lisp/files.el b/lisp/files.el
index 8d6ecb66bc..89c7334c5a 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2726,6 +2726,9 @@ beginning and end of the buffer."
(defvar-local auto-narrow--isearch-widen-automatically nil
"Internal variable used by `auto-narrow-mode'.")
+(defvar-local auto-narrow--isearch-lazy-highlight nil
+ "Internal variable used by `auto-narrow-mode'.")
+
(defvar-local auto-narrow--initialized nil
"Internal variable used by `auto-narrow-mode'.")
@@ -2733,7 +2736,8 @@ beginning and end of the buffer."
"Conditionally widen display when `auto-narrow-mode' is in effect."
(when auto-narrow-mode
(setq-local widen-automatically t
- isearch-widen-automatically t)
+ isearch-widen-automatically t
+ isearch-lazy-highlight auto-narrow--isearch-lazy-highlight)
(if (memq this-command '(narrow-to-region narrow-to-defun narrow-to-page))
(setq auto-narrow--narrowing-state 'explicit
widen-automatically auto-narrow--widen-automatically
@@ -2752,6 +2756,7 @@ beginning and end of the buffer."
(run-hooks 'auto-narrow-hook)
(setq auto-narrow--widen-automatically widen-automatically
auto-narrow--isearch-widen-automatically
isearch-widen-automatically
+ auto-narrow--isearch-lazy-highlight isearch-lazy-highlight
auto-narrow--narrowing-state 'auto
auto-narrow--initialized t))
(let (point cur-point-min buf-point-min buf-point-max size)
diff --git a/lisp/isearch.el b/lisp/isearch.el
index a6e034df6b..29036201ad 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -3658,7 +3658,10 @@ Optional third argument, if t, means if fail just return
nil (no error).
(isearch-search-string isearch-string nil t))
(if (and (not isearch-success) (buffer-narrowed-p)
isearch-widen-automatically widen-automatically)
- (widen)
+ (progn
+ (when auto-narrow-mode
+ (setq-local isearch-lazy-highlight nil))
+ (widen))
;; Clear RETRY unless the search predicate says
;; to skip this search hit.
(if (or (not isearch-success)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/fix-the-long-lines-display-bug 051d2a1e36: Improve isearch in auto-narrow-mode.,
Gregory Heytings <=