aboutsummaryrefslogtreecommitdiff
path: root/helpful.el
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2018-06-18 23:27:17 +0100
committerWilfred Hughes <me@wilfred.me.uk>2018-06-18 23:27:17 +0100
commit1a3779f25a70d368d0b22c9218d7b4189867909d (patch)
tree2a3ed319b04dd3a2a1be4b9e36ebf4d400044906 /helpful.el
parentd4b316d0af522098d97128fcc4ea9f79d64eb339 (diff)
Handle references to non-existent keymaps in docstrings
Fixes #110.
Diffstat (limited to 'helpful.el')
-rw-r--r--helpful.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/helpful.el b/helpful.el
index 9f94fd6..338124a 100644
--- a/helpful.el
+++ b/helpful.el
@@ -805,12 +805,17 @@ unescaping too."
(rx "\\{" (group (+ (not (in "}")))) "}"))
(let* ((symbol-with-parens (match-string 0))
(symbol-name (match-string 1))
- (keymap (symbol-value (intern symbol-name))))
+ (keymap
+ ;; Gracefully handle variables not being defined.
+ (ignore-errors
+ (symbol-value (intern symbol-name)))))
;; Remove the original string.
(delete-region (point)
(+ (point) (length symbol-with-parens)))
- (insert
- (helpful--format-keymap keymap))))
+ (if keymap
+ (insert (helpful--format-keymap keymap))
+ (insert (format "Keymap %s is not currently defined."
+ symbol-name)))))
((looking-at
;; Text of the form \\[foo-command]
(rx "\\[" (group (+ (not (in "]")))) "]"))