aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2019-03-13 00:31:02 +0000
committerWilfred Hughes <me@wilfred.me.uk>2019-03-13 00:31:54 +0000
commitd155add4af76df4b342250dec7ced57f58400465 (patch)
treeb2f07eb2020908ea0b000b1b6dd52664c4264809
parenta102f46361a41798d8f7ef429f244bb7a81a5868 (diff)
Consider after-change-functions to be a hook
-rw-r--r--CHANGELOG.md3
-rw-r--r--helpful.el16
2 files changed, 15 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b2d4866..77d9da0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,9 @@
Fixed a minor docstring formatting issue when keymap references were
on their own line.
+Symbols of the form `foo-functions` (e.g. `after-change-functions`)
+are now rendered as hooks.
+
# v0.16
Improved wording when looking at aliases.
diff --git a/helpful.el b/helpful.el
index ce1abe1..fb82ecd 100644
--- a/helpful.el
+++ b/helpful.el
@@ -1935,6 +1935,16 @@ may contain duplicates."
(when (autoloadp fn-obj)
(autoload-do-load fn-obj)))))
+(defun helpful--hook-p (symbol value)
+ "Does SYMBOL look like a hook?"
+ (and
+ (or
+ (s-ends-with-p "-hook" (symbol-name symbol))
+ ;; E.g. `after-change-functions', which can be used with
+ ;; `add-hook'.
+ (s-ends-with-p "-functions" (symbol-name symbol)))
+ (consp value)))
+
(defun helpful-update ()
"Update the current *Helpful* buffer to the latest
state of the current symbol."
@@ -1990,8 +2000,7 @@ state of the current symbol."
(multiple-views-p
(or (stringp val)
(keymapp val)
- (and (s-ends-with-p "-hook" (symbol-name sym))
- (consp val)))))
+ (helpful--hook-p sym val))))
(insert
(helpful--heading
(cond
@@ -2022,8 +2031,7 @@ state of the current symbol."
;; links to the commands bound.
((keymapp val)
(helpful--format-keymap val))
- ((and (s-ends-with-p "-hook" (symbol-name sym))
- (consp val))
+ ((helpful--hook-p sym val)
(helpful--format-hook val))
(t
(helpful--pretty-print val)))