texinfo.el 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ;; Major mode for editing texinfo files.
  2. ;; Copyright (C) 1985 Free Software Foundation, Inc.
  3. ;; This file is part of GNU Emacs.
  4. ;; GNU Emacs is distributed in the hope that it will be useful,
  5. ;; but WITHOUT ANY WARRANTY. No author or distributor
  6. ;; accepts responsibility to anyone for the consequences of using it
  7. ;; or for whether it serves any particular purpose or works at all,
  8. ;; unless he says so in writing. Refer to the GNU Emacs General Public
  9. ;; License for full details.
  10. ;; Everyone is granted permission to copy, modify and redistribute
  11. ;; GNU Emacs, but only under the conditions described in the
  12. ;; GNU Emacs General Public License. A copy of this license is
  13. ;; supposed to have been given to you along with GNU Emacs so you
  14. ;; can know your rights and responsibilities. It should be in a
  15. ;; file named COPYING. Among other things, the copyright notice
  16. ;; and this notice must be preserved on all copies.
  17. (defvar texinfo-mode-syntax-table nil)
  18. (if texinfo-mode-syntax-table
  19. nil
  20. (setq texinfo-mode-syntax-table (make-syntax-table))
  21. (modify-syntax-entry ?\" " " texinfo-mode-syntax-table)
  22. (modify-syntax-entry ?\\ " " texinfo-mode-syntax-table)
  23. (modify-syntax-entry ?@ "\\" texinfo-mode-syntax-table)
  24. (modify-syntax-entry ?\^q "\\" texinfo-mode-syntax-table)
  25. (modify-syntax-entry ?\[ "(]" texinfo-mode-syntax-table)
  26. (modify-syntax-entry ?\] ")[" texinfo-mode-syntax-table)
  27. (modify-syntax-entry ?{ "(}" texinfo-mode-syntax-table)
  28. (modify-syntax-entry ?} "){" texinfo-mode-syntax-table)
  29. (modify-syntax-entry ?\' "w" texinfo-mode-syntax-table))
  30. (defun texinfo-mode ()
  31. "Major mode for editing texinfo files.
  32. These are files that are input for TEX and also to be turned
  33. into Info files by \\[texinfo-format-buffer].
  34. These files must be written in a very restricted and
  35. modified version of TEX input format.
  36. As for editing commands, like text-mode except for syntax table,
  37. which is set up so expression commands skip texinfo bracket groups."
  38. (interactive)
  39. (text-mode)
  40. (setq mode-name "Texinfo")
  41. (setq major-mode 'texinfo-mode)
  42. (set-syntax-table texinfo-mode-syntax-table)
  43. (make-local-variable 'require-final-newline)
  44. (setq require-final-newline t)
  45. (make-local-variable 'paragraph-separate)
  46. (setq paragraph-separate (concat "^\b\\|^@[a-z]*[ \n]\\|" paragraph-separate))
  47. (make-local-variable 'paragraph-start)
  48. (setq paragraph-start (concat "^\b\\|^@[a-z]*[ \n]\\|" paragraph-start))
  49. (make-local-variable 'fill-column)
  50. (setq fill-column 75)
  51. (run-hooks 'text-mode-hook 'texinfo-mode-hook))