comparison lisp/textmodes/tex-mode.el @ 21121:dd5c2baa6674

(latex-mode): Set fill-nobreak-predicate. (slitex-mode): Set fill-nobreak-predicate, tex-face-alist, and imenu-create-index-function. (latex-fill-nobreak-predicate): New function.
author Richard M. Stallman <rms@gnu.org>
date Mon, 09 Mar 1998 06:36:25 +0000
parents f1a4588c8075
children 7d4a55d38b2c
comparison
equal deleted inserted replaced
21120:116fb3c03737 21121:dd5c2baa6674
563 \\\\marginpar\\|\\\\parbox\\|\\\\caption\\)[ \t]*\\($\\|%\\)") 563 \\\\marginpar\\|\\\\parbox\\|\\\\caption\\)[ \t]*\\($\\|%\\)")
564 (make-local-variable 'imenu-create-index-function) 564 (make-local-variable 'imenu-create-index-function)
565 (setq imenu-create-index-function 'latex-imenu-create-index) 565 (setq imenu-create-index-function 'latex-imenu-create-index)
566 (make-local-variable 'tex-face-alist) 566 (make-local-variable 'tex-face-alist)
567 (setq tex-face-alist tex-latex-face-alist) 567 (setq tex-face-alist tex-latex-face-alist)
568 (make-local-variable 'fill-nobreak-predicate)
569 (setq fill-nobreak-predicate 'latex-fill-nobreak-predicate)
568 (run-hooks 'text-mode-hook 'tex-mode-hook 'latex-mode-hook)) 570 (run-hooks 'text-mode-hook 'tex-mode-hook 'latex-mode-hook))
569 571
570 ;;;###autoload 572 ;;;###autoload
571 (defun slitex-mode () 573 (defun slitex-mode ()
572 "Major mode for editing files of input for SliTeX. 574 "Major mode for editing files of input for SliTeX.
636 \\\\paragraph\\>\\|\\\\subparagraph\\>\\|\ 638 \\\\paragraph\\>\\|\\\\subparagraph\\>\\|\
637 \\\\item[ \t]*$\\|\\\\bibitem[ \t]*$\\|\\\\newline[ \t]*$\\|\\\\noindent[ \t]*$\\|\ 639 \\\\item[ \t]*$\\|\\\\bibitem[ \t]*$\\|\\\\newline[ \t]*$\\|\\\\noindent[ \t]*$\\|\
638 \\\\[a-z]*space[ \t]*$\\|\\\\[a-z]*skip[ \t]*$\\|\ 640 \\\\[a-z]*space[ \t]*$\\|\\\\[a-z]*skip[ \t]*$\\|\
639 \\\\newpage[ \t]*$\\|\\\\[a-z]*page[a-z]*[ \t]*$\\|\\\\footnote[ \t]*$\\|\ 641 \\\\newpage[ \t]*$\\|\\\\[a-z]*page[a-z]*[ \t]*$\\|\\\\footnote[ \t]*$\\|\
640 \\\\marginpar[ \t]*$\\|\\\\parbox[ \t]*$\\|\\\\caption[ \t]*$") 642 \\\\marginpar[ \t]*$\\|\\\\parbox[ \t]*$\\|\\\\caption[ \t]*$")
643 (make-local-variable 'imenu-create-index-function)
644 (setq imenu-create-index-function 'latex-imenu-create-index)
645 (make-local-variable 'tex-face-alist)
646 (setq tex-face-alist tex-latex-face-alist)
647 (make-local-variable 'fill-nobreak-predicate)
648 (setq fill-nobreak-predicate 'latex-fill-nobreak-predicate)
641 (run-hooks 649 (run-hooks
642 'text-mode-hook 'tex-mode-hook 'latex-mode-hook 'slitex-mode-hook)) 650 'text-mode-hook 'tex-mode-hook 'latex-mode-hook 'slitex-mode-hook))
643 651
644 (defun tex-common-initialization () 652 (defun tex-common-initialization ()
645 (kill-all-local-variables) 653 (kill-all-local-variables)
876 "Make a pair of braces and be poised to type inside of them." 884 "Make a pair of braces and be poised to type inside of them."
877 (interactive "*") 885 (interactive "*")
878 (insert ?\{) 886 (insert ?\{)
879 (save-excursion 887 (save-excursion
880 (insert ?}))) 888 (insert ?})))
889
890 ;; This function is used as the value of fill-nobreak-predicate
891 ;; in LaTeX mode. Its job is to prevent line-breaking inside
892 ;; of a \verb construct.
893 (defun latex-fill-nobreak-predicate ()
894 (let ((opoint (point))
895 inside)
896 (save-excursion
897 (save-restriction
898 (beginning-of-line)
899 (narrow-to-region (point) opoint)
900 (while (re-search-forward "\\\\verb\\(.\\)" nil t)
901 (unless (re-search-forward (regexp-quote (match-string 1)) nil t)
902 (setq inside t)))))
903 inside))
881 904
882 ;;; Like tex-insert-braces, but for LaTeX. 905 ;;; Like tex-insert-braces, but for LaTeX.
883 (define-skeleton tex-latex-block 906 (define-skeleton tex-latex-block
884 "Create a matching pair of lines \\begin[OPT]{NAME} and \\end{NAME} at point. 907 "Create a matching pair of lines \\begin[OPT]{NAME} and \\end{NAME} at point.
885 Puts point on a blank line between them." 908 Puts point on a blank line between them."