From: Artur Malabarba Date: Fri, 30 Oct 2015 11:04:50 +0000 (+0000) Subject: * lisp/isearch.el: Avoid an error that blocks isearch X-Git-Tag: emacs-25.0.90~966 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=25be5df44a7c4e67e365b428a424e9dd957f2687;p=emacs.git * 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. --- diff --git a/lisp/isearch.el b/lisp/isearch.el index e9eec013580..b762884945e 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 00000000000..d60c229c8f7 --- /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 + +;; 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 . + +;;; 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