From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs 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 Message-ID: <87bn039ytc.fsf@users.sourceforge.net> References: <87h99w9vlo.fsf@users.sourceforge.net> <947c6384-eeb3-475b-be8d-2277d0f799af@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1473022101 2280 195.159.176.226 (4 Sep 2016 20:48:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 4 Sep 2016 20:48:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 21091@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 04 22:48:16 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgeKt-0008Kk-8E for geb-bug-gnu-emacs@m.gmane.org; Sun, 04 Sep 2016 22:48:15 +0200 Original-Received: from localhost ([::1]:51026 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgeKq-00025c-Oy for geb-bug-gnu-emacs@m.gmane.org; Sun, 04 Sep 2016 16:48:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgeKk-00025S-2r for bug-gnu-emacs@gnu.org; Sun, 04 Sep 2016 16:48:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgeKg-00026q-S2 for bug-gnu-emacs@gnu.org; Sun, 04 Sep 2016 16:48:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgeKg-00026m-NP for bug-gnu-emacs@gnu.org; Sun, 04 Sep 2016 16:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bgeKg-0004PW-5y for bug-gnu-emacs@gnu.org; Sun, 04 Sep 2016 16:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Sep 2016 20:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21091 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug patch Original-Received: via spool by 21091-submit@debbugs.gnu.org id=B21091.147302206716931 (code B ref 21091); Sun, 04 Sep 2016 20:48:02 +0000 Original-Received: (at 21091) by debbugs.gnu.org; 4 Sep 2016 20:47:47 +0000 Original-Received: from localhost ([127.0.0.1]:49922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgeKR-0004Ow-8h for submit@debbugs.gnu.org; Sun, 04 Sep 2016 16:47:47 -0400 Original-Received: from mail-it0-f52.google.com ([209.85.214.52]:35576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgeKO-0004Oe-NY; Sun, 04 Sep 2016 16:47:45 -0400 Original-Received: by mail-it0-f52.google.com with SMTP id e124so119903924ith.0; Sun, 04 Sep 2016 13:47:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=XMe6Nuu+iTvqzeZiuvRWhDHMIR+3SjRekw5KCFT+jC0=; b=yPKtIcjqfZGGFqtv062OjBvZgo/EE22zpBxltzH32tnBbTVHcI7cHjgh0mUlaukWzm T3ef0oZ0CGHWtYuKHUa7hRvY9ht/AlQhA86IBBD4wR1OXZG9wTN06KfEbod/7J15eB3e zpuCdCRoO5JRoWFvmwWWh07jRtgmCkrRfcoSu4c90d+dJEvieFrK+/JEWdGY3b51Ou7I 5QhW8Qw/8z2dYgCa6U7+C2QRcmOQbMPEPjSq8MevJhj/KLt8hAaq59F+X431ZTx5cwQ6 nuwpn9YHXv4iDUMuXZMy433FeserX9TjHKB8Kr79pqMi9bzCpNSzgQ6KAWEvUti9ic4w Bz8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=XMe6Nuu+iTvqzeZiuvRWhDHMIR+3SjRekw5KCFT+jC0=; b=Ukbeme/yWhEuMAIK45wWdRwAIV8gijqPqvRsPvDucezi0Ulqw2QjEO0qKWOLqSWz1y JCJU4aPSTrME5Cmt5A8kMt88R07tqSXgzTDL2iEzXTydS2W+giMWJ6onpDHNzoNkFARY T2jbWgxV+4nKwOAbS5VrzV+FrX4V11eGMNp7wWnzS8aaJTBONJeHhGURdkK7mMQB+3dZ Tfd2SOywogIBfapzsg1jDEt0I/YFYmdic2c57pAnMiiHV/d+CF30o4+sKrQaoyPAPbDU udv2sJysZCMRmiL6RWo54p6u4APhKt2r2k7fsS83qkmkWpdu11sQeZWyI4AkYuIugehe ALkA== X-Gm-Message-State: AE9vXwPQlSvZAixGAuzOyuGpCv13FlABwwykOEiH1Yib5zOOsVQp09AkqiwNHzrXFz5BWg== X-Received: by 10.36.3.201 with SMTP id e192mr19684795ite.34.1473022059058; Sun, 04 Sep 2016 13:47:39 -0700 (PDT) Original-Received: from zony ([45.2.7.130]) by smtp.googlemail.com with ESMTPSA id v7sm8182491ita.9.2016.09.04.13.47.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 04 Sep 2016 13:47:38 -0700 (PDT) In-Reply-To: <947c6384-eeb3-475b-be8d-2277d0f799af@default> (Drew Adams's message of "Sat, 3 Sep 2016 22:43:54 -0700 (PDT)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122941 Archived-At: --=-=-= Content-Type: text/plain tags 21091 - notabug found 21091 25.1 quit Drew Adams 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. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=v2-0001-Don-t-require-isearch-update-before-isearch-done.patch Content-Description: patch v2 >From 2f00da3a255a2fb46ce4819a3153e04d9d9d59c9 Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--