From 1136e9f49b9655c6ce633270ea12faad1227a0ef Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 17 Apr 2019 16:38:44 -0400 Subject: [PATCH] Improve doom/describe-module Opens module's README.org, if present, otherwise it prompts if you want to browse the module's root. --- core/autoload/help.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/autoload/help.el b/core/autoload/help.el index 8b04e3356..feba3d080 100644 --- a/core/autoload/help.el +++ b/core/autoload/help.el @@ -193,9 +193,15 @@ current file is in, or d) the module associated with the current major mode (see (intern (cadr key))))) (cl-check-type category symbol) (cl-check-type module symbol) - (or (doom-module-p category module) - (error "'%s %s' isn't a valid module" category module)) - (doom-project-browse (doom-module-path category module))) + (let ((path (doom-module-locate-path category module))) + (unless (file-readable-p path) + (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) (declare (indent defun))