--- src/scheme/session.scm 2004-05-07 14:50:23.000000000 +0100 +++ /usr/share/guile/1.6/ice-9/session.scm 2003-08-29 21:26:15.000000000 +0100 @@ -1,4 +1,4 @@ -;;;; Copyright (C) 1997, 2000, 2001, 2004 Free Software Foundation, Inc. +;;;; Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc. ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -45,35 +45,12 @@ :use-module (ice-9 documentation) :use-module (ice-9 regex) :use-module (ice-9 rdelim) - :export (help add-value-help-handler! remove-value-help-handler! - apropos apropos-internal apropos-fold apropos-fold-accessible - apropos-fold-exported apropos-fold-all source arity - system-module)) + :export (help apropos apropos-internal apropos-fold + apropos-fold-accessible apropos-fold-exported apropos-fold-all + source arity system-module)) -(define *value-help-handlers* '()) - -(define (add-value-help-handler! proc) - "Adds a handler for performing `help' on a value. - -`proc' will be called with the value as an argument. `proc' should -return #t to indicate that it has performed help, a string to override -the default object documentation, or #f to try the other handlers, -potentially falling back on the normal behavior for `help'." - (set! *value-help-handlers* (cons proc *value-help-handlers*))) - -(define (remove-value-help-handler! proc) - "Removes a handler for performing `help' on a value. - -See the documentation for `add-value-help-handler' for more -information." - (set! *value-help-handlers* (delete! proc *value-help-handlers*))) - -(define (try-value-help value) - (or-map (lambda (proc) (proc value)) *value-help-handlers*)) - - ;;; Documentation ;;; (define help @@ -108,12 +85,10 @@ ((and (list? name) (= (length name) 2) (eq? (car name) 'unquote)) - (let ((value (local-eval (cadr name) env))) - (cond ((try-value-help value) - => noop) - ((object-documentation value) - => write-line) - (else (not-found 'documentation (cadr name)))))) + (cond ((object-documentation + (local-eval (cadr name) env)) + => write-line) + (else (not-found 'documentation (cadr name))))) ;; (quote SYMBOL) ((and (list? name) @@ -159,8 +134,7 @@ (let ((entries (apropos-fold (lambda (module name object data) (cons (list module name - (or (try-value-help object) - (object-documentation object)) + (object-documentation object) (cond ((closure? object) "a procedure") ((procedure? object) @@ -186,28 +160,22 @@ #f "~S: ~S\n" (module-name (module entry)) (name entry)))) - (cond - ((eq? (doc entry) #t) - ;; a value help handler has already handled - ;; this entry -- don't do anything - #t) - ((doc entry) - (set! documented-entries - (cons entry-summary documented-entries)) - ;; *fixme*: set up a handler in goops.scm - ;; to use `describe' - (set! documentations - (cons (simple-format - #f "`~S' is ~A in the ~S module.\n\n~A\n" - (name entry) - (type entry) - (module-name (module entry)) - (doc entry)) - documentations))) - (else - (set! undocumented-entries - (cons entry-summary - undocumented-entries)))))) + (if (doc entry) + (begin + (set! documented-entries + (cons entry-summary documented-entries)) + ;; *fixme*: Use `describe' when we have GOOPS? + (set! documentations + (cons (simple-format + #f "`~S' is ~A in the ~S module.\n\n~A\n" + (name entry) + (type entry) + (module-name (module entry)) + (doc entry)) + documentations))) + (set! undocumented-entries + (cons entry-summary + undocumented-entries))))) entries) (if (and (not (null? documented-entries)) @@ -528,5 +496,4 @@ (string-append "Module " (symbol->string (module-name m)) " is now a " (if s "system" "user") " module.")))))) -;;; arch-tag: 5348c264-6261-4b1e-b29d-c19bb0fbc94e ;;; session.scm ends here