From b10d405a207d1d1fd94469007aa2e4ce5d950cd2 Mon Sep 17 00:00:00 2001 From: vindarel Date: Tue, 27 Sep 2022 14:44:07 +0200 Subject: [PATCH] more-docstrings: fix when symbol has no docstring (loop) --- ciel.asd | 2 +- src/more-docstrings/README.md | 7 ++----- src/more-docstrings/docstrings.lisp | 3 ++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ciel.asd b/ciel.asd index ee4bdb1..d7ed529 100644 --- a/ciel.asd +++ b/ciel.asd @@ -122,7 +122,7 @@ :description "CIEL Is an Extended Lisp.") (asdf:defsystem "ciel/repl" - :depends-on (;; :ciel ;; don't, it will re-load its components files and re-apply their side effects (docstrings.lisp). + :depends-on (;; :ciel ;; let's avoid, it could run side effects twice (like a defparameter set then reset). ;; deps :cl-readline :cffi ;; "tmp", for cl-readline add history diff --git a/src/more-docstrings/README.md b/src/more-docstrings/README.md index 4e76a9d..d28ea54 100644 --- a/src/more-docstrings/README.md +++ b/src/more-docstrings/README.md @@ -35,9 +35,6 @@ https://lispcookbook.github.io/cl-cookbook/iteration.html and that's it. To be continued. -A couple gotchas though: +A gotcha though: -- if we quickload the package twice, the docstrings -are appended twice too :S The hash-table cache doesn't help in that -case. -- we are modifying the symbols in the :cl package. +- we are modifying the symbols in the :cl package, there is currently no way to "undo" these additions. diff --git a/src/more-docstrings/docstrings.lisp b/src/more-docstrings/docstrings.lisp index 406f6be..02c9c51 100644 --- a/src/more-docstrings/docstrings.lisp +++ b/src/more-docstrings/docstrings.lisp @@ -37,7 +37,8 @@ case. (let ((doc (documentation symbol doc-type))) (setf (gethash symbol *docstrings-cache*) - doc) + ;; don't store a NIL docstring. + (or doc "")) doc)))) (defun docstring-append (symbol s &optional (doc-type 'function))