diff --git a/src/CHANGELOG b/src/CHANGELOG index ea534295b..6dee4ea45 100755 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -56,6 +56,8 @@ ECL 12.2.2: etc, which correspond to the POSIX C constants INT_MAX, INT_MIN, LONG_MAX, and similar ones. + - APROPOS-LIST no longer returns duplicate symbols. + * Windows: - ECL guesses whether the input / output / error streams are consoles. If diff --git a/src/lsp/packlib.lsp b/src/lsp/packlib.lsp index 232901f94..2102c0f84 100644 --- a/src/lsp/packlib.lsp +++ b/src/lsp/packlib.lsp @@ -156,16 +156,22 @@ PACKAGE is non-NIL, then only the specified PACKAGE is searched." (mapc #'print-symbol-apropos (apropos-list string package)) (values)) - (defun apropos-list (string &optional package) "Args: (string &optional (package nil)) Returns a list of all symbols whose print-names contain STRING as substring. If PACKAGE is non-NIL, then only the specified PACKAGE is searched." + (sort (delete-duplicates (apropos-list-inner string package)) + #'(lambda (s1 s2) + (string-lessp (prin1-to-string s1) + (prin1-to-string s2))))) + +(defun apropos-list-inner (string package) + (declare (si::c-local)) (let* ((list '()) (string (string string))) (cond (package (dolist (p (package-use-list package)) - (setf list (nconc (apropos-list string p) list))) + (setf list (nconc (apropos-list-inner string p) list))) (do-symbols (symbol package) (when (search string (string symbol) :test #'char-equal) (setq list (cons symbol list)))))