home *** CD-ROM | disk | FTP | other *** search
- ;;;; texinfo-mode.jl -- Mode for editing Texinfo files
- ;;; 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.
-
- (provide 'texinfo-mode)
-
- (unless (boundp 'texinfo-keymap)
- (eval-hook 'texinfo-mode-hook)
- (setq
- texinfo-keymap (make-keylist)
- texinfo-custom-keymap (make-keylist))
- (bind-keys texinfo-keymap
- "ctrl-c" '(setq next-keymap-path '(texinfo-custom-keymap)))
- (bind-keys texinfo-custom-keymap
- "c" '(texinfo-insert-braces "@code")
- "d" '(texinfo-insert-braces "@dfn")
- "e" 'texinfo-insert-@end
- "f" '(texinfo-insert-braces "@file")
- "i" '(texinfo-insert "@item")
- "l" '(texinfo-insert "@lisp\n")
- "m" '(texinfo-insert "@menu\n")
- "ctrl-m" 'texinfo-insert-menu-item
- "n" 'texinfo-insert-@node
- "s" '(texinfo-insert-braces "@samp")
- "v" '(texinfo-insert-braces "@var")
- "{" 'texinfo-insert-braces
- "]" 'texinfo-move-over-braces
- "}" 'texinfo-move-over-braces))
-
- (defun texinfo-mode ()
- (eval-hook 'texinfo-mode-hook)
- (setq
- mode-name "Texinfo-mode"
- major-mode-kill 'texinfo-mode-kill
- paragraph-regexp "^@node"
- ctrl-c-keymap texinfo-keymap))
-
- (defun texinfo-mode-kill ()
- (setq
- mode-name nil
- ctrl-c-keymap nil))
-
- (defun texinfo-insert-@end ()
- (insert "@end"))
-
- (defun texinfo-insert (string)
- (insert string))
-
- (defun texinfo-insert-@node ()
- (insert "@node ")
- (let
- ((tmp (prompt "Node name: ")))
- (when tmp
- (insert tmp)
- (when (setq tmp (prompt "Next node: "))
- (insert ", ")
- (insert tmp)
- (when (setq tmp (prompt "Previous node: "))
- (insert ", ")
- (insert tmp)
- (when (setq tmp (prompt "Up node: "))
- (insert ", ")
- (insert tmp)))))))
-
- (defun texinfo-insert-braces (&optional command)
- (when command
- (insert command))
- (insert "{}")
- (goto-prev-char))
-
- (defun texinfo-move-over-braces ()
- (goto (next-char (find-next-char ?}))))
-
- (defun texinfo-insert-menu-item ()
- (let
- ((tmp (prompt "Item node: ")))
- (when tmp
- (insert (concat "* " tmp "::")))))
-