APROPOS, APROPOS-LIST and HELP* are now case sensitive.

This commit is contained in:
jgarcia 2006-06-17 16:06:59 +00:00
parent fd2e23eefa
commit a581d3ea31
5 changed files with 35 additions and 57 deletions

View file

@ -132,6 +132,8 @@ ECL 0.9i
- The compiler is slightly faster by avoiding use of EVAL.
- APROPOS, APROPOS-LIST and EXT:HELP* are now case insensitive.
* MOP compatibility:
- SLOT-VALUE, SLOT-BOUNDP, etc, together with MOP SLOT*-USING-CLASS generic

View file

@ -187,7 +187,7 @@ Welcome to ECL. Here are the few functions you should learn first.
(QUIT) ends the current ECL session.
For the precise language specification, refere to Guy Steele's \"Common Lisp,
For the precise language specification, refer to Guy Steele's \"Common Lisp,
the Language\" and our \"ECL Manual\". \"ECL Dictionary\", the hard-copied
version of ECL online documentation, will be useful as a handbook.
@ -195,15 +195,6 @@ Good luck!
"
(print-doc symbol))
(defun help* (string &optional (package (find-package "CL")))
"Args: (string &optional (package-spec 'lisp))
ECL specific.
Prints the documentation associated with those symbols in the specified
package whose print names contain STRING as substring. STRING may be a
symbol, in which case the print-name of that symbol is used. If PACKAGE is
NIL, then all packages are searched."
(apropos-doc string package))
;;; Pretty-print-formats.
;;;
;;; The number N as the property of a symbol SYMBOL indicates that,

View file

@ -540,20 +540,20 @@ inspect commands, or type '?' to the inspector."
(format t "~&No documentation for ~:@(~S~)." symbol))
(values))))
(defun apropos-doc (string &optional (package "CL") &aux (f nil))
(setq string (string string))
(if package
(do-symbols (symbol package)
(when (search string (string symbol) :test #'char-equal)
(setq f (or (print-doc symbol t) f))))
(do-all-symbols (symbol)
(when (search string (string symbol) :test #'char-equal)
(setq f (or (print-doc symbol t) f)))))
(if f
(format t "~&-----------------------------------------------------------------------------")
(format t "~&No documentation for ~S in ~:[any~;~A~] package."
string package
(and package (package-name (coerce-to-package package)))))
(defun help* (string &optional (package "CL"))
"Args: (string &optional (package-spec 'lisp))
ECL specific.
Prints the documentation associated with those symbols in the specified
package whose print names contain STRING as substring. STRING may be a
symbol, in which case the print-name of that symbol is used. If PACKAGE is
NIL, then all packages are searched."
(do* ((f nil)
(l (apropos-list string package) (cdr l)))
((endp l)
(format t (if f
"~&-----------------------------------------------------------------------------"
"~&No documentation for ~S in ~:[any~;~A~] package.")
string package (and package (package-name (coerce-to-package package)))))
(when (print-doc (first l) t)
(setf f t)))
(values))
;(provide 'describe)

View file

@ -12,7 +12,6 @@
"src:lsp;helpfile.lsp"
"src:lsp;evalmacros.lsp"
"src:lsp;autoload.lsp"
"src:lsp;describe.lsp"
"src:lsp;setf.lsp"
"src:lsp;predlib.lsp"
"src:lsp;seq.lsp"
@ -37,6 +36,7 @@
#+tk
"src:lsp;tk-init.lsp"
"build:lsp;config.lsp"
"src:lsp;describe.lsp"
"src:lsp;module.lsp"
"src:lsp;cmdline.lsp"
"src:lsp;top.lsp"

View file

@ -150,39 +150,24 @@ to NIL) and returns all values."
Prints those symbols whose print-names contain STRING as substring. If
PACKAGE is non-NIL, then only the specified PACKAGE is searched."
(setq string (string string))
(cond (package
(do-symbols (symbol package)
(when (search string (string symbol))
(print-symbol-apropos symbol)))
(do ((p (package-use-list package) (cdr p)))
((null p))
(do-external-symbols (symbol (car p))
(when (search string (string symbol))
(print-symbol-apropos symbol)))))
(t
(do-all-symbols (symbol)
(when (search string (string symbol))
(print-symbol-apropos symbol)))))
(mapc #'print-symbol-apropos (apropos-list string package))
(values))
(defun apropos-list (string &optional package &aux list)
(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."
(setq list nil)
(setq string (string string))
(cond (package
(do-symbols (symbol package)
(when (search string (string symbol))
(setq list (cons symbol list))))
(do ((p (package-use-list package) (cdr p)))
((null p))
(do-symbols (symbol (car p))
(when (search string (string symbol))
(setq list (cons symbol list))))))
(t
(do-all-symbols (symbol)
(when (search string (string symbol))
(setq list (cons symbol list))))))
list)
(let* ((list '())
(string (string string)))
(cond (package
(dolist (p (package-use-list package))
(setf list (nconc (apropos-list string p) list)))
(do-symbols (symbol package)
(when (search string (string symbol) :test #'char-equal)
(setq list (cons symbol list)))))
(t
(do-all-symbols (symbol)
(when (search string (string symbol) :test #'char-equal)
(setq list (cons symbol list))))))
list))