Improve doom/describe-module

Opens module's README.org, if present, otherwise it prompts if you want
to browse the module's root.
This commit is contained in:
Henrik Lissner 2019-04-17 16:38:44 -04:00
parent 863fc1a6bb
commit 1136e9f49b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -193,9 +193,15 @@ current file is in, or d) the module associated with the current major mode (see
(intern (cadr key))))) (intern (cadr key)))))
(cl-check-type category symbol) (cl-check-type category symbol)
(cl-check-type module symbol) (cl-check-type module symbol)
(or (doom-module-p category module) (let ((path (doom-module-locate-path category module)))
(error "'%s %s' isn't a valid module" category module)) (unless (file-readable-p path)
(doom-project-browse (doom-module-path category module))) (error "'%s %s' isn't a valid module; it doesn't exist" category module))
(if-let* ((readme-path (doom-module-locate-path category module "README.org")))
(find-file readme-path)
(if (y-or-n-p (format "The '%s %s' module has no README file. Explore its directory?"
category module))
(doom-project-browse path)
(user-error "Aborted module lookup")))))
(defun doom--describe-package-insert-button (label path &optional regexp) (defun doom--describe-package-insert-button (label path &optional regexp)
(declare (indent defun)) (declare (indent defun))