home *** CD-ROM | disk | FTP | other *** search
- ;;;; help.jl -- Online help system
- ;;; Copyright (C) 1993, 1994 John Harper <jsh@ukc.ac.uk>
-
- ;;; This file is part of Jade.
-
- ;;; Jade 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.
-
- ;;; Jade 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 Jade; see the file COPYING. If not, write to
- ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-
- (setq
- help-buffer (make-buffer "*Help*")
- help-keymap (make-keylist))
- (set-buffer-special help-buffer t)
-
- (bind-keys help-keymap
- "a" 'apropos-function
- "e" 'apropos-variable
- "f" 'describe-function
- "h" 'help-help
- "ctrl-h" 'help-help
- "i" 'info
- "ctrl-i" '(info t)
- "m" 'describe-mode
- "?" 'help-help
- "v" 'describe-variable)
-
- (defun help ()
- (title "Type: a f h i m v -- h for more help")
- (setq next-keymap-path (cons help-keymap nil)))
-
- (defun help-help ()
- (clear-buffer help-buffer)
- (insert
- "\nHelp mode -- Type one of the following:\n
- a `apropos-function'
- Search for functions which match a regular expression.
- f `describe-function'
- View the documentation for a particular function.
- h `help-help'
- Display this text.
- i `info'
- Enter the info hypertext viewer.
- m `describe-mode'
- Show the documentation for the edit mode of the current buffer.
- v `describe-variable'
- View the documentation and value of a variable."
- (pos 1 1) help-buffer)
- (goto-buffer help-buffer)
- (goto (pos 1 1))
- (help))
-
- (defun apropos-function (&optional regexp)
- (or regexp
- (setq regexp (prompt "Regular Expression: "))
- (return))
- (clear-buffer help-buffer)
- (format help-buffer "Apropos for expression %S:\n" regexp)
- (print (apropos regexp 'fboundp) help-buffer)
- (goto-buffer help-buffer)
- (goto (pos 1 1)))
-
- (defun apropos-variable (&optional regexp)
- (or regexp
- (setq regexp (prompt "Regular Expression: "))
- (return))
- (clear-buffer help-buffer)
- (format help-buffer "Apropos for expression %S:\n" regexp)
- (print (apropos regexp 'boundp) help-buffer)
- (goto help-buffer)
- (goto (pos 1 1)))
-
- (defun describe-function (&optional fun &aux doc)
- (or fun
- (setq fun (prompt-for-function))
- (return))
- (setq doc (documentation fun))
- (clear-buffer help-buffer)
- (format help-buffer "\n%s\n" (or doc "undocumented."))
- (goto-buffer help-buffer)
- (goto (pos 1 1)))
-
- (defun describe-variable (&optional var &aux doc)
- (or var
- (setq var (prompt-for-variable))
- (return))
- (setq doc (documentation var t))
- (clear-buffer help-buffer)
- (format (cons help-buffer t) "\nsymbol name: %s\ncurrent value: %S\n\n%s\n" (symbol-name var) (symbol-value var) (or doc "undocumented."))
- (goto-buffer help-buffer)
- (goto (pos 1 1)))
-
- (defun describe-mode ()
- (goto-buffer help-buffer)
- (clear-buffer)
- (let
- ((doc (documentation major-mode)))
- (when (stringp doc)
- (format help-buffer "\n%s\n" mode-documentation)
- (goto (pos 1 1)))))
-