aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2019-02-16 17:27:42 +0000
committerWilfred Hughes <me@wilfred.me.uk>2019-02-16 17:30:05 +0000
commit2d23a267b316adcd7754ab1fbb4154b9cb2bfbcb (patch)
tree0f6dd26b0e5c8924676d538b58d1a625350c578a
parentb80701b193bddfffdacd2ab065749cc63d0e45d0 (diff)
Fix viewing the value of inhibit-read-only
Fixes #189
-rw-r--r--CHANGELOG.md2
-rw-r--r--helpful.el8
-rw-r--r--test/helpful-unit-test.el5
3 files changed, 13 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6b93c9f..7b3f402 100644
--- 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
index 6d76942..1d1cad3 100644
--- 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
index cff43fc..756bc76 100644
--- 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))))