2017-06-08 11:47:56 +02:00
|
|
|
;;; core/autoload/help.el -*- lexical-binding: t; -*-
|
2017-05-27 14:31:08 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun doom/describe-setting (setting)
|
|
|
|
"Open the documentation of SETTING (a keyword defined with `def-setting!')."
|
|
|
|
(interactive
|
|
|
|
;; TODO try to read setting from whole line
|
2017-06-14 20:47:00 +02:00
|
|
|
(list (completing-read "Describe setting%s: "
|
|
|
|
(mapcar #'car doom-settings)
|
|
|
|
nil t nil nil)))
|
|
|
|
(let ((fn (cdr (assq (intern setting) doom-settings))))
|
2017-05-27 14:31:08 +02:00
|
|
|
(unless fn
|
|
|
|
(error "'%s' is not a valid DOOM setting" setting))
|
|
|
|
(describe-function fn)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun doom/describe-module (module)
|
|
|
|
"Open the documentation of MODULE (a string that represents the category and
|
|
|
|
submodule in the format, e.g. ':feature evil')."
|
|
|
|
(interactive
|
|
|
|
;; TODO try to read module from whole line
|
|
|
|
(list (completing-read "Describe module: "
|
2017-06-14 20:47:00 +02:00
|
|
|
(cl-loop for (module . sub) in (reverse (hash-table-keys doom-modules))
|
|
|
|
collect (format "%s %s" module sub))
|
2017-05-27 14:31:08 +02:00
|
|
|
nil t)))
|
2017-06-25 02:04:50 +02:00
|
|
|
(cl-destructuring-bind (category submodule)
|
2017-06-14 20:47:00 +02:00
|
|
|
(mapcar #'intern (split-string module " "))
|
2017-05-27 14:31:08 +02:00
|
|
|
(unless (member (cons category submodule) (doom--module-pairs))
|
|
|
|
(error "'%s' isn't a valid module" module))
|
|
|
|
(let ((doc-path (expand-file-name "README.org" (doom-module-path category submodule))))
|
|
|
|
(unless (file-exists-p doc-path)
|
|
|
|
(error "There is no documentation for this module"))
|
|
|
|
(find-file doc-path))))
|