yatex

changeset 350:91ba61bb536e dev

[prefix] g calls forward-search of previewers if -src is given to typesetting.
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 20 Dec 2014 20:30:33 +0900
parents b5bf68206bd1
children 0fc7ea5baa5f
files yatex.el yatex.new yatexprc.el
diffstat 3 files changed, 54 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/yatex.el	Sat Dec 20 14:57:53 2014 +0900
     1.2 +++ b/yatex.el	Sat Dec 20 20:30:33 2014 +0900
     1.3 @@ -1,6 +1,6 @@
     1.4  ;;; yatex.el --- Yet Another tex-mode for emacs //野鳥// -*- coding: sjis -*-
     1.5  ;;; (c)1991-2014 by HIROSE Yuuji.[yuuji@yatex.org]
     1.6 -;;; Last modified Fri Dec 19 07:46:21 2014 on firestorm
     1.7 +;;; Last modified Sat Dec 20 19:43:33 2014 on firestorm
     1.8  ;;; $Id$
     1.9  ;;; The latest version of this software is always available at;
    1.10  ;;; http://www.yatex.org/
    1.11 @@ -765,6 +765,7 @@
    1.12  (autoload 'YaTeX-get-builtin "yatexprc" "Get %# built-in." t)
    1.13  (autoload 'YaTeX-system "yatexprc" "Call system command" t)
    1.14  (autoload 'YaTeX-save-buffers "yatexprc" "Save buffers of same major mode" t)
    1.15 +(autoload 'YaTeX-goto-corresponding-viewer "yatexprc" "Viewer jump line" t)
    1.16  
    1.17  ;;autoload from yatexmth.el
    1.18  (autoload 'YaTeX-math-insert-sequence "yatexmth" "Image input." t)
    1.19 @@ -2190,6 +2191,7 @@
    1.20       ;;	  YaTeX-equation-env-regexp	;to delay loading
    1.21       ;;	  (or (YaTeX-inner-environment t) "document"))
    1.22       ;;	 (YaTeX-goto-corresponding-leftright)))
    1.23 +     ((YaTeX-goto-corresponding-viewer))
    1.24       (t (message "I don't know where to go.")))))
    1.25  
    1.26  (defun YaTeX-goto-corresponding-*-other-window (arg)
     2.1 --- a/yatex.new	Sat Dec 20 14:57:53 2014 +0900
     2.2 +++ b/yatex.new	Sat Dec 20 20:30:33 2014 +0900
     2.3 @@ -5,6 +5,7 @@
     2.4  	=== yatex ===
     2.5  	主な外部コマンド名を変数化。
     2.6  	[prefix] t d の直後のデフォルトヴューアはPDF用のものに。
     2.7 +	「%#!コマンド -オプション」のときは親ファイル指定なしと判定。
     2.8  
     2.9  1.77	last-command-char 廃止対策を追加。
    2.10  	=== yatex ===
     3.1 --- a/yatexprc.el	Sat Dec 20 14:57:53 2014 +0900
     3.2 +++ b/yatexprc.el	Sat Dec 20 20:30:33 2014 +0900
     3.3 @@ -1,7 +1,7 @@
     3.4  ;;; yatexprc.el --- YaTeX process handler
     3.5  ;;; 
     3.6  ;;; (c)1993-2013 by HIROSE Yuuji.[yuuji@yatex.org]
     3.7 -;;; Last modified Thu Nov 13 08:49:02 2014 on firestorm
     3.8 +;;; Last modified Sat Dec 20 20:14:43 2014 on firestorm
     3.9  ;;; $Id$
    3.10  
    3.11  ;;; Code:
    3.12 @@ -699,7 +699,51 @@
    3.13  	     (concat (YaTeX-get-preview-file-name) ".dvi")))
    3.14        (message "Searching `%s'...Done" str))))
    3.15  
    3.16 -(defun YaTeX-set-virtual-error-position (file-sym line-sym)
    3.17 +(defun YaTeX-preview-jlfmt-xdvi ()
    3.18 +  "Call xdvi -sourceposition to DVI corresponding to current main file"
    3.19 +  (interactive)
    3.20 +)
    3.21 +
    3.22 +(defvar YaTeX-cmd-displayline "/Applications/Skim.app/Contents/SharedSupport/displayline")
    3.23 +(defun YaTeX-preview-jump-line ()
    3.24 +  "Call jump-line function of various previewer on current main file"
    3.25 +  (interactive)
    3.26 +  (save-excursion
    3.27 +    (save-restriction
    3.28 +      (widen)
    3.29 +      (let*((pf (or YaTeX-parent-file
    3.30 +		    (save-excursion (YaTeX-visit-main t) (buffer-file-name))))
    3.31 +	    (pd (file-name-directory pf))
    3.32 +	    (bnr (substring pf 0 (string-match "\\....$" pf)))
    3.33 +	    (cf (file-relative-name (buffer-file-name) pd))
    3.34 +	    (buffer (get-buffer-create " *preview-jump-line*"))
    3.35 +	    (line (count-lines (point-min) (point-end-of-line)))
    3.36 +	    (previewer (YaTeX-preview-default-previewer))
    3.37 +	    (cmd (cond
    3.38 +		  ((string-match "xdvi" previewer)
    3.39 +		   (format "%s -nofork -sourceposition '%d %s' %s.dvi"
    3.40 +			   YaTeX-xdvi-remote-program
    3.41 +			   line cf bnr))
    3.42 +		  ((string-match "Skim" previewer)
    3.43 +		   (format "%s %d %s.pdf %s"
    3.44 +			   YaTeX-cmd-displayline line bnr cf))
    3.45 +		  ((string-match "sumatra" previewer)
    3.46 +		   (format "%s %s.pdf %d %s"
    3.47 +			   previewer bnr line cf))
    3.48 +		  ((string-match "evince" previewer)
    3.49 +		   (format "%s %s.pdf %d %s"
    3.50 +			   "fwdevince" bnr line cf)))))
    3.51 +	(YaTeX-typeset cmd buffer)))))
    3.52 +
    3.53 +(defun YaTeX-goto-corresponding-viewer ()
    3.54 +  (let ((cmd (or (YaTeX-get-builtin "!") tex-command)))
    3.55 +    (if (string-match "-src\\|synctex=" cmd)
    3.56 +	(progn
    3.57 +	  (YaTeX-preview-jump-line)
    3.58 +	  t)				;for YaTeX-goto-corresponding-*
    3.59 +      nil)))
    3.60 +
    3.61 +	 (defun YaTeX-set-virtual-error-position (file-sym line-sym)
    3.62    "Replace the value of FILE-SYM, LINE-SYM by virtual error position."
    3.63    (cond
    3.64     ((and (get 'dvi2-command 'region)
    3.65 @@ -915,9 +959,9 @@
    3.66       (cond
    3.67        (magic
    3.68         (cond
    3.69 -	(switch (if (string-match "\\s " magic) magic
    3.70 +	(switch (if (string-match "\\s [^-]\\S *$" magic) magic
    3.71  		  (concat magic " " parent)))
    3.72 -	(t (concat (substring magic 0 (string-match "\\s " magic)) " "))))
    3.73 +	(t (concat (substring magic 0 (string-match "\\s [^-]\\S *$" magic)) " "))))
    3.74        (t (concat tex-command " " (if switch parent))))
    3.75       (list (cons "f" tparent)
    3.76  	   (cons "r" (substring tparent 0 (rindex tparent ?.)))))))
    3.77 @@ -1056,8 +1100,8 @@
    3.78  
    3.79  (defun YaTeX-guess-parent (command-line)
    3.80    (setq command-line
    3.81 -	(if (string-match ".*\\s " command-line)
    3.82 -	    (substring command-line (match-end 0))
    3.83 +	(if (string-match "\\s \\([^-]\\S *\\)$" command-line)
    3.84 +	    (substring command-line (match-beginning 1))
    3.85  	  (file-name-nondirectory (buffer-file-name)))
    3.86  	command-line
    3.87  	(concat (if (string-match "\\(.*\\)\\." command-line)