diff options
| author | Richard M. Stallman | 1998-03-09 06:36:25 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-03-09 06:36:25 +0000 |
| commit | 9bd4f69c5df4a6206b680a04fc9482826ab6a3e6 (patch) | |
| tree | 6fde8669c80ee44b039d6400c2d1c6f40b1762c3 | |
| parent | 693caa7142a5174ea7db5ef260055a2f4978c6e1 (diff) | |
| download | emacs-9bd4f69c5df4a6206b680a04fc9482826ab6a3e6.tar.gz emacs-9bd4f69c5df4a6206b680a04fc9482826ab6a3e6.zip | |
(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.
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index f599c581540..8da1916fff8 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -565,6 +565,8 @@ subshell is initiated, `tex-shell-hook' is run." | |||
| 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 |
| @@ -638,6 +640,12 @@ Entering SliTeX mode runs the hook `text-mode-hook', then the hook | |||
| 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 | ||
| @@ -879,6 +887,21 @@ A prefix arg inhibits the checking." | |||
| 879 | (save-excursion | 887 | (save-excursion |
| 880 | (insert ?}))) | 888 | (insert ?}))) |
| 881 | 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)) | ||
| 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. |