aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/evil-extract-docstrings28
1 files changed, 27 insertions, 1 deletions
diff --git a/scripts/evil-extract-docstrings b/scripts/evil-extract-docstrings
index 9e636b6..72a9198 100755
--- a/scripts/evil-extract-docstrings
+++ b/scripts/evil-extract-docstrings
@@ -7,6 +7,27 @@
(require 'json)
(require 'help)
+(defun keymap-funcs (map)
+ (let (funcs)
+ (dolist (elt (cdr map))
+ (when (consp elt)
+ (cond
+ ((and (cdr elt) (symbolp (cdr elt)))
+ (push (cdr elt) funcs))
+ ((keymapp (cdr elt))
+ (setq funcs (append (keymap-funcs (cdr elt)) funcs))))))
+ funcs))
+
+(defun keymap-bindings (map)
+ (let ((funcs (keymap-funcs map))
+ bindings)
+ (dolist (func funcs)
+ (unless (memq func '(undefined))
+ ;; (push (cons func (key-description (where-is-internal func map t))) bindings)
+ ;; (message (format "%s %s" func (key-description (where-is-internal func map t))))
+ (push (cons func (key-description (where-is-internal func map t))) bindings)))
+ bindings))
+
(with-temp-file (format "%s../doc/docstringdb.json" cur-path)
(let (vars)
(mapatoms
@@ -15,6 +36,8 @@
(let ((default (car (get sym 'standard-value))))
(while (and (consp default) (memq (car default) '(function quote)))
(setq default (cadr default)))
+ ;; (when (and (boundp sym) (keymapp (symbol-value sym)))
+ ;; (message (format "%S" sym)))
(push `(,sym (default . ,(cond
((consp default) (format "%S" default))
((symbolp default) (symbol-name default))
@@ -25,6 +48,9 @@
(fn-docstring . ,(ignore-errors (documentation sym 'raw)))
(arglist . ,(help-function-arglist sym))
(functionp . ,(functionp sym))
- (macrop . ,(macrop sym)))
+ (macrop . ,(macrop sym))
+ (keymap-inv . ,(and (boundp sym)
+ (keymapp (symbol-value sym))
+ (keymap-bindings (symbol-value sym)))))
vars)))))
(insert (json-encode vars))))