commit 2d23a267b316adcd7754ab1fbb4154b9cb2bfbcb
parent b80701b193bddfffdacd2ab065749cc63d0e45d0
Author: Wilfred Hughes <me@wilfred.me.uk>
Date: Sat, 16 Feb 2019 17:27:42 +0000
Fix viewing the value of inhibit-read-only
Fixes #189
Diffstat:
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -4,6 +4,8 @@ Improved wording when looking at aliases.
Fixed several issues for symbols that contain spaces.
+Fixed an issue when viewing `inhibit-read-only`.
+
# v0.15
Fixed a crash on formatting values.
diff --git a/helpful.el b/helpful.el
@@ -1846,7 +1846,12 @@ state of the current symbol."
(cl-assert (not (null helpful--sym)))
(unless (buffer-live-p helpful--associated-buffer)
(setq helpful--associated-buffer nil))
- (-let* ((inhibit-read-only t)
+ (-let* ((val
+ ;; Look at the value before setting `inhibit-read-only', so
+ ;; users can see the correct value of that variable.
+ (unless helpful--callable-p
+ (helpful--sym-value helpful--sym helpful--associated-buffer)))
+ (inhibit-read-only t)
(start-line (line-number-at-pos))
(start-column (current-column))
(primitive-p (helpful--primitive-p helpful--sym helpful--callable-p))
@@ -1885,7 +1890,6 @@ state of the current symbol."
(when (not helpful--callable-p)
(helpful--insert-section-break)
(let* ((sym helpful--sym)
- (val (helpful--sym-value sym helpful--associated-buffer))
(multiple-views-p
(or (stringp val)
(keymapp val)
diff --git a/test/helpful-unit-test.el b/test/helpful-unit-test.el
@@ -842,3 +842,8 @@ find the source code."
(should (helpful--autoloaded-p 'rx-to-string buf))
(when opened
(kill-buffer buf))))
+
+(ert-deftest helpful--inhibit-read-only ()
+ (helpful-variable 'inhibit-read-only)
+ (should
+ (s-contains-p "Value\nnil" (buffer-string))))