branch: externals/devdocs
commit a433fab92f1b3deaa97aecb6287d23653d3dfcf5
Author: Augusto Stoffel <arstof...@gmail.com>
Commit: Augusto Stoffel <arstof...@gmail.com>

    Allow calling devdocs-install with a document slug as argument
---
 devdocs.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/devdocs.el b/devdocs.el
index 8cb3e2fc96..b4fe3b2e8f 100644
--- a/devdocs.el
+++ b/devdocs.el
@@ -199,10 +199,15 @@ DOC is a document metadata alist."
 ;;;###autoload
 (defun devdocs-install (doc)
   "Download and install DevDocs documentation.
-DOC is a document metadata alist."
+DOC is a document slug or metadata alist.  If the document is
+already installed, reinstall it."
   (interactive (list (devdocs--read-document "Install documentation: " nil t)))
   (make-directory devdocs-data-dir t)
-  (let* ((slug (alist-get 'slug doc))
+  (let* ((doc (or (listp doc)
+                  (seq-find (lambda (it) (string= doc (alist-get 'slug it)))
+                            (devdocs--available-docs))
+                  (user-error "No such document: %s" doc)))
+         (slug (alist-get 'slug doc))
          (mtime (alist-get 'mtime doc))
          (temp (make-temp-file "devdocs-" t))
          pages)

Reply via email to