[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] isearch-mb a2ec550 2/7: Better place to check if Isearch is still
From: |
Stefan Monnier |
Subject: |
[elpa] isearch-mb a2ec550 2/7: Better place to check if Isearch is still active |
Date: |
Mon, 17 May 2021 12:18:40 -0400 (EDT) |
branch: isearch-mb
commit a2ec550ff4ff009790ec779d63641ade2d54fd6c
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Augusto Stoffel <arstoffel@gmail.com>
Better place to check if Isearch is still active
---
isearch-mb.el | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/isearch-mb.el b/isearch-mb.el
index 5d0c380..1dcb3d4 100644
--- a/isearch-mb.el
+++ b/isearch-mb.el
@@ -38,9 +38,6 @@
(require 'cl-lib)
(require 'subr-x))
-(defvar isearch-mb--prompt-overlay nil
- "Overlay for minibuffer prompt updates.")
-
(defvar isearch-mb--with-buffer
'(isearch-post-command-hook
isearch-beginning-of-buffer
@@ -94,6 +91,9 @@
map)
"Minibuffer keymap used by Isearch-Mb.")
+(defvar isearch-mb--prompt-overlay nil
+ "Overlay for minibuffer prompt updates.")
+
(defun isearch-mb--after-change (_beg _end _len)
"Hook to run from the minibuffer to update the Isearch state."
(let ((string (minibuffer-contents))
@@ -117,9 +117,11 @@
(defun isearch-mb--post-command-hook ()
"Hook to make the minibuffer reflect the Isearch state."
+ (unless isearch--current-buffer
+ (throw 'isearch-mb--continue '(ignore)))
(let ((inhibit-modification-hooks t))
- ;; We never update isearch-message. If it's not empty, then
- ;; Isearch on its own volition, and we update it.
+ ;; We never update `isearch-message'. If it's not empty, then
+ ;; Isearch changed the search string on its own volition.
(unless (string-empty-p isearch-message)
(setq isearch-message "")
(delete-minibuffer-contents)
@@ -157,13 +159,11 @@ Intended as an advice for Isearch commands."
(let ((enable-recursive-minibuffers t)
(inhibit-redisplay t))
(with-minibuffer-selected-window
- (apply args)
- (unless isearch-mode
- (throw 'isearch-mb--continue '(ignore)))))
+ (apply args)))
(apply args)))
(defun isearch-mb--after-exit (&rest args)
- "Evaluate ARGS, after quitting Isearch-Mb.
+ "Evaluate ARGS after quitting Isearch-Mb.
Intended as an advice for commands that quit Isearch and use the
minibuffer."
(throw 'isearch-mb--continue args))
@@ -222,7 +222,7 @@ minibuffer."
(unless (minibufferp)
;; When `with-isearch-suspended' is involved, this hook may run
;; more than once, hence the test for `isearch-mode'.
- (run-with-idle-timer 0 nil (lambda() (when isearch-mode
(isearch-mb--session))))))
+ (run-with-idle-timer 0 nil (lambda () (when isearch-mode
(isearch-mb--session))))))
;;;###autoload
(define-minor-mode isearch-mb-mode
- [elpa] branch isearch-mb created (now 781b537), Stefan Monnier, 2021/05/17
- [elpa] isearch-mb ebb9f55 1/7: Keep advices only for the duration of a search session, Stefan Monnier, 2021/05/17
- [elpa] isearch-mb fd9bdeb 6/7: Pad lazy count so that it only grows, Stefan Monnier, 2021/05/17
- [elpa] isearch-mb 44b9aa3 4/7: Use remapping in minibuffer keymap, Stefan Monnier, 2021/05/17
- [elpa] isearch-mb 0524206 3/7: Replace advices by let-bindings where possible, Stefan Monnier, 2021/05/17
- [elpa] isearch-mb a2ec550 2/7: Better place to check if Isearch is still active,
Stefan Monnier <=
- [elpa] isearch-mb ffd65df 5/7: Update Readme, Stefan Monnier, 2021/05/17
- [elpa] isearch-mb 781b537 7/7: Prepare for inclusion in GNU ELPA, Stefan Monnier, 2021/05/17