bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21091: 25.0.50; `isearch-done' called before `isearch-update' raises


From: npostavs
Subject: bug#21091: 25.0.50; `isearch-done' called before `isearch-update' raises wrong-type-arg error
Date: Sat, 03 Sep 2016 23:45:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

tags 21091 patch
quit

Drew Adams <drew.adams@oracle.com> writes:
>
> Anyway, please consider somehow ensuring that `isearch-done' does not
> care whether `isearch--current-buffer' has a string value.

Make sense to me, I suggest the following (isearch-update checks for a
buffer value, so I went with that to be consistent):

>From 5d7697546800ad3494df1d06d24e12f2fe987350 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 3 Sep 2016 23:38:35 -0400
Subject: [PATCH v1] 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).
---
 lisp/isearch.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index b50379a..39ed8af 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1045,9 +1045,10 @@ isearch-done
   (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.
-- 
2.9.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]