From 765231c00c9da4426ed07abc911f80828faa0349 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 6 Aug 2019 12:59:29 +0100 Subject: [PATCH] doc/list-exports.lisp (pretty-symbol-name): Don't hide strange symbol names. The old code just squashed the symbol name to lowercase and printed it. This hides symbol names which already have lowercase letters in them, or funny characters like colons. We don't actually have any such names. --- doc/list-exports.lisp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/list-exports.lisp b/doc/list-exports.lisp index c47a500..bc40e95 100755 --- a/doc/list-exports.lisp +++ b/doc/list-exports.lisp @@ -221,15 +221,33 @@ (and (eq sym symbol) (eq how :external))))) +(defun downcase-or-escape (name) + (if (every (lambda (char) + (or (upper-case-p char) + (digit-char-p char) + (member char '(#\% #\+ #\- #\* #\/ #\= #\[ #\] #\?)))) + name) + (string-downcase name) + (with-output-to-string (out) + (write-char #\| out) + (map nil (lambda (char) + (when (or (char= char #\|) + (char= char #\\)) + (write-char #\\ out)) + (write-char char out)) + name) + (write-char #\| out)))) + (defun pretty-symbol-name (symbol package) (let ((pkg (symbol-package symbol)) (exportp (exported-symbol-p symbol))) - (format nil "~(~:[~A:~:[:~;~]~;~2*~]~A~)" + (format nil "~:[~A:~:[:~;~]~;~2*~]~A" (and exportp (eq pkg package)) (cond ((keywordp symbol) "") ((eq pkg nil) "#") - (t (best-package-name pkg))) - (or exportp (null pkg)) (symbol-name symbol)))) + (t (downcase-or-escape (best-package-name pkg)))) + (or exportp (null pkg)) + (downcase-or-escape (symbol-name symbol))))) (deftype interesting-class () '(or standard-class -- 2.11.0