From: Richard M. Stallman Date: Sun, 29 Dec 1996 19:41:52 +0000 (+0000) Subject: (tex-first-line-header-regexp): New variable. X-Git-Tag: emacs-20.1~3167 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=725b742881c44f70e8122bb924e04f7ecc2e0236;p=emacs.git (tex-first-line-header-regexp): New variable. (tex-region): Sometimes include the file's first line. --- 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 @@ -41,6 +41,13 @@ You can make this `/tmp' if your TEXINPUTS has no relative directories in it 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. @@ -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