1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
;; describe.jl --
;; $Id: describe.jl,v 1.11 2002/04/21 04:52:14 jsh Exp $
;; Copyright (C) 2000 John Harper <john@dcs.warwick.ac.uk>
;; This file is part of sawmill.
;; sawmill is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; sawmill is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with sawmill; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
(define-structure sawfish.wm.commands.describe
(export describe-symbol
apropos-function
apropos-variable)
(open rep
rep.lang.doc
sawfish.wm.commands)
(define-structure-alias describe sawfish.wm.commands.describe)
(define (describe-symbol fun)
"Display the documentation of a specified symbol."
(describe-value (symbol-value fun t) fun)
(format standard-output "\n%s\n"
(or (documentation fun nil (symbol-value fun t)) "Undocumented.")))
;;###autoload
(define-command 'describe-symbol describe-symbol
#:spec "SSymbol:" #:class 'advanced)
(define-command-to-screen 'describe-symbol-to-screen describe-symbol
#:spec "SSymbol:" #:class 'advanced)
(define (apropos-output symbols)
(let ((separator (make-string 72 ?-)))
(mapc (lambda (sym)
(write standard-output separator)
(write standard-output #\newline)
(describe-symbol sym)) symbols)))
(define (apropos-function regexp #!optional all-functions)
(format standard-output "Apropos %s `%s':\n\n"
(if all-functions "function" "command") regexp)
(apropos-output (apropos regexp (if all-functions
(lambda (s)
(and (boundp s)
(functionp (symbol-value s))))
commandp))))
;;###autoload
(define-command 'apropos-function apropos-function
#:spec "sApropos functions:\nP" #:class 'advanced)
(define-command-to-screen 'apropos-function-to-screen apropos-function
#:spec "sApropos functions:\nP" #:class 'advanced)
(define (apropos-variable regexp)
(format standard-output "Apropos variable `%s':\n" regexp)
(apropos-output (apropos regexp boundp)))
;;###autoload
(define-command 'apropos-variable apropos-variable
#:spec "sApropos variables:" #:class 'advanced)
(define-command-to-screen 'apropos-variable-to-screen apropos-variable
#:spec "sApropos variables:" #:class 'advanced))
|