From: npostavs@users.sourceforge.net
To: Drew Adams <drew.adams@oracle.com>
Cc: 21091@debbugs.gnu.org
Subject: bug#21091: 25.0.50; `isearch-done' called before `isearch-update' raises wrong-type-arg error
Date: Sun, 04 Sep 2016 16:47:59 -0400 [thread overview]
Message-ID: <87bn039ytc.fsf@users.sourceforge.net> (raw)
In-Reply-To: <947c6384-eeb3-475b-be8d-2277d0f799af@default> (Drew Adams's message of "Sat, 3 Sep 2016 22:43:54 -0700 (PDT)")
[-- Attachment #1: Type: text/plain, Size: 647 bytes --]
tags 21091 - notabug
found 21091 25.1
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):
>
> Haven't tested, but it looks good to me. I think that's all that's
> needed. Thanks for doing this.
Speaking of testing, I think this sort thing would benefit from a
regression test, so I added that to the patch. I will to master push in
a few days if there are no objections.
[-- Attachment #2: patch v2 --]
[-- Type: text/plain, Size: 2028 bytes --]
From 2f00da3a255a2fb46ce4819a3153e04d9d9d59c9 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 3 Sep 2016 23:38:35 -0400
Subject: [PATCH v2] 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.
---
lisp/isearch.el | 7 ++++---
test/lisp/isearch-tests.el | 8 ++++++++
2 files changed, 12 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.
diff --git a/test/lisp/isearch-tests.el b/test/lisp/isearch-tests.el
index 48c3424..52f312d 100644
--- a/test/lisp/isearch-tests.el
+++ b/test/lisp/isearch-tests.el
@@ -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
--
2.9.3
prev parent reply other threads:[~2016-09-04 20:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-19 3:57 bug#21091: 25.0.50; `isearch-done' called before `isearch-update' raises wrong-type-arg error Drew Adams
2016-04-30 21:27 ` Lars Ingebrigtsen
2016-09-04 0:08 ` Drew Adams
2016-09-04 3:45 ` npostavs
2016-09-04 5:43 ` Drew Adams
2016-09-04 20:47 ` npostavs [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bn039ytc.fsf@users.sourceforge.net \
--to=npostavs@users.sourceforge.net \
--cc=21091@debbugs.gnu.org \
--cc=drew.adams@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.