emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 25be5df: * lisp/isearch.el: Avoid an error that blo


From: Artur Malabarba
Subject: [Emacs-diffs] master 25be5df: * lisp/isearch.el: Avoid an error that blocks isearch
Date: Fri, 30 Oct 2015 10:09:38 +0000

branch: master
commit 25be5df44a7c4e67e365b428a424e9dd957f2687
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    * lisp/isearch.el: Avoid an error that blocks isearch
    
    (isearch-update): Don't error if `isearch--current-buffer' has
    been killed.
    
    * test/automated/isearch-tests.el (isearch--test-update): New
    file.
---
 lisp/isearch.el                 |    2 +-
 test/automated/isearch-tests.el |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index e9eec01..b762884 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -954,7 +954,7 @@ used to set the value of `isearch-regexp-function'."
   "This is called after every isearch command to update the display.
 The last thing it does is to run `isearch-update-post-hook'."
   (unless (eq (current-buffer) isearch--current-buffer)
-    (when isearch--current-buffer
+    (when (buffer-live-p isearch--current-buffer)
       (with-current-buffer isearch--current-buffer
         (setq cursor-sensor-inhibit (delq 'isearch cursor-sensor-inhibit))))
     (setq isearch--current-buffer (current-buffer))
diff --git a/test/automated/isearch-tests.el b/test/automated/isearch-tests.el
new file mode 100644
index 0000000..d60c229
--- /dev/null
+++ b/test/automated/isearch-tests.el
@@ -0,0 +1,32 @@
+;;; isearch-tests.el --- Tests for isearch.el        -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
+
+;; Author: Artur Malabarba <address@hidden>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+
+(ert-deftest isearch--test-update ()
+  (with-temp-buffer
+    (setq isearch--current-buffer (current-buffer)))
+  (with-temp-buffer
+    (isearch-update)
+    (should (equal isearch--current-buffer (current-buffer)))))
+
+(provide 'isearch-tests)
+;;; isearch-tests.el ends here



reply via email to

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