summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-10-30 11:04:50 +0000
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-10-30 11:08:57 +0000
commit25be5df44a7c4e67e365b428a424e9dd957f2687 (patch)
tree83935a4f355c393701062e33be0149107e7fb127
parent44470fed6f720792b2d91b907c52ce30559d03e7 (diff)
* 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.
-rw-r--r--lisp/isearch.el2
-rw-r--r--test/automated/isearch-tests.el32
2 files changed, 33 insertions, 1 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index e9eec01358..b762884945 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 0000000000..d60c229c8f
--- /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 <bruce.connor.am@gmail.com>
+
+;; 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