forked from EnigmaCurry/emacs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ryan-lisp-helpers.el
32 lines (29 loc) · 1.14 KB
/
ryan-lisp-helpers.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(defun describe-hash (variable &optional buffer)
"Display the full documentation of VARIABLE (a symbol).
Returns the documentation as a string, also.
If VARIABLE has a buffer-local value in BUFFER (default to the current buffer),
it is displayed along with the global value."
(interactive
(let ((v (variable-at-point))
(enable-recursive-minibuffers t)
val)
(setq val (completing-read
(if (and (symbolp v)
(hash-table-p (symbol-value v)))
(format
"Describe hash-map (default %s): " v)
"Describe hash-map: ")
obarray
(lambda (atom) (and (boundp atom)
(hash-table-p (symbol-value atom))))
t nil nil
(if (hash-table-p v) (symbol-name v))))
(list (if (equal val "")
v (intern val)))))
(with-output-to-temp-buffer (help-buffer)
(maphash (lambda (key value)
(pp key)
(princ " => ")
(pp value)
(terpri))
(symbol-value variable))))