summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-12-29 19:41:52 +0000
committerRichard M. Stallman <rms@gnu.org>1996-12-29 19:41:52 +0000
commitaa67bd119fbb5a9bac9e824cbd0df2cb8b42cac1 (patch)
tree95e9f10b784ab94828ad651dd03b4cdb26d968e2
parent25e7232217174bdd30e0e29b226243bb02067a4e (diff)
downloademacs-aa67bd119fbb5a9bac9e824cbd0df2cb8b42cac1.tar.gz
(tex-first-line-header-regexp): New variable.
(tex-region): Sometimes include the file's first line.
-rw-r--r--lisp/textmodes/tex-mode.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 4f19edcdc2f..c20c6b9f18d 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -42,6 +42,13 @@ and you don't try to apply \\[tex-region] or \\[tex-buffer] when there are
`\\input' commands with relative directories.")
;;;###autoload
+(defvar tex-first-line-header-regexp nil
+ "Regexp for matching a first line which `tex-region' should include.
+If this is non-nil, it should be a regular expression string;
+if it matches the first line of the file,
+`tex-region' always includes the first line in the TeX run.")
+
+;;;###autoload
(defvar tex-main-file nil
"*The main TeX source file which includes this buffer's file.
The command `tex-buffer' runs TeX on `tex-main-file'if that is non-nil.")
@@ -1010,6 +1017,14 @@ The value of `tex-command' specifies the command to use to run TeX."
(hbeg (point-min)) (hend (point-min))
(default-directory zap-directory))
(goto-char (point-min))
+
+ ;; Maybe copy first line, such as `\input texinfo', to temp file.
+ (and tex-first-line-header-regexp
+ (looking-at tex-first-line-header-regexp)
+ (write-region (point)
+ (progn (forward-line 1) (point))
+ tex-out-file nil nil))
+
;; Initialize the temp file with either the header or nothing
(if (re-search-forward tex-start-of-header search-end t)
(progn