Micro refactor

This commit is contained in:
Tom Willemse 2013-12-28 17:03:16 +01:00
parent 4297d6955a
commit 6006120614

View file

@ -166,6 +166,13 @@ See the docstring for `edocs--module-name' for more information."
(package-desc-summary package-info) (package-desc-summary package-info)
(aref package-info 2))) (aref package-info 2)))
(defun edocs--normalize (docs)
"Make sure DOCS is a properly formatted list."
(if (or (not (listp docs))
(not (listp (cdr docs))))
(list docs)
docs))
(defun edocs--format-symbol (symbol) (defun edocs--format-symbol (symbol)
"Format the information in SYMBOL." "Format the information in SYMBOL."
(let ((docs (edocs--get-docs (car symbol) (cdr symbol)))) (let ((docs (edocs--get-docs (car symbol) (cdr symbol))))
@ -182,10 +189,7 @@ See the docstring for `edocs--module-name' for more information."
(edocs--with-tag "p" nil (edocs--with-tag "p" nil
(insert (or (edocs--format-doc doc) (insert (or (edocs--format-doc doc)
"Not documented.")))))) "Not documented."))))))
(if (or (not (listp docs)) (edocs--normalize docs))))
(not (listp (cdr docs))))
(list docs)
docs))))
(defun edocs-generate () (defun edocs-generate ()
"Generate nice-looking documentation for a module or file." "Generate nice-looking documentation for a module or file."