# HG changeset patch # User yuuji # Date 774208440 0 # Node ID 1ce952ad9c24789057a1ebc98673b52646896f77 # Parent 433b27a1101987d8678df3d45b0001a8a31160bc Save excursion when getting %#BEGIN through %#END and the line of %#REQUIRE. diff -r 433b27a11019 -r 1ce952ad9c24 yatexprc.el --- a/yatexprc.el Thu Jul 14 17:49:36 1994 +0000 +++ b/yatexprc.el Thu Jul 14 17:54:00 1994 +0000 @@ -2,7 +2,7 @@ ;;; YaTeX process handler. ;;; yatexprc.el ;;; (c )1993-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Sat Jul 9 18:24:42 1994 on figaro +;;; Last modified Thu Jul 14 21:00:27 1994 on figaro ;;; $Id$ (require 'yatex) @@ -137,31 +137,32 @@ (buffer (current-buffer)) opoint preamble (subpreamble "") main reg-begin reg-end) - (if (search-backward "%#BEGIN" nil t) - (progn - (setq typeout "--- Region from BEGIN to " - end "the end of the buffer ---" - reg-begin (match-end 0)) - (if (search-forward "%#END" nil t) - (setq reg-end (match-beginning 0) - end "END ---") - (setq reg-end (point-max)))) - (setq typeout "=== Region from (point) to (mark) ===") - (setq reg-begin (point) reg-end (mark))) - (goto-char (point-min)) - (while (search-forward "%#REQUIRE" nil t) - (setq subpreamble - (concat subpreamble - (cond - ((eolp) - (buffer-substring - (match-beginning 0) - (point-beginning-of-line))) - (t (buffer-substring - (match-end 0) - (point-end-of-line)))) - "\n")) - (goto-char (match-end 0))) + (save-excursion + (if (search-backward "%#BEGIN" nil t) + (progn + (setq typeout "--- Region from BEGIN to " + end "the end of the buffer ---" + reg-begin (match-end 0)) + (if (search-forward "%#END" nil t) + (setq reg-end (match-beginning 0) + end "END ---") + (setq reg-end (point-max)))) + (setq typeout "=== Region from (point) to (mark) ===") + (setq reg-begin (point) reg-end (mark))) + (goto-char (point-min)) + (while (search-forward "%#REQUIRE" nil t) + (setq subpreamble + (concat subpreamble + (cond + ((eolp) + (buffer-substring + (match-beginning 0) + (point-beginning-of-line))) + (t (buffer-substring + (match-end 0) + (point-end-of-line)))) + "\n")) + (goto-char (match-end 0)))) (YaTeX-visit-main t) (setq main (current-buffer)) (setq opoint (point))