yatex

diff yatex.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 e7356faf50df
line diff
     1.1 --- a/yatex.el	Sat Jun 02 10:39:58 2018 +0900
     1.2 +++ b/yatex.el	Sat Jun 02 15:57:55 2018 +0900
     1.3 @@ -1,6 +1,6 @@
     1.4  ;;; yatex.el --- Yet Another tex-mode for emacs //–ì’¹// -*- coding: sjis -*-
     1.5  ;;; (c)1991-2018 by HIROSE Yuuji.[yuuji@yatex.org]
     1.6 -;;; Last modified Fri Jun  1 08:30:26 2018 on firestorm
     1.7 +;;; Last modified Sat Jun  2 14:13:17 2018 on firestorm
     1.8  ;;; $Id$
     1.9  ;;; The latest version of this software is always available at;
    1.10  ;;; https://www.yatex.org/
    1.11 @@ -1955,8 +1955,9 @@
    1.12  
    1.13  (defun YaTeX-goto-corresponding-file (&optional other)
    1.14    "Visit or switch buffer of corresponding file,
    1.15 -looking at \\input or \\include or \\includeonly on current line."
    1.16 -  (if (not (YaTeX-on-includes-p)) nil
    1.17 +looking at \\input or \\include or \\includeonly or %#SRC{} on current line."
    1.18 +  (cond
    1.19 +   ((YaTeX-on-includes-p)
    1.20      (let ((parent buffer-file-name) input-file b)
    1.21        (save-excursion
    1.22  	(if (and (re-search-forward "[{%]" (point-end-of-line) t)
    1.23 @@ -1975,7 +1976,12 @@
    1.24         (t (YaTeX-switch-to-buffer input-file)))
    1.25        (or (YaTeX-get-builtin "!")
    1.26  	  YaTeX-parent-file
    1.27 -	  (setq YaTeX-parent-file parent)))))
    1.28 +	  (setq YaTeX-parent-file parent))))
    1.29 +   ;; On %#SRC{somefilters.src}
    1.30 +   ((YaTeX-on-SRC-p)
    1.31 +    (let ((src (YaTeX-match-string 1)))
    1.32 +      (if other (YaTeX-switch-to-buffer-other-window src)
    1.33 +	(goto-buffer-window (find-file-noselect src)))))))
    1.34  
    1.35  (defun YaTeX-goto-corresponding-BEGIN-END ()
    1.36    (if (not (YaTeX-on-BEGIN-END-p)) nil
    1.37 @@ -2273,6 +2279,13 @@
    1.38        (re-search-forward
    1.39         "\\(%#BEGIN\\)\\|\\(%#END\\)" (point-end-of-line) t))))
    1.40  
    1.41 +(defun YaTeX-on-SRC-p ()
    1.42 +  (save-excursion
    1.43 +    (let ((case-fold-search nil))
    1.44 +      (beginning-of-line)
    1.45 +      (re-search-forward
    1.46 +       "%#SRC{\\([^}]+\\)}" (point-end-of-line) t))))
    1.47 +
    1.48  (defun YaTeX-goto-corresponding-* (arg)
    1.49    "Parse current line and call suitable function."
    1.50    (interactive "P")