changeset 545:ea6956f10ce7 dev

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 071cd0ab1c71
files yatex.el yatexflt.el
diffstat 2 files changed, 38 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/yatex.el	Sat Jun 02 10:39:58 2018 +0900
+++ b/yatex.el	Sat Jun 02 15:57:55 2018 +0900
@@ -1,6 +1,6 @@
 ;;; yatex.el --- Yet Another tex-mode for emacs //–ì’¹// -*- coding: sjis -*-
 ;;; (c)1991-2018 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Fri Jun  1 08:30:26 2018 on firestorm
+;;; Last modified Sat Jun  2 14:13:17 2018 on firestorm
 ;;; $Id$
 ;;; The latest version of this software is always available at;
 ;;; https://www.yatex.org/
@@ -1955,8 +1955,9 @@
 
 (defun YaTeX-goto-corresponding-file (&optional other)
   "Visit or switch buffer of corresponding file,
-looking at \\input or \\include or \\includeonly on current line."
-  (if (not (YaTeX-on-includes-p)) nil
+looking at \\input or \\include or \\includeonly or %#SRC{} on current line."
+  (cond
+   ((YaTeX-on-includes-p)
     (let ((parent buffer-file-name) input-file b)
       (save-excursion
 	(if (and (re-search-forward "[{%]" (point-end-of-line) t)
@@ -1975,7 +1976,12 @@
        (t (YaTeX-switch-to-buffer input-file)))
       (or (YaTeX-get-builtin "!")
 	  YaTeX-parent-file
-	  (setq YaTeX-parent-file parent)))))
+	  (setq YaTeX-parent-file parent))))
+   ;; On %#SRC{somefilters.src}
+   ((YaTeX-on-SRC-p)
+    (let ((src (YaTeX-match-string 1)))
+      (if other (YaTeX-switch-to-buffer-other-window src)
+	(goto-buffer-window (find-file-noselect src)))))))
 
 (defun YaTeX-goto-corresponding-BEGIN-END ()
   (if (not (YaTeX-on-BEGIN-END-p)) nil
@@ -2273,6 +2279,13 @@
       (re-search-forward
        "\\(%#BEGIN\\)\\|\\(%#END\\)" (point-end-of-line) t))))
 
+(defun YaTeX-on-SRC-p ()
+  (save-excursion
+    (let ((case-fold-search nil))
+      (beginning-of-line)
+      (re-search-forward
+       "%#SRC{\\([^}]+\\)}" (point-end-of-line) t))))
+
 (defun YaTeX-goto-corresponding-* (arg)
   "Parse current line and call suitable function."
   (interactive "P")
--- a/yatexflt.el	Sat Jun 02 10:39:58 2018 +0900
+++ b/yatexflt.el	Sat Jun 02 15:57:55 2018 +0900
@@ -1,7 +1,7 @@
 ;;; yatexflt.el --- YaTeX filter command utilizer -*- coding: sjis -*-
 ;;; 
 ;;; (c)1993-2018 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Fri Jun  1 08:28:40 2018 on firestorm
+;;; Last modified Sat Jun  2 15:55:38 2018 on firestorm
 ;;; $Id$
 
 ;;; Commentary:
@@ -307,7 +307,8 @@
   (put 'YaTeX-filter-filter-sentinel 'outfile nil)
   ;; begend-info is from YaTeX-in-BEGEND-p: (BEG END ARGS)
   (let ((b (car begend-info)) (e (nth 1 begend-info))
-	(r (YaTeX-filter-parse-filter-region begend-info)))
+	(r (YaTeX-filter-parse-filter-region begend-info))
+	insmark)
     (save-excursion
       (if r (let*((case-fold-search t)
 		  (outfile (cdr (assq 'outfile r)))
@@ -352,9 +353,16 @@
 		    (erase-buffer)
 		    (insert (format "Starting process `%s'...\n" newcmdline))
 		    (set-marker (process-mark proc) (point-max))
+		    (setq insmark (point-max))
 		    (cond
 		     (text
-		      (process-send-string proc text)
+		      (process-send-string
+		       proc
+		       (if source
+			   (progn
+			     (insert-file-contents-literally source)
+			     (YaTeX-buffer-substring insmark (point-max)))
+			 text))
 		      (process-send-string proc "\n")
 		      (process-send-eof proc)	;Notify stream chunk end
 		      (process-send-eof proc)))	;Notify real EOF
@@ -384,12 +392,16 @@
 		    f (or cmdargs "")
 		    (if in-line "\\if0\n===\n" "")))
     (save-excursion
-      (insert (if in-line
-		  (cond (template-text
-			 (concat template-text
-				 (or (string-match "\n$" template-text) "\n")))
-			(t "\n"))
-		(format "%%#SRC{%s}\n" ifile))))))
+      (insert
+       (format "%%#%% If you call program in yatex-mode, type `%se'\n"
+	       (key-description
+		(car (where-is-internal 'YaTeX-typeset-menu))))
+       (if in-line
+	   (cond (template-text
+		  (concat template-text
+			  (or (string-match "\n$" template-text) "\n")))
+		 (t "\n"))
+	 (format "%%#SRC{%s}\n" ifile))))))
 
 (provide 'yatexflt)
 

yatex.org