summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-03-09 06:36:25 +0000
committerRichard M. Stallman <rms@gnu.org>1998-03-09 06:36:25 +0000
commit9bd4f69c5df4a6206b680a04fc9482826ab6a3e6 (patch)
tree6fde8669c80ee44b039d6400c2d1c6f40b1762c3 /lisp/textmodes
parent693caa7142a5174ea7db5ef260055a2f4978c6e1 (diff)
downloademacs-9bd4f69c5df4a6206b680a04fc9482826ab6a3e6.tar.gz
(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.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/tex-mode.el23
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."
(setq imenu-create-index-function 'latex-imenu-create-index)
(make-local-variable 'tex-face-alist)
(setq tex-face-alist tex-latex-face-alist)
+ (make-local-variable 'fill-nobreak-predicate)
+ (setq fill-nobreak-predicate 'latex-fill-nobreak-predicate)
(run-hooks 'text-mode-hook 'tex-mode-hook 'latex-mode-hook))
;;;###autoload
@@ -638,6 +640,12 @@ Entering SliTeX mode runs the hook `text-mode-hook', then the hook
\\\\[a-z]*space[ \t]*$\\|\\\\[a-z]*skip[ \t]*$\\|\
\\\\newpage[ \t]*$\\|\\\\[a-z]*page[a-z]*[ \t]*$\\|\\\\footnote[ \t]*$\\|\
\\\\marginpar[ \t]*$\\|\\\\parbox[ \t]*$\\|\\\\caption[ \t]*$")
+ (make-local-variable 'imenu-create-index-function)
+ (setq imenu-create-index-function 'latex-imenu-create-index)
+ (make-local-variable 'tex-face-alist)
+ (setq tex-face-alist tex-latex-face-alist)
+ (make-local-variable 'fill-nobreak-predicate)
+ (setq fill-nobreak-predicate 'latex-fill-nobreak-predicate)
(run-hooks
'text-mode-hook 'tex-mode-hook 'latex-mode-hook 'slitex-mode-hook))
@@ -879,6 +887,21 @@ A prefix arg inhibits the checking."
(save-excursion
(insert ?})))
+;; This function is used as the value of fill-nobreak-predicate
+;; in LaTeX mode. Its job is to prevent line-breaking inside
+;; of a \verb construct.
+(defun latex-fill-nobreak-predicate ()
+ (let ((opoint (point))
+ inside)
+ (save-excursion
+ (save-restriction
+ (beginning-of-line)
+ (narrow-to-region (point) opoint)
+ (while (re-search-forward "\\\\verb\\(.\\)" nil t)
+ (unless (re-search-forward (regexp-quote (match-string 1)) nil t)
+ (setq inside t)))))
+ inside))
+
;;; Like tex-insert-braces, but for LaTeX.
(define-skeleton tex-latex-block
"Create a matching pair of lines \\begin[OPT]{NAME} and \\end{NAME} at point.