home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / util / jade-3.0.lha / Jade / lisp / texinfo-mode.jl < prev    next >
Encoding:
Text File  |  1994-04-16  |  2.7 KB  |  94 lines

  1. ;;;; texinfo-mode.jl -- Mode for editing Texinfo files
  2. ;;;  Copyright (C) 1993, 1994 John Harper <jsh@ukc.ac.uk>
  3.  
  4. ;;; This file is part of Jade.
  5.  
  6. ;;; Jade is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 2, or (at your option)
  9. ;;; any later version.
  10.  
  11. ;;; Jade is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ;;; GNU General Public License for more details.
  15.  
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with Jade; see the file COPYING.  If not, write to
  18. ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. (provide 'texinfo-mode)
  21.  
  22. (unless (boundp 'texinfo-keymap)
  23.   (eval-hook 'texinfo-mode-hook)
  24.   (setq
  25.     texinfo-keymap (make-keylist)
  26.     texinfo-custom-keymap (make-keylist))
  27.   (bind-keys texinfo-keymap
  28.     "ctrl-c" '(setq next-keymap-path '(texinfo-custom-keymap)))
  29.   (bind-keys texinfo-custom-keymap
  30.     "c" '(texinfo-insert-braces "@code")
  31.     "d" '(texinfo-insert-braces "@dfn")
  32.     "e" 'texinfo-insert-@end
  33.     "f" '(texinfo-insert-braces "@file")
  34.     "i" '(texinfo-insert "@item")
  35.     "l" '(texinfo-insert "@lisp\n")
  36.     "m" '(texinfo-insert "@menu\n")
  37.     "ctrl-m" 'texinfo-insert-menu-item
  38.     "n" 'texinfo-insert-@node
  39.     "s" '(texinfo-insert-braces "@samp")
  40.     "v" '(texinfo-insert-braces "@var")
  41.     "{" 'texinfo-insert-braces
  42.     "]" 'texinfo-move-over-braces
  43.     "}" 'texinfo-move-over-braces))
  44.  
  45. (defun texinfo-mode ()
  46.   (eval-hook 'texinfo-mode-hook)
  47.   (setq
  48.     mode-name "Texinfo-mode"
  49.     major-mode-kill 'texinfo-mode-kill
  50.     paragraph-regexp "^@node"
  51.     ctrl-c-keymap texinfo-keymap))
  52.  
  53. (defun texinfo-mode-kill ()
  54.   (setq
  55.     mode-name nil
  56.     ctrl-c-keymap nil))
  57.  
  58. (defun texinfo-insert-@end ()
  59.   (insert "@end"))
  60.  
  61. (defun texinfo-insert (string)
  62.   (insert string))
  63.  
  64. (defun texinfo-insert-@node ()
  65.   (insert "@node ")
  66.   (let
  67.       ((tmp (prompt "Node name: ")))
  68.     (when tmp
  69.       (insert tmp)
  70.       (when (setq tmp (prompt "Next node: "))
  71.     (insert ", ")
  72.     (insert tmp)
  73.     (when (setq tmp (prompt "Previous node: "))
  74.       (insert ", ")
  75.       (insert tmp)
  76.       (when (setq tmp (prompt "Up node: "))
  77.         (insert ", ")
  78.         (insert tmp)))))))
  79.  
  80. (defun texinfo-insert-braces (&optional command)
  81.   (when command
  82.     (insert command))
  83.   (insert "{}")
  84.   (goto-prev-char))
  85.  
  86. (defun texinfo-move-over-braces ()
  87.   (goto (next-char (find-next-char ?}))))
  88.  
  89. (defun texinfo-insert-menu-item ()
  90.   (let
  91.       ((tmp (prompt "Item node: ")))
  92.     (when tmp
  93.       (insert (concat "* " tmp "::")))))
  94.