yatex

changeset 38:1ce952ad9c24

Save excursion when getting %#BEGIN through %#END and the line of %#REQUIRE.
author yuuji
date Thu, 14 Jul 1994 17:54:00 +0000
parents 433b27a11019
children 261fcd6d4ad7
files yatexprc.el
diffstat 1 files changed, 27 insertions(+), 26 deletions(-) [+]
line diff
     1.1 --- a/yatexprc.el	Thu Jul 14 17:49:36 1994 +0000
     1.2 +++ b/yatexprc.el	Thu Jul 14 17:54:00 1994 +0000
     1.3 @@ -2,7 +2,7 @@
     1.4  ;;; YaTeX process handler.
     1.5  ;;; yatexprc.el
     1.6  ;;; (c )1993-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
     1.7 -;;; Last modified Sat Jul  9 18:24:42 1994 on figaro
     1.8 +;;; Last modified Thu Jul 14 21:00:27 1994 on figaro
     1.9  ;;; $Id$
    1.10  
    1.11  (require 'yatex)
    1.12 @@ -137,31 +137,32 @@
    1.13  	 (buffer (current-buffer)) opoint preamble (subpreamble "") main
    1.14  	 reg-begin reg-end)
    1.15  
    1.16 -      (if (search-backward "%#BEGIN" nil t)
    1.17 -	  (progn
    1.18 -	    (setq typeout "--- Region from BEGIN to "
    1.19 -		  end "the end of the buffer ---"
    1.20 -		  reg-begin (match-end 0))
    1.21 -	    (if (search-forward "%#END" nil t)
    1.22 -		(setq reg-end (match-beginning 0)
    1.23 -		      end "END ---")
    1.24 -	      (setq reg-end (point-max))))
    1.25 -	(setq typeout "=== Region from (point) to (mark) ===")
    1.26 -	(setq reg-begin (point) reg-end (mark)))
    1.27 -      (goto-char (point-min))
    1.28 -      (while (search-forward "%#REQUIRE" nil t)
    1.29 -	(setq subpreamble
    1.30 -	      (concat subpreamble
    1.31 -		      (cond
    1.32 -		       ((eolp)
    1.33 -			(buffer-substring
    1.34 -			 (match-beginning 0)
    1.35 -			 (point-beginning-of-line)))
    1.36 -		       (t (buffer-substring
    1.37 -			   (match-end 0)
    1.38 -			   (point-end-of-line))))
    1.39 -		      "\n"))
    1.40 -	(goto-char (match-end 0)))
    1.41 +      (save-excursion
    1.42 +	(if (search-backward "%#BEGIN" nil t)
    1.43 +	    (progn
    1.44 +	      (setq typeout "--- Region from BEGIN to "
    1.45 +		    end "the end of the buffer ---"
    1.46 +		    reg-begin (match-end 0))
    1.47 +	      (if (search-forward "%#END" nil t)
    1.48 +		  (setq reg-end (match-beginning 0)
    1.49 +			end "END ---")
    1.50 +		(setq reg-end (point-max))))
    1.51 +	  (setq typeout "=== Region from (point) to (mark) ===")
    1.52 +	  (setq reg-begin (point) reg-end (mark)))
    1.53 +	(goto-char (point-min))
    1.54 +	(while (search-forward "%#REQUIRE" nil t)
    1.55 +	  (setq subpreamble
    1.56 +		(concat subpreamble
    1.57 +			(cond
    1.58 +			 ((eolp)
    1.59 +			  (buffer-substring
    1.60 +			   (match-beginning 0)
    1.61 +			   (point-beginning-of-line)))
    1.62 +			 (t (buffer-substring
    1.63 +			     (match-end 0)
    1.64 +			     (point-end-of-line))))
    1.65 +			"\n"))
    1.66 +	  (goto-char (match-end 0))))
    1.67        (YaTeX-visit-main t)
    1.68        (setq main (current-buffer))
    1.69        (setq opoint (point))