mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-23 18:47:57 +00:00
Don't require isearch-update before isearch-done
It is useful to be able to call `isearch-done' unconditionally to ensure a non-isearching state. * lisp/isearch.el (isearch-done): Check that `isearch--current-buffer' is a live buffer before using it (Bug #21091). * test/lisp/isearch-tests.el (isearch--test-done): Test it.
This commit is contained in:
parent
367f8568bc
commit
68f4b52927
@ -1045,9 +1045,10 @@ NOPUSH is t and EDIT is t."
|
||||
(remove-hook 'mouse-leave-buffer-hook 'isearch-done)
|
||||
(remove-hook 'kbd-macro-termination-hook 'isearch-done)
|
||||
(setq isearch-lazy-highlight-start nil)
|
||||
(with-current-buffer isearch--current-buffer
|
||||
(setq isearch--current-buffer nil)
|
||||
(setq cursor-sensor-inhibit (delq 'isearch cursor-sensor-inhibit)))
|
||||
(when (buffer-live-p isearch--current-buffer)
|
||||
(with-current-buffer isearch--current-buffer
|
||||
(setq isearch--current-buffer nil)
|
||||
(setq cursor-sensor-inhibit (delq 'isearch cursor-sensor-inhibit))))
|
||||
|
||||
;; Called by all commands that terminate isearch-mode.
|
||||
;; If NOPUSH is non-nil, we don't push the string on the search ring.
|
||||
|
@ -28,5 +28,13 @@
|
||||
(isearch-update)
|
||||
(should (equal isearch--current-buffer (current-buffer)))))
|
||||
|
||||
(ert-deftest isearch--test-done ()
|
||||
;; Normal operation.
|
||||
(isearch-update)
|
||||
(isearch-done)
|
||||
(should-not isearch--current-buffer)
|
||||
;; Bug #21091: let `isearch-done' work without `isearch-update'.
|
||||
(isearch-done))
|
||||
|
||||
(provide 'isearch-tests)
|
||||
;;; isearch-tests.el ends here
|
||||
|
Loading…
Reference in New Issue
Block a user