unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
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: Sat, 03 Sep 2016 23:45:07 -0400	[thread overview]
Message-ID: <87h99w9vlo.fsf@users.sourceforge.net> (raw)
In-Reply-To: <d59c504a-132b-4166-82b0-e0d9a0bac78a@default> (Drew Adams's message of "Sat, 18 Jul 2015 20:57:32 -0700 (PDT)")

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

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):


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1356 bytes --]

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


  parent reply	other threads:[~2016-09-04  3:45 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 [this message]
2016-09-04  5:43   ` Drew Adams
2016-09-04 20:47     ` npostavs

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h99w9vlo.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).