diff --git a/yatex.el b/yatex.el index c513eb1..a6031e6 100644 --- a/yatex.el +++ b/yatex.el @@ -1,6 +1,6 @@ ;;; yatex.el --- Yet Another tex-mode for emacs //�쒹// -*- coding: sjis -*- ;;; (c)1991-2014 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Fri Dec 19 07:46:21 2014 on firestorm +;;; Last modified Sat Dec 20 19:43:33 2014 on firestorm ;;; $Id$ ;;; The latest version of this software is always available at; ;;; http://www.yatex.org/ @@ -765,6 +765,7 @@ (autoload 'YaTeX-get-builtin "yatexprc" "Get %# built-in." t) (autoload 'YaTeX-system "yatexprc" "Call system command" t) (autoload 'YaTeX-save-buffers "yatexprc" "Save buffers of same major mode" t) +(autoload 'YaTeX-goto-corresponding-viewer "yatexprc" "Viewer jump line" t) ;;autoload from yatexmth.el (autoload 'YaTeX-math-insert-sequence "yatexmth" "Image input." t) @@ -2190,6 +2191,7 @@ ;; YaTeX-equation-env-regexp ;to delay loading ;; (or (YaTeX-inner-environment t) "document")) ;; (YaTeX-goto-corresponding-leftright))) + ((YaTeX-goto-corresponding-viewer)) (t (message "I don't know where to go."))))) (defun YaTeX-goto-corresponding-*-other-window (arg) diff --git a/yatex.new b/yatex.new index 53914d8..a8b2b4a 100644 --- a/yatex.new +++ b/yatex.new @@ -5,6 +5,7 @@ === yatex === ��ȊO���R�}���h����ϐ����B [prefix] t d �̒���̃f�t�H���g�����[�A��PDF�p�̂��̂ɁB + �u%#!�R�}���h -�I�v�V�����v�̂Ƃ��͐e�t�@�C���w��Ȃ��Ɣ���B 1.77 last-command-char �p�~�΍��lj��B === yatex === diff --git a/yatexprc.el b/yatexprc.el index e271c15..0d6be07 100644 --- a/yatexprc.el +++ b/yatexprc.el @@ -1,7 +1,7 @@ ;;; yatexprc.el --- YaTeX process handler ;;; ;;; (c)1993-2013 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Nov 13 08:49:02 2014 on firestorm +;;; Last modified Sat Dec 20 20:14:43 2014 on firestorm ;;; $Id$ ;;; Code: @@ -699,7 +699,51 @@ (concat (YaTeX-get-preview-file-name) ".dvi"))) (message "Searching `%s'...Done" str)))) -(defun YaTeX-set-virtual-error-position (file-sym line-sym) +(defun YaTeX-preview-jlfmt-xdvi () + "Call xdvi -sourceposition to DVI corresponding to current main file" + (interactive) +) + +(defvar YaTeX-cmd-displayline "/Applications/Skim.app/Contents/SharedSupport/displayline") +(defun YaTeX-preview-jump-line () + "Call jump-line function of various previewer on current main file" + (interactive) + (save-excursion + (save-restriction + (widen) + (let*((pf (or YaTeX-parent-file + (save-excursion (YaTeX-visit-main t) (buffer-file-name)))) + (pd (file-name-directory pf)) + (bnr (substring pf 0 (string-match "\\....$" pf))) + (cf (file-relative-name (buffer-file-name) pd)) + (buffer (get-buffer-create " *preview-jump-line*")) + (line (count-lines (point-min) (point-end-of-line))) + (previewer (YaTeX-preview-default-previewer)) + (cmd (cond + ((string-match "xdvi" previewer) + (format "%s -nofork -sourceposition '%d %s' %s.dvi" + YaTeX-xdvi-remote-program + line cf bnr)) + ((string-match "Skim" previewer) + (format "%s %d %s.pdf %s" + YaTeX-cmd-displayline line bnr cf)) + ((string-match "sumatra" previewer) + (format "%s %s.pdf %d %s" + previewer bnr line cf)) + ((string-match "evince" previewer) + (format "%s %s.pdf %d %s" + "fwdevince" bnr line cf))))) + (YaTeX-typeset cmd buffer))))) + +(defun YaTeX-goto-corresponding-viewer () + (let ((cmd (or (YaTeX-get-builtin "!") tex-command))) + (if (string-match "-src\\|synctex=" cmd) + (progn + (YaTeX-preview-jump-line) + t) ;for YaTeX-goto-corresponding-* + nil))) + + (defun YaTeX-set-virtual-error-position (file-sym line-sym) "Replace the value of FILE-SYM, LINE-SYM by virtual error position." (cond ((and (get 'dvi2-command 'region) @@ -915,9 +959,9 @@ (cond (magic (cond - (switch (if (string-match "\\s " magic) magic + (switch (if (string-match "\\s [^-]\\S *$" magic) magic (concat magic " " parent))) - (t (concat (substring magic 0 (string-match "\\s " magic)) " ")))) + (t (concat (substring magic 0 (string-match "\\s [^-]\\S *$" magic)) " ")))) (t (concat tex-command " " (if switch parent)))) (list (cons "f" tparent) (cons "r" (substring tparent 0 (rindex tparent ?.))))))) @@ -1056,8 +1100,8 @@ (defun YaTeX-guess-parent (command-line) (setq command-line - (if (string-match ".*\\s " command-line) - (substring command-line (match-end 0)) + (if (string-match "\\s \\([^-]\\S *\\)$" command-line) + (substring command-line (match-beginning 1)) (file-name-nondirectory (buffer-file-name))) command-line (concat (if (string-match "\\(.*\\)\\." command-line)