yatex

diff yatexflt.el @ 545:ea6956f10ce7

When %#SRC specified, should send content of that file.
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 02 Jun 2018 15:57:55 +0900
parents ab6c176c676a
children 826b0766f6ba
line diff
     1.1 --- a/yatexflt.el	Sat Jun 02 10:39:58 2018 +0900
     1.2 +++ b/yatexflt.el	Sat Jun 02 15:57:55 2018 +0900
     1.3 @@ -1,7 +1,7 @@
     1.4  ;;; yatexflt.el --- YaTeX filter command utilizer -*- coding: sjis -*-
     1.5  ;;; 
     1.6  ;;; (c)1993-2018 by HIROSE Yuuji.[yuuji@yatex.org]
     1.7 -;;; Last modified Fri Jun  1 08:28:40 2018 on firestorm
     1.8 +;;; Last modified Sat Jun  2 15:55:38 2018 on firestorm
     1.9  ;;; $Id$
    1.10  
    1.11  ;;; Commentary:
    1.12 @@ -307,7 +307,8 @@
    1.13    (put 'YaTeX-filter-filter-sentinel 'outfile nil)
    1.14    ;; begend-info is from YaTeX-in-BEGEND-p: (BEG END ARGS)
    1.15    (let ((b (car begend-info)) (e (nth 1 begend-info))
    1.16 -	(r (YaTeX-filter-parse-filter-region begend-info)))
    1.17 +	(r (YaTeX-filter-parse-filter-region begend-info))
    1.18 +	insmark)
    1.19      (save-excursion
    1.20        (if r (let*((case-fold-search t)
    1.21  		  (outfile (cdr (assq 'outfile r)))
    1.22 @@ -352,9 +353,16 @@
    1.23  		    (erase-buffer)
    1.24  		    (insert (format "Starting process `%s'...\n" newcmdline))
    1.25  		    (set-marker (process-mark proc) (point-max))
    1.26 +		    (setq insmark (point-max))
    1.27  		    (cond
    1.28  		     (text
    1.29 -		      (process-send-string proc text)
    1.30 +		      (process-send-string
    1.31 +		       proc
    1.32 +		       (if source
    1.33 +			   (progn
    1.34 +			     (insert-file-contents-literally source)
    1.35 +			     (YaTeX-buffer-substring insmark (point-max)))
    1.36 +			 text))
    1.37  		      (process-send-string proc "\n")
    1.38  		      (process-send-eof proc)	;Notify stream chunk end
    1.39  		      (process-send-eof proc)))	;Notify real EOF
    1.40 @@ -384,12 +392,16 @@
    1.41  		    f (or cmdargs "")
    1.42  		    (if in-line "\\if0\n===\n" "")))
    1.43      (save-excursion
    1.44 -      (insert (if in-line
    1.45 -		  (cond (template-text
    1.46 -			 (concat template-text
    1.47 -				 (or (string-match "\n$" template-text) "\n")))
    1.48 -			(t "\n"))
    1.49 -		(format "%%#SRC{%s}\n" ifile))))))
    1.50 +      (insert
    1.51 +       (format "%%#%% If you call program in yatex-mode, type `%se'\n"
    1.52 +	       (key-description
    1.53 +		(car (where-is-internal 'YaTeX-typeset-menu))))
    1.54 +       (if in-line
    1.55 +	   (cond (template-text
    1.56 +		  (concat template-text
    1.57 +			  (or (string-match "\n$" template-text) "\n")))
    1.58 +		 (t "\n"))
    1.59 +	 (format "%%#SRC{%s}\n" ifile))))))
    1.60  
    1.61  (provide 'yatexflt)
    1.62