aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helpful.el2
-rw-r--r--test/unit-test.el11
2 files changed, 13 insertions, 0 deletions
diff --git a/helpful.el b/helpful.el
index a378a7f..9861da7 100644
--- a/helpful.el
+++ b/helpful.el
@@ -732,6 +732,8 @@ POSITION-HEADS takes the form ((123 (defun foo)) (456 (defun bar)))."
state of the current symbol."
(interactive)
(cl-assert (not (null helpful--sym)))
+ (unless (buffer-live-p helpful--associated-buffer)
+ (setq helpful--associated-buffer nil))
(let* ((inhibit-read-only t)
(start-line (line-number-at-pos))
(start-column (current-column))
diff --git a/test/unit-test.el b/test/unit-test.el
index e36f6df..2c1388b 100644
--- a/test/unit-test.el
+++ b/test/unit-test.el
@@ -195,3 +195,14 @@ buffers lying around."
;; Don't crash on large plists using keywords.
(helpful--pretty-print
'(:foo foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo :bar bar)))
+
+(ert-deftest helpful-update-after-killing-buf ()
+ "If we originally looked at a variable in a specific buffer,
+and that buffer has been killed, handle it gracefully."
+ ;; Don't crash if the underlying buffer has been killed.
+ (let (helpful-buf)
+ (with-temp-buffer
+ (helpful-variable 'tab-width)
+ (setq helpful-buf (current-buffer)))
+ (with-current-buffer helpful-buf
+ (helpful-update))))