comparison yatexprc.el @ 172:429d10a0d5b2 dev

YaTeX-typeset-buffer: Change the method of constructing ppcmd.
author yuuji@gentei.org
date Fri, 18 Feb 2011 14:50:34 +0900
parents 670549efa5c2
children cf7352dfa40c
comparison
equal deleted inserted replaced
171:670549efa5c2 172:429d10a0d5b2
1 ;;; -*- Emacs-Lisp -*- 1 ;;; -*- Emacs-Lisp -*-
2 ;;; YaTeX process handler. 2 ;;; YaTeX process handler.
3 ;;; yatexprc.el 3 ;;; yatexprc.el
4 ;;; (c)1993-2010 by HIROSE Yuuji.[yuuji@yatex.org] 4 ;;; (c)1993-2010 by HIROSE Yuuji.[yuuji@yatex.org]
5 ;;; Last modified Thu Feb 17 15:50:32 2011 on firestorm 5 ;;; Last modified Fri Feb 18 10:35:39 2011 on firestorm
6 ;;; $Id$ 6 ;;; $Id$
7 7
8 ;(require 'yatex) 8 ;(require 'yatex)
9 (require 'yatexlib) 9 (require 'yatexlib)
10 10
302 PP command will be called iff typeset command exit successfully" 302 PP command will be called iff typeset command exit successfully"
303 (interactive) 303 (interactive)
304 (YaTeX-save-buffers) 304 (YaTeX-save-buffers)
305 (let*((me (substring (buffer-name) 0 (rindex (buffer-name) ?.))) 305 (let*((me (substring (buffer-name) 0 (rindex (buffer-name) ?.)))
306 (mydir (file-name-directory (buffer-file-name))) 306 (mydir (file-name-directory (buffer-file-name)))
307 (cmd (YaTeX-get-latex-command t)) ppcmd 307 (cmd (YaTeX-get-latex-command t)) pparg ppcmd
308 (cb (current-buffer))) 308 (cb (current-buffer)))
309 (and pp 309 (and pp
310 (stringp pp) 310 (stringp pp)
311 (setq ppcmd (concat pp (substring cmd (string-match "[ \t]" cmd))) 311 (setq pparg (substring cmd 0 (string-match "[;&]" cmd)) ;rm multistmt
312 ppcmd (substring ppcmd 0 (rindex ppcmd ?.)))) 312 pparg (substring pparg (rindex pparg ? )) ;get last arg
313 ppcmd (concat pp (substring pparg 0 (rindex pparg ?.)))));rm ext
313 (if (YaTeX-main-file-p) nil 314 (if (YaTeX-main-file-p) nil
314 (save-excursion 315 (save-excursion
315 (YaTeX-visit-main t) ;search into main buffer 316 (YaTeX-visit-main t) ;search into main buffer
316 (save-excursion 317 (save-excursion
317 (push-mark (point) t) 318 (push-mark (point) t)
720 (defun YaTeX-get-preview-file-name (&optional preview-command) 721 (defun YaTeX-get-preview-file-name (&optional preview-command)
721 "Get file name to preview by inquiring YaTeX-get-latex-command" 722 "Get file name to preview by inquiring YaTeX-get-latex-command"
722 (if (null preview-command) (setq preview-command dvi2-command)) 723 (if (null preview-command) (setq preview-command dvi2-command))
723 (let* ((latex-cmd (YaTeX-get-latex-command t)) 724 (let* ((latex-cmd (YaTeX-get-latex-command t))
724 (rin (rindex latex-cmd ? )) 725 (rin (rindex latex-cmd ? ))
725 (fname (if (> rin -1) (substring latex-cmd (1+ rin)) "")) 726 (fname (if rin (substring latex-cmd (1+ rin)) ""))
726 (r (YaTeX-assoc-regexp preview-command YaTeX-dvi2-command-ext-alist)) 727 (r (YaTeX-assoc-regexp preview-command YaTeX-dvi2-command-ext-alist))
727 (ext (if r (cdr r) "")) 728 (ext (if r (cdr r) "")))
728 (period))
729 (concat 729 (concat
730 (if (string= fname "") 730 (if (string= fname "")
731 (setq fname (substring (file-name-nondirectory 731 (setq fname (substring (file-name-nondirectory
732 (buffer-file-name)) 732 (buffer-file-name))
733 0 -4)) 733 0 -4))
734 (setq period (rindex fname ?.)) 734 (setq fname (substring fname 0 (rindex fname ?.))))
735 (setq fname (substring fname 0 (if (eq -1 period) nil period))))
736 ext))) 735 ext)))
737 736
738 (defun YaTeX-get-latex-command (&optional switch) 737 (defun YaTeX-get-latex-command (&optional switch)
739 "Specify the latex-command name and its argument. 738 "Specify the latex-command name and its argument.
740 If there is a line which begins with string: \"%#!\", the following 739 If there is a line which begins with string: \"%#!\", the following

yatex.org