yatex
changeset 86:f14ec50103d0
as of 2009/9/28
author | yuuji@gentei.org |
---|---|
date | Mon, 28 Sep 2009 07:56:08 +0900 |
parents | 42c373ac73af |
children | 7ab5cf76e676 |
files | help/YATEXHLP.eng help/YATEXHLP.jp yahtml.el yatex.el yatex.new yatex.prj yatex19.el yatexadd.el yatexlib.el yatexprc.el |
diffstat | 10 files changed, 198 insertions(+), 75 deletions(-) [+] |
line diff
1.1 --- a/help/YATEXHLP.eng Sun Sep 27 12:53:18 2009 +0000 1.2 +++ b/help/YATEXHLP.eng Mon Sep 28 07:56:08 2009 +0900 1.3 @@ -1210,6 +1210,12 @@ 1.4 *, **, etc. within pages, then \footnote[2]{...} 1.5 produces footnote '**'. This command does not 1.6 step the footnote counter. 1.7 + 1.8 +If you want footnote number as marks, define as follows in preamble; 1.9 +\renewcommand{\thefootnote}{\fnsymbol{footnote}} 1.10 + 1.11 +The next definition produces dagger marks followed by sequential number. 1.12 +\renewcommand{\thefootnote}{$\dagger$\arabic{footnote}} 1.13 (fragile) 1.14 1.15 footnotemark
2.1 --- a/help/YATEXHLP.jp Sun Sep 27 12:53:18 2009 +0000 2.2 +++ b/help/YATEXHLP.jp Mon Sep 28 07:56:08 2009 +0900 2.3 @@ -1203,6 +1203,12 @@ 2.4 脚注がうまく出力されないような場所では \footnotemark と \footnotetext を 2.5 組み合わせて出力する。 2.6 fragile 2.7 +ダガー(†)にするなど,記号にしたいときはプリアンブルで 2.8 +\renewcommand{\thefootnote}{\fnsymbol{footnote}} 2.9 +とする。 2.10 +†1, †2, ...にしたいときは 2.11 +\renewcommand{\thefootnote}{$\dagger$\arabic{footnote}} 2.12 + 2.13 2.14 footnotemark 2.15 \footnotemark[NUM] 2.16 @@ -1618,7 +1624,7 @@ 2.17 color 2.18 \color{色} 2.19 2.20 -ページの文字食を「色」に設定する。 2.21 +ページの文字色を「色」に設定する。 2.22 2.23 <refer colorの名前つきカラー> 2.24
3.1 --- a/yahtml.el Sun Sep 27 12:53:18 2009 +0000 3.2 +++ b/yahtml.el Mon Sep 28 07:56:08 2009 +0900 3.3 @@ -1,6 +1,6 @@ 3.4 ;;; -*- Emacs-Lisp -*- 3.5 ;;; (c) 1994-2006 by HIROSE Yuuji [yuuji@yatex.org] 3.6 -;;; Last modified Sun Dec 24 15:12:35 2006 on firestorm 3.7 +;;; Last modified Tue Jun 16 10:11:50 2009 on firestorm 3.8 ;;; $Id$ 3.9 3.10 (defconst yahtml-revision-number "1.72" 3.11 @@ -235,7 +235,7 @@ 3.12 3.13 (defvar yahtml-use-css t "*Use stylesheet or not") 3.14 3.15 -(defvar yahtml-image-inspection-bytes 10000 ;256 3.16 +(defvar yahtml-image-inspection-bytes 50000 ;256 3.17 "*Number of bytes to inspect the image for geometry information") 3.18 (defvar yahtml:img-default-alt-format "%xx%y(%sbytes)" 3.19 "*Default format of img entity's ALT attributes. 3.20 @@ -1739,7 +1739,8 @@ 3.21 "browser" pb shell-file-name yahtml-shell-command-option 3.22 (format "%s \"%s\"" yahtml-www-browser href))) 3.23 'yahtml-netscape-sentinel)) 3.24 - ((and (string-match "[Nn]etscape" yahtml-www-browser) 3.25 + ((and (string-match 3.26 + "[Nn]etscape\\|[Ff]irefox\\|[Mm]ozilla" yahtml-www-browser) 3.27 (not (eq system-type 'windows-nt))) 3.28 (if (get-buffer pb) 3.29 (progn (set-buffer pb) (erase-buffer) (set-buffer cb))) 3.30 @@ -2688,6 +2689,56 @@ 3.31 (open-line 1) 3.32 (YaTeX-reindent c)))))) 3.33 3.34 +(defun yahtml-intelligent-newline-table () 3.35 + (let ((cp (point)) (p (point)) tb rb (cols 0) th line (i 0) fmt 3.36 + (ptn "\\(<t[dh]\\>\\)\\|<t\\(r\\|head\\|body\\)\\>")) 3.37 + (cond 3.38 + ((save-excursion (setq tb (YaTeX-beginning-of-environment "table"))) 3.39 + (while (and (setq rb (re-search-backward ptn tb t)) 3.40 + (match-beginning 1)) 3.41 + (setq th (looking-at "<th")) ;Remember if first-child is tr or not 3.42 + (goto-char (match-end 0)) 3.43 + (skip-chars-forward " \t\n") 3.44 + (if (and (search-forward "colspan\\s *=" p t) 3.45 + (progn 3.46 + (skip-chars-forward "\"' \t\n") 3.47 + (looking-at "[0-9]+"))) 3.48 + (setq cols (+ (string-to-int (YaTeX-match-string 0)) cols)) 3.49 + (setq cols (1+ cols))) 3.50 + (goto-char rb) 3.51 + (setq p (point))) 3.52 + (if (> cols 0) 3.53 + (message "%s columns found. %s" 3.54 + cols (if YaTeX-japan "新しいtr(N)? 前のtrの複写?(D)?: " 3.55 + "New tr?(N) or Duplicate"))) 3.56 + (cond 3.57 + ((and (> cols 0) 3.58 + (memq (read-char) '(?d ?D))) ;Duplication mode 3.59 + (setq line (YaTeX-buffer-substring (point) cp))) 3.60 + (t ;empty cells 3.61 + (setq line "<tr>" i 0) 3.62 + (if (> cols 0) 3.63 + (while (> cols i) 3.64 + (setq line (concat line (if (and (= i 0) th) "<th></th>" 3.65 + "<td></td>")) 3.66 + th nil i (1+ i))) 3.67 + (setq fmt (read-string "`th' or `td' format: " "th td td")) 3.68 + (while (string-match "t\\(h\\)\\|td" fmt i) 3.69 + (setq line (concat line (if (match-beginning 1) "<th></th>" 3.70 + "<td></td>")) 3.71 + i (match-end 0)))) 3.72 + (setq line (concat line "</tr>")))) 3.73 + (goto-char cp) 3.74 + (if th 3.75 + (message 3.76 + "Type `%s' to change td from/to th." 3.77 + (key-description (car (where-is-internal 'yahtml-change-*))))) 3.78 + (if (string< "" line) 3.79 + (progn 3.80 + (insert line) 3.81 + (goto-char (+ 8 cp)) 3.82 + (yahtml-indent-line))))))) 3.83 + 3.84 ;;; ---------- Marking ---------- 3.85 (defun yahtml-mark-begend () 3.86 "Mark current tag" 3.87 @@ -2765,13 +2816,13 @@ 3.88 (setq e (point)) 3.89 (goto-char b) 3.90 (while (re-search-forward ;ちょといい加減なREGEXP 3.91 - "\\([a-z][-a-z0-9]*\\)?\\.\\([-a-z0-9][-a-z0-9]*\\)\\>" 3.92 + "\\([a-z*][-a-z0-9]*\\)?\\.\\([-a-z0-9][-a-z0-9]*\\)\\>" 3.93 e t) 3.94 (setq element (YaTeX-match-string 1) 3.95 class (YaTeX-match-string 2)) 3.96 ;;if starts with period (match-string 1 is nil), 3.97 ;;this is global class 3.98 - (setq element (downcase (or element "global"))) 3.99 + (setq element (downcase (or element "*"))) 3.100 (if (setq a (assoc element alist)) 3.101 (or (assoc class (cdr a)) 3.102 (setcdr a (cons (list class) (cdr a)))) 3.103 @@ -2787,13 +2838,19 @@ 3.104 3.105 (defun yahtml-css-collect-classes-file (file &optional initial) 3.106 (let*((hilit-auto-highlight nil) 3.107 - (openedp (get-file-buffer file)) 3.108 - (cb (current-buffer)) 3.109 - (buf (set-buffer (find-file-noselect file)))) 3.110 - (prog1 3.111 - (yahtml-css-collect-classes-buffer initial) 3.112 - (or openedp (kill-buffer buf)) 3.113 - (set-buffer cb)))) 3.114 + (buf (get-buffer-create 3.115 + (format " *css-collection*%s" (file-name-nondirectory file)))) 3.116 + (cb (current-buffer))) 3.117 + (unwind-protect 3.118 + (progn 3.119 + (set-buffer buf) 3.120 + (insert-file-contents file) 3.121 + (cd (or (file-name-directory file) ".")) 3.122 + (yahtml-css-collect-classes-buffer initial)) 3.123 + (if (eq buf cb) 3.124 + nil 3.125 + (kill-buffer buf) 3.126 + (set-buffer cb))))) 3.127 3.128 (defun yahtml-css-scan-styles () 3.129 (save-excursion 3.130 @@ -2825,7 +2882,7 @@ 3.131 3.132 (defun yahtml-css-get-element-completion-alist (element) 3.133 (let ((alist (cdr-safe (assoc (downcase element) yahtml-css-class-alist))) 3.134 - (global (cdr-safe (assoc "global" yahtml-css-class-alist)))) 3.135 + (global (cdr-safe (assoc "*" yahtml-css-class-alist)))) 3.136 (and (or alist global) 3.137 (append alist global)))) 3.138
4.1 --- a/yatex.el Sun Sep 27 12:53:18 2009 +0000 4.2 +++ b/yatex.el Mon Sep 28 07:56:08 2009 +0900 4.3 @@ -1,15 +1,15 @@ 4.4 ;;; -*- Emacs-Lisp -*- 4.5 ;;; Yet Another tex-mode for emacs - //野鳥// 4.6 -;;; yatex.el rev. 1.73 4.7 -;;; (c)1991-2006 by HIROSE Yuuji.[yuuji@yatex.org] 4.8 -;;; Last modified Sun Dec 24 15:12:43 2006 on firestorm 4.9 +;;; yatex.el rev. 1.73.1 4.10 +;;; (c)1991-2007 by HIROSE Yuuji.[yuuji@yatex.org] 4.11 +;;; Last modified Tue Nov 6 10:17:53 2007 on firestorm 4.12 ;;; $Id$ 4.13 ;;; The latest version of this software is always available at; 4.14 ;;; http://www.yatex.org/ 4.15 4.16 (require 'comment) 4.17 (require 'yatexlib) 4.18 -(defconst YaTeX-revision-number "1.73" 4.19 +(defconst YaTeX-revision-number "1.73.1" 4.20 "Revision number of running yatex.el") 4.21 4.22 ;---------- Local variables ---------- 4.23 @@ -383,6 +383,8 @@ 4.24 ("Sigma") ("Upsilon") ("Phi") ("Psi") ("Omega"))) 4.25 (if YaTeX-use-LaTeX2e 4.26 '(("return") ("Return") ("yen"))) ;defined in ascmac 4.27 + (if YaTeX-use-AMS-LaTeX 4.28 + '(("nonumber"))) 4.29 ) 4.30 "Default completion table for maketitle-type completion.") 4.31 4.32 @@ -543,7 +545,8 @@ 4.33 0: no-converion (mule) 4.34 1: Shift JIS 4.35 2: JIS 4.36 -3: EUC") 4.37 +3: EUC 4.38 +4: UTF-8") 4.39 4.40 (defvar YaTeX-coding-system nil "File coding system used by Japanese TeX.") 4.41 (cond 4.42 @@ -1454,9 +1457,9 @@ 4.43 ((= c ?j) (YaTeX-typeset-buffer)) 4.44 ((= c ?r) (YaTeX-typeset-region)) 4.45 ((= c ?b) (YaTeX-call-command-on-file 4.46 - bibtex-command "*YaTeX-bibtex*")) 4.47 + bibtex-command "*YaTeX-bibtex*" YaTeX-parent-file)) 4.48 ((= c ?i) (YaTeX-call-command-on-file 4.49 - makeindex-command "*YaTeX-makeindex*")) 4.50 + makeindex-command "*YaTeX-makeindex*" YaTeX-parent-file)) 4.51 ((= c ?k) (YaTeX-kill-typeset-process YaTeX-typeset-process)) 4.52 ((= c ?p) (call-interactively 'YaTeX-preview)) 4.53 ((= c ?q) (YaTeX-system "lpq" "*Printer queue*")) 4.54 @@ -1648,7 +1651,8 @@ 4.55 (if (not (YaTeX-on-includes-p)) nil 4.56 (let ((parent buffer-file-name) input-file b) 4.57 (save-excursion 4.58 - (if (search-forward "{" (point-end-of-line) t) 4.59 + (if (and (re-search-forward "[{%]" (point-end-of-line) t) 4.60 + (= ?{ (char-after (match-beginning 0)))) 4.61 nil 4.62 (skip-chars-backward "^,{")) 4.63 (setq input-file 4.64 @@ -1917,7 +1921,7 @@ 4.65 (defun YaTeX-on-includes-p () 4.66 (save-excursion 4.67 (beginning-of-line) 4.68 - (re-search-forward "\\(\\(include.*\\)\\|\\(input\\)\\){.*}" 4.69 + (re-search-forward "\\(\\(include[^}]*\\)\\|\\(input\\)\\){[^}]*}" 4.70 (point-end-of-line) t))) 4.71 4.72 (defun YaTeX-on-comment-p (&optional sw)
5.1 --- a/yatex.new Sun Sep 27 12:53:18 2009 +0000 5.2 +++ b/yatex.new Mon Sep 28 07:56:08 2009 +0900 5.3 @@ -1,6 +1,12 @@ 5.4 What's new in YaTeX/yahtml 5.5 野鳥/yahtml - 各バージョンの変更点について 5.6 5.7 +1.74 === yahtml === 5.8 + [prefix] Return Intelligent-newline をtable対応にした。 5.9 + cssファイル中に@importがあったときのバグを除去。 5.10 + cssの *.class 解釈を修正。 5.11 + yahtml-image-inspection-bytes を50000に増やした。 5.12 + 5.13 1.73 === yatex === 5.14 C-i (YaTeX-indent-line) のtabular/array環境対応。行頭位置の 5.15 tabular的カラム位置に応じてインデントの深さを4桁ずつ深くする。
6.1 --- a/yatex.prj Sun Sep 27 12:53:18 2009 +0000 6.2 +++ b/yatex.prj Mon Sep 28 07:56:08 2009 +0900 6.3 @@ -8,15 +8,37 @@ 6.4 ("setlength" 2 ))) 6.5 ***↑これは候補テーブルではなく、アドイン関数として対処するようにした。 6.6 6.7 +【yahtml - <applet code='foo.class'> で foo.java に飛ぶ】 ○ 6.8 +【reftexのsurvey】 6.9 +【yahtml - id="foo" を全てのタグの属性値に】 △? (属性値への代入は変数名を 6.10 + 固定化しないことにした) 6.11 【[prefix] > のbegin/end上でのコメントの警告】 ○ 6.12 【mark begin to end】 ○ 6.13 【Demacs: dviout起動時前後にカーソル on/off】 ○ 6.14 【\ref,\labelの対応の不整合はどうする?】 6.15 -【\ref,\label ジャンプがまだ隠し機能】 6.16 -【\ref補完で後から\label作るモード】 6.17 -【\[を入れた時に\]を入れて自動インデントなど】 6.18 -【オンラインヘルプ】 6.19 - 6.20 +【\ref補完で後から\label作るモード】 ○ 6.21 +【\[を入れた時に\]を入れて自動インデントなど】 ○ 6.22 +【オンラインヘルプ】 ○日本語版完成 6.23 +【プロセス処理 default-directory や(cd)で何とかする】 △(cdするようにした) 6.24 +【子ファイルのプリアンブルをtexput.texに入れたい できれば再帰的に】 ○ 6.25 +【セクションコマンド専用の補完がやはり欲しい】 ○(view-sectioning) 6.26 +【section型の引数の [prefix] c】 ○ 6.27 +【equationでのインデント】 ○ 6.28 +【[prefix] c でイメージ補完候補も変えられる】 ○ 6.29 +【includeしてるファイルのtree表示】 ○ 6.30 +【section型のショートカット】 ○ 6.31 +【\leftarrowなどを$$で囲む】 ○ 6.32 +【全ファイルに対する section-overview】 6.33 +【kill-env した時に中のインデントを1レベル落す】 6.34 +【section型とmaketitle型の統合】 6.35 +【documentstyleの引数からjump file】 6.36 +【fillした時に~の後ろに空白が入ってしまう】 6.37 +【yahtml: インデント】 ○ 6.38 +【yahtml: お任せ改行】 ○ 6.39 +【yahtml: change-*】 △ (未対応の形式が多い) 6.40 +【auto-fill 時の \verb|xx| protect】 ○ 6.41 +【tabularのインデント(;_;)】 6.42 +【kill-*したのをkill-ringに入れる】 ○ 6.43 6.44 6.45 Local Variables:
7.1 --- a/yatex19.el Sun Sep 27 12:53:18 2009 +0000 7.2 +++ b/yatex19.el Mon Sep 28 07:56:08 2009 +0900 7.3 @@ -1,7 +1,7 @@ 7.4 ;;; -*- Emacs-Lisp -*- 7.5 ;;; YaTeX facilities for Emacs 19 7.6 ;;; (c)1994-2006 by HIROSE Yuuji.[yuuji@yatex.org] 7.7 -;;; Last modified Mon Jun 26 11:31:34 2006 on firestorm 7.8 +;;; Last modified Sun Feb 11 09:19:12 2007 on firestorm 7.9 ;;; $Id$ 7.10 7.11 ;(require 'yatex) 7.12 @@ -447,9 +447,11 @@ 7.13 ("``" "''" string) 7.14 ("\\\\\\(new\\|clear\\(double\\)?\\)page\\>\\|\\\\\\(\\\\\\|cr\\)\\>" 7.15 0 delimiter) 7.16 - (YaTeX-19-re-search-in-env 7.17 - ("&\\|\\\\hline" . "tabular\\|equation\\|eqn\\|array\\|align") delimiter) 7.18 - (YaTeX-19-re-search-in-env ("\\\\[+-=><'`]" . "tabbing") delimiter) 7.19 + ;; re-search-in-env seems to make it slow down. 2007/2/11 7.20 + ;;(YaTeX-19-re-search-in-env 7.21 + ;; ("&\\|\\\\hline" . "tabular\\|equation\\|eqn\\|array\\|align") delimiter) 7.22 + ;;(YaTeX-19-re-search-in-env ("\\\\[+-=><'`]" . "tabbing") delimiter) 7.23 + ("&\\|\\\\hline\\|\\\\[+-=><'`]" 0 delimiter) 7.24 ) 7.25 "*Hiliting pattern alist for LaTeX text.") 7.26
8.1 --- a/yatexadd.el Sun Sep 27 12:53:18 2009 +0000 8.2 +++ b/yatexadd.el Mon Sep 28 07:56:08 2009 +0900 8.3 @@ -2,7 +2,7 @@ 8.4 ;;; YaTeX add-in functions. 8.5 ;;; yatexadd.el rev.18 8.6 ;;; (c)1991-2006 by HIROSE Yuuji.[yuuji@yatex.org] 8.7 -;;; Last modified Sun Dec 24 15:12:30 2006 on firestorm 8.8 +;;; Last modified Fri Sep 21 11:44:42 2007 on firestorm 8.9 ;;; $Id$ 8.10 8.11 ;;; 8.12 @@ -796,7 +796,7 @@ 8.13 "\\)\\|\\(" YaTeX::ref-labeling-regexp "\\)")) 8.14 (itemsep (concat YaTeX-ec-regexp 8.15 "\\(\\(bib\\)?item\\|begin\\|end\\)")) 8.16 - (refcmd (or refcmd "ref")) 8.17 + (refcmd (or refcmd "\\(page\\)?ref")) 8.18 (p (point)) initl line cf 8.19 (percent (regexp-quote YaTeX-comment-prefix)) 8.20 (output 8.21 @@ -1097,8 +1097,12 @@ 8.22 (switch-to-buffer buf) 8.23 (goto-char p) 8.24 (if (re-search-backward 8.25 - (concat "\\\\" refcmd "{\\([^}]+\\)}") nil t) 8.26 - (setq label (YaTeX-match-string 1)) 8.27 + (concat "\\\\" refcmd "{") nil t) 8.28 + (setq label (YaTeX-buffer-substring 8.29 + (progn (goto-char (1- (match-end 0))) 8.30 + (1+ (point))) 8.31 + (progn (forward-list 1) 8.32 + (1- (point))))) 8.33 (setq label "")))) 8.34 ((>= line (+ lnum 2)) 8.35 (setq label (read-string (format "\\%s{???}: " refcmd)))) 8.36 @@ -1565,11 +1569,14 @@ 8.37 (setq YaTeX-default-document-style sname))))) 8.38 8.39 (defun YaTeX::include (argp &optional prompt) 8.40 + "Read file name setting default directory to that of main file." 8.41 (cond 8.42 ((= argp 1) 8.43 - (let*((insert-default-directory) 8.44 - (file (read-file-name (or prompt "Input file: ") ""))) 8.45 - (setq file (substring file 0 (string-match "\\.tex$" file))))))) 8.46 + (save-excursion 8.47 + (YaTeX-visit-main t) 8.48 + (let*((insert-default-directory) 8.49 + (file (read-file-name (or prompt "Input file: ") ""))) 8.50 + (setq file (substring file 0 (string-match "\\.tex$" file)))))))) 8.51 8.52 (fset 'YaTeX::input 'YaTeX::include) 8.53 8.54 @@ -1764,6 +1771,10 @@ 8.55 "Add-in for \\includegraphics" 8.56 (YaTeX::include argp "Image File: ")) 8.57 8.58 +(defun YaTeX::verbfile (argp) 8.59 + "Add-in for \\verbfile" 8.60 + (YaTeX::include argp "Virbatim File: ")) 8.61 + 8.62 (defun YaTeX:caption () 8.63 (setq YaTeX-section-name "label") 8.64 nil)
9.1 --- a/yatexlib.el Sun Sep 27 12:53:18 2009 +0000 9.2 +++ b/yatexlib.el Mon Sep 28 07:56:08 2009 +0900 9.3 @@ -2,7 +2,7 @@ 9.4 ;;; YaTeX and yahtml common libraries, general functions and definitions 9.5 ;;; yatexlib.el 9.6 ;;; (c)1994-2006 by HIROSE Yuuji.[yuuji@yatex.org] 9.7 -;;; Last modified Sun Dec 24 15:12:20 2006 on firestorm 9.8 +;;; Last modified Sat Apr 18 07:32:45 2009 on firestorm 9.9 ;;; $Id$ 9.10 9.11 ;; General variables 9.12 @@ -313,8 +313,9 @@ 9.13 9.14 ;;;###autoload 9.15 (defun YaTeX-define-begend-key (key env &optional map) 9.16 - "Define short cut key for begin type completion both for normal 9.17 -and region mode. To customize YaTeX, user should use this function." 9.18 + "Define short cut key for begin type completion. 9.19 +Define both strokes for normal and region mode. 9.20 +To customize YaTeX, user should use this function." 9.21 (YaTeX-define-begend-key-normal key env map) 9.22 (if YaTeX-inhibit-prefix-letter nil 9.23 (YaTeX-define-begend-region-key 9.24 @@ -487,7 +488,7 @@ 9.25 that gives the maximum value by the FUNC. FUNC should take an argument 9.26 of its window object. Non-nil for optional third argument SELECT selects 9.27 that window. This function never selects minibuffer window." 9.28 - (or (and (if (and YaTeX-emacs-19 select) 9.29 + (or (and (if (and YaTeX-emacs-19 select window-system) 9.30 (get-buffer-window buffer t) 9.31 (get-buffer-window buffer)) 9.32 (progn 9.33 @@ -516,7 +517,7 @@ 9.34 (or select (select-window window))) 9.35 (t ;if one-window 9.36 (cond 9.37 - ((and YaTeX-emacs-19 (get-buffer-window buffer t)) 9.38 + ((and YaTeX-emacs-19 window-system (get-buffer-window buffer t)) 9.39 nil) ;if found in other frame 9.40 (YaTeX-default-pop-window-height 9.41 (split-window-calculate-height YaTeX-default-pop-window-height)
10.1 --- a/yatexprc.el Sun Sep 27 12:53:18 2009 +0000 10.2 +++ b/yatexprc.el Mon Sep 28 07:56:08 2009 +0900 10.3 @@ -1,8 +1,8 @@ 10.4 ;;; -*- Emacs-Lisp -*- 10.5 ;;; YaTeX process handler. 10.6 ;;; yatexprc.el 10.7 -;;; (c)1993-2006 by HIROSE Yuuji.[yuuji@yatex.org] 10.8 -;;; Last modified Sun Dec 24 15:12:50 2006 on firestorm 10.9 +;;; (c)1993-2007 by HIROSE Yuuji.[yuuji@yatex.org] 10.10 +;;; Last modified Thu May 7 13:47:28 2009 on firestorm 10.11 ;;; $Id$ 10.12 10.13 ;(require 'yatex) 10.14 @@ -313,13 +313,16 @@ 10.15 (defvar YaTeX-call-command-history nil 10.16 "Holds history list of YaTeX-call-command-on-file.") 10.17 (put 'YaTeX-call-command-history 'no-default t) 10.18 -(defun YaTeX-call-command-on-file (base-cmd buffer) 10.19 +(defun YaTeX-call-command-on-file (base-cmd buffer &optional file) 10.20 + "Call external command BASE-CMD int the BUFFER. 10.21 +By default, pass the basename of current file. Optional 3rd argument 10.22 +FILE changes the default file name." 10.23 (YaTeX-save-buffers) 10.24 (YaTeX-typeset 10.25 (read-string-with-history 10.26 "Call command: " 10.27 (concat base-cmd " " 10.28 - (let ((me (file-name-nondirectory buffer-file-name))) 10.29 + (let ((me (file-name-nondirectory (or file buffer-file-name)))) 10.30 (if (string-match "\\.tex" me) 10.31 (substring me 0 (match-beginning 0)) 10.32 me))) 10.33 @@ -330,7 +333,9 @@ 10.34 "Pass the bibliography data of editing file to bibtex." 10.35 (interactive) 10.36 (YaTeX-save-buffers) 10.37 - (YaTeX-call-command-on-file cmd "*YaTeX-bibtex*" )) 10.38 + (let ((main (or YaTeX-parent-file 10.39 + (progn (YaTeX-visit-main t) buffer-file-name)))) 10.40 + (YaTeX-call-command-on-file cmd "*YaTeX-bibtex*" main))) 10.41 10.42 (defun YaTeX-kill-typeset-process (proc) 10.43 "Kill process PROC after sending signal to PROC. 10.44 @@ -423,27 +428,27 @@ 10.45 (defun YaTeX-preview (preview-command preview-file) 10.46 "Execute xdvi (or other) to tex-preview." 10.47 (interactive 10.48 - (list 10.49 - (read-string-with-history 10.50 - "Preview command: " 10.51 - (YaTeX-replace-format 10.52 - (or (YaTeX-get-builtin "PREVIEW") dvi2-command) 10.53 - "p" (format (cond 10.54 - (YaTeX-dos "-y:%s") 10.55 - (t "-paper %s")) 10.56 - (YaTeX-get-paper-type))) 10.57 - 'YaTeX-preview-command-history) 10.58 - (read-string-with-history 10.59 - "Preview file: " 10.60 - (if (get 'dvi2-command 'region) 10.61 - (substring YaTeX-texput-file 10.62 - 0 (rindex YaTeX-texput-file ?.)) 10.63 - (YaTeX-get-preview-file-name)) 10.64 - 'YaTeX-preview-file-history))) 10.65 - (if YaTeX-dos (setq preview-file (expand-file-name preview-file))) 10.66 + (let* ((command (read-string-with-history 10.67 + "Preview command: " 10.68 + (YaTeX-replace-format 10.69 + (or (YaTeX-get-builtin "PREVIEW") dvi2-command) 10.70 + "p" (format (cond 10.71 + (YaTeX-dos "-y:%s") 10.72 + (t "-paper %s")) 10.73 + (YaTeX-get-paper-type))) 10.74 + 'YaTeX-preview-command-history)) 10.75 + (file (read-string-with-history 10.76 + "Preview file: " 10.77 + (if (get 'dvi2-command 'region) 10.78 + (substring YaTeX-texput-file 10.79 + 0 (rindex YaTeX-texput-file ?.)) 10.80 + (YaTeX-get-preview-file-name command)) 10.81 + 'YaTeX-preview-file-history))) 10.82 + (list command file))) 10.83 (setq dvi2-command preview-command) ;`dvi2command' is buffer local 10.84 (save-excursion 10.85 (YaTeX-visit-main t) 10.86 + (if YaTeX-dos (setq preview-file (expand-file-name preview-file))) 10.87 (let ((pbuffer "*dvi-preview*") (dir default-directory)) 10.88 (YaTeX-showup-buffer 10.89 pbuffer (function (lambda (x) (nth 3 (window-edges x))))) 10.90 @@ -467,9 +472,10 @@ 10.91 (concat preview-command " " preview-file))) 10.92 (t ;if UNIX 10.93 (set-process-buffer 10.94 - (start-process "preview" "*dvi-preview*" shell-file-name 10.95 - YaTeX-shell-command-option 10.96 - (concat preview-command " " preview-file)) 10.97 + (let ((process-connection-type nil)) 10.98 + (start-process "preview" "*dvi-preview*" shell-file-name 10.99 + YaTeX-shell-command-option 10.100 + (concat preview-command " " preview-file))) 10.101 (get-buffer pbuffer)) 10.102 (message 10.103 (concat "Starting " preview-command 10.104 @@ -662,14 +668,15 @@ 10.105 (defvar YaTeX-dvi2-command-ext-alist 10.106 '(("[agx]dvi\\|dviout" . ".dvi") 10.107 ("ghostview\\|gv" . ".ps") 10.108 - ("acroread\\|pdf\\|Preview\\|TeXShop" . ".pdf"))) 10.109 + ("acroread\\|pdf\\|Preview\\|TeXShop\\|Skim" . ".pdf"))) 10.110 10.111 -(defun YaTeX-get-preview-file-name () 10.112 +(defun YaTeX-get-preview-file-name (&optional preview-command) 10.113 "Get file name to preview by inquiring YaTeX-get-latex-command" 10.114 + (if (null preview-command) (setq preview-command dvi2-command)) 10.115 (let* ((latex-cmd (YaTeX-get-latex-command t)) 10.116 (rin (rindex latex-cmd ? )) 10.117 (fname (if (> rin -1) (substring latex-cmd (1+ rin)) "")) 10.118 - (r (YaTeX-assoc-regexp dvi2-command YaTeX-dvi2-command-ext-alist)) 10.119 + (r (YaTeX-assoc-regexp preview-command YaTeX-dvi2-command-ext-alist)) 10.120 (ext (if r (cdr r) "")) 10.121 (period)) 10.122 (concat 10.123 @@ -780,8 +787,9 @@ 10.124 YaTeX-shell-command-option cmd)) 10.125 (t 10.126 (set-process-buffer 10.127 - (start-process "print" "*dvi-printing*" shell-file-name 10.128 - YaTeX-shell-command-option cmd) 10.129 + (let ((process-connection-type nil)) 10.130 + (start-process "print" "*dvi-printing*" shell-file-name 10.131 + YaTeX-shell-command-option cmd)) 10.132 (get-buffer lbuffer)) 10.133 (message "Starting printing command: %s..." cmd)))))) 10.134