branch: isearch-mb commit a2ec550ff4ff009790ec779d63641ade2d54fd6c Author: Augusto Stoffel <arstof...@gmail.com> Commit: Augusto Stoffel <arstof...@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