yatex

changeset 48:a0640ff3f72f

Inter-file ref/label, cite/bibitem jump.
author yuuji
date Mon, 31 Oct 1994 17:49:43 +0000
parents d7e7b4654058
children eb0512bfcb7f
files docs/yatex.ref docs/yatexe.tex docs/yatexj.tex help/YATEXHLP.jp yatex.el yatex.new yatexadd.el
diffstat 7 files changed, 116 insertions(+), 44 deletions(-) [+]
line diff
     1.1 --- a/docs/yatex.ref	Mon Oct 24 17:26:47 1994 +0000
     1.2 +++ b/docs/yatex.ref	Mon Oct 31 17:49:43 1994 +0000
     1.3 @@ -72,7 +72,9 @@
     1.4  
     1.5  	・\begin{}, \end{}の上		対応する \end{},\begin{} へ
     1.6  	・%#BEGIN, %#END の上		対応する %#BEGIN, %#END へ
     1.7 -	・\include(only), \input の上	対応するファイル
     1.8 +	・\include(only), \input の上   対応するファイルへ
     1.9 +	・\ref, \label の上             対応する \label, \ref へ
    1.10 +	・\cite, \bibitem の上          対応する \bibitem, \cite へ
    1.11  
    1.12  	◆メインファイルへジャンプ	[prefix] ^
    1.13  	◆別ウィンドウで   〃		[prefix] 4^
     2.1 --- a/docs/yatexe.tex	Mon Oct 24 17:26:47 1994 +0000
     2.2 +++ b/docs/yatexe.tex	Mon Oct 31 17:49:43 1994 +0000
     2.3 @@ -906,7 +906,7 @@
     2.4  @cindex cursor jump
     2.5  @cindex prefix g
     2.6  
     2.7 -  On a @code{\begin},@code{\end} line, the key stroke
     2.8 +  Typing
     2.9  
    2.10  @table @kbd
    2.11  @item [prefix] g
    2.12 @@ -914,13 +914,26 @@
    2.13  @end table
    2.14  
    2.15  @noindent
    2.16 +in a certain place move the cursor to the place corresponding to the
    2.17 +La@TeX{} command of last place.  YaTeX recognize the followings as pairs
    2.18 +that have relation each other.
    2.19 +
    2.20 +@table
    2.21 +@item @code{\begin@{@}} <-> @code{\end@{@}}
    2.22 +@item @code{%#BEGIN} <-> @code{%#END}
    2.23 +@item @code{\label@{@}} <-> @code{\ref@{@}}
    2.24 +@item @code{\include(\input)} -> included file
    2.25 +@item @code{\bibitem@{@}} <-> @code{\cite@{@}}
    2.26 +@end table
    2.27 +
    2.28 +  On a @code{\begin},@code{\end} line, typing @kbd{[prefix] g}
    2.29  moves the cursor to the corresponding @code{\end},@code{\begin} line, if
    2.30 -its partner really exists.  It is also applicable to A @code{%#BEGIN} and
    2.31 -@code{%#END} pair.
    2.32 +its partner really exists.  The movement on the line @code{%#BEGIN} and
    2.33 +@code{%#END} are the same.
    2.34  
    2.35    If you type @code{[prefix] g} on the line of @code{\include@{chap1@}},
    2.36 -maybe   in main text, YaTeX switches buffer to @file{chap1.tex}.  On the
    2.37 -contrary, the key strokes
    2.38 +typically in the main text, YaTeX switches buffer to @file{chap1.tex}.
    2.39 +The key strokes below work to the contrary.  Typing
    2.40  
    2.41  @table @kbd
    2.42  @item [prefix] ^
     3.1 --- a/docs/yatexj.tex	Mon Oct 24 17:26:47 1994 +0000
     3.2 +++ b/docs/yatexj.tex	Mon Oct 31 17:49:43 1994 +0000
     3.3 @@ -77,7 +77,8 @@
     3.4  @item 野鳥にないガイド付き引数入力関数の自動生成(@file{yatexgen.el})
     3.5  @item La@TeX{} コマンドの削除/変更(@kbd{C-c k}, @kbd{C-c c})
     3.6  @item ファイル間、@code{\begin}<->@code{\end}間、
     3.7 -        @code{\ref}<->@code{\label}間ジャンプ(@kbd{C-c g})
     3.8 +        @code{\ref}<->@code{\label}間、
     3.9 +        @code{\cite}<->@code{\bibitem}ジャンプ(@kbd{C-c g})
    3.10  @item 一括コメントアウト/アンコメントアウト
    3.11          (@kbd{C-c >}, @kbd{C-c <}, @kbd{C-c ,}, @kbd{C-c .})
    3.12  @item アクセント記号/数式環境用コマンド/ギリシャ文字の入力支援
    3.13 @@ -978,7 +979,7 @@
    3.14  @cindex カーソルジャンプ[かあそるしやんふ]
    3.15  @cindex prefix g
    3.16  
    3.17 -  @code{\begin@{@}} や @code{\end@{@}} の行にカーソルを合わせ、
    3.18 +  文書中のいろいろな場所で
    3.19  
    3.20  @table @kbd
    3.21  @item [prefix] g
    3.22 @@ -986,9 +987,21 @@
    3.23  @end table
    3.24  
    3.25  @noindent 
    3.26 +を押すことにより、カーソル位置のLa@TeX{}コマンドに対応する場所にジャンプ
    3.27 +します。対応関係が存在すると解釈されるコマンドには以下のものがあります。
    3.28 +
    3.29 +@table
    3.30 +@item @code{\begin@{@}}←→@code{\end@{@}}
    3.31 +@item @code{%#BEGIN}←→@code{%#END}
    3.32 +@item @code{\label@{@}}←→@code{\ref@{@}}
    3.33 +@item @code{\include(\input)}→対応するファイル
    3.34 +@item @code{\bibitem@{@}}←→@code{\cite@{@}}
    3.35 +@end table
    3.36 +
    3.37 +  @code{\begin@{@}} か @code{\end@{@}} の行で@kbd{[prefix] g}
    3.38  を押すことにより、対応する@code{end/begin}の行にジャンプします。もちろん対
    3.39  応するものがない場合はエラーになります。またこれは、領域固定のための 
    3.40 -@code{%#BEGIN} と @code{%#END} のペアに対しても使えます。
    3.41 +@code{%#BEGIN} と @code{%#END} のペアに対しても同様に動作します。
    3.42  @xref{%#記法}
    3.43  
    3.44    メインの .tex ファイルの @code{\include{chap1}} などにカーソルを合わせ、
    3.45 @@ -1025,6 +1038,8 @@
    3.46  上記のコマンドは通常の@kbd{[prefix]}キーではなく@kbd{META}キーをプリフィク
    3.47  スとして機能するのでご注意下さい。
    3.48  
    3.49 +  
    3.50 +
    3.51  @node Modifying/Deleting, Filling item, Cursor jump, Top
    3.52  @comment  node-name,  next,  previous,  up
    3.53  @chapter 変更/削除
     4.1 --- a/help/YATEXHLP.jp	Mon Oct 24 17:26:47 1994 +0000
     4.2 +++ b/help/YATEXHLP.jp	Mon Oct 31 17:49:43 1994 +0000
     4.3 @@ -1054,8 +1054,8 @@
     4.4  bibitem
     4.5  \bibitem{NAME}			\bibitem[LABEL]{NAME}
     4.6  \bibitem{NAME}の書式では、NAMEで参照され、[1],[2] のような形で引用記号が
     4.7 -出力される、\bibitem[LABEL]{NAME}の書式では、\cite{LABEL}で参照され、
     4.8 -[Knuth82] のような引用記号が出力される。
     4.9 +出力される、\bibitem[LABEL]{NAME}の書式では、\cite{NAME}で参照され、
    4.10 +[LABEL] のような引用記号が出力される。
    4.11  
    4.12  footnote
    4.13  \footnote{NOTE}
     5.1 Binary file yatex.el has changed
     6.1 --- a/yatex.new	Mon Oct 24 17:26:47 1994 +0000
     6.2 +++ b/yatex.new	Mon Oct 31 17:49:43 1994 +0000
     6.3 @@ -1,6 +1,11 @@
     6.4  	Yet Another tex-mode for Emacs
     6.5  	yatex.el 各バージョンの変更点について。
     6.6  
     6.7 +1.53	Emacs-19で新単語の更新がうまくいかなかったのを今度こそ直した。
     6.8 +	ref/labelジャンプで別のバッファのref/labelに飛べるようにした。
     6.9 +	ref/labelジャンプと同形式でcite/bibitem間で飛べるようにした。
    6.10 +	cite/bibitemのアドイン関数の追加。
    6.11 +
    6.12  1.52	外部プロセス用テンポラリバッファが別frameにある時には現frameにテ
    6.13  	ンポラリバッファをpopupしないようにした。
    6.14  	Hilightening に独自のタグを導入し、reverseVideo がON/OFFの時両方
     7.1 --- a/yatexadd.el	Mon Oct 24 17:26:47 1994 +0000
     7.2 +++ b/yatexadd.el	Mon Oct 31 17:49:43 1994 +0000
     7.3 @@ -2,7 +2,7 @@
     7.4  ;;; YaTeX add-in functions.
     7.5  ;;; yatexadd.el rev.9
     7.6  ;;; (c )1991-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
     7.7 -;;; Last modified Mon Aug 22 14:19:39 1994 on figaro
     7.8 +;;; Last modified Mon Oct 31 12:55:54 1994 on pajero
     7.9  ;;; $Id$
    7.10  
    7.11  ;;;
    7.12 @@ -246,6 +246,18 @@
    7.13    nil
    7.14  )
    7.15  
    7.16 +(defun YaTeX:cite ()
    7.17 +  (let ((comment (read-string "Comment for citation: ")))
    7.18 +    (if (string= comment "") ""
    7.19 +      (concat "[" comment "]")))
    7.20 +)
    7.21 +
    7.22 +(defun YaTeX:bibitem ()
    7.23 +  (let ((label (read-string "Citation label: ")))
    7.24 +    (if (string= label "") ""
    7.25 +      (concat "[" label "]")))
    7.26 +)
    7.27 +
    7.28  ;;;
    7.29  ;;Subroutine
    7.30  ;;;
    7.31 @@ -327,11 +339,12 @@
    7.32        (goto-char (match-beginning 0))))
    7.33      (message YaTeX-label-guide-msg))
    7.34  )
    7.35 -(defun YaTeX::ref (argp)
    7.36 +(defun YaTeX::ref (argp &optional labelcmd refcmd)
    7.37    (cond
    7.38     ((= argp 1)
    7.39      (save-excursion
    7.40 -      (let ((lnum 0) e0 m1 e1 label label-list (buf (current-buffer))
    7.41 +      (let ((lnum 0) e0 label label-list (buf (current-buffer))
    7.42 +	    (labelcmd (or labelcmd "label")) (refcmd (or refcmd "ref"))
    7.43  	    (p (point)) initl line)
    7.44  	(goto-char (point-min))
    7.45  	(message "Collecting labels...")
    7.46 @@ -339,27 +352,31 @@
    7.47  	  (YaTeX-showup-buffer
    7.48  	   YaTeX-label-buffer (function (lambda (x) (window-width x))))
    7.49  	  (with-output-to-temp-buffer YaTeX-label-buffer
    7.50 -	    (while (re-search-forward "\\label{\\([^}]+\\)}" nil t)
    7.51 -	      (setq e0 (match-end 0) m1 (match-beginning 1) e1 (match-end 1))
    7.52 -	      (if (search-backward
    7.53 -		   YaTeX-comment-prefix (point-beginning-of-line) t) nil
    7.54 -		(setq label (buffer-substring m1 e1)
    7.55 -		      label-list (cons label label-list))
    7.56 -		(or initl
    7.57 -		    (if (< p (point)) (setq initl lnum)))
    7.58 -		(beginning-of-line)
    7.59 -		(skip-chars-forward " \t\n" nil)
    7.60 -		(princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label
    7.61 -			       (buffer-substring (point) (point-end-of-line))))
    7.62 -		(setq lnum (1+ lnum))
    7.63 -		(message "Collecting \\label{}... %d" lnum))
    7.64 +	    (while (YaTeX-re-search-active-forward
    7.65 +		    (concat "\\\\" labelcmd)
    7.66 +		    (regexp-quote YaTeX-comment-prefix) nil t)
    7.67 +	      (goto-char (match-beginning 0))
    7.68 +	      (skip-chars-forward "^{")
    7.69 +	      (setq label
    7.70 +		    (buffer-substring
    7.71 +		     (1+ (point))
    7.72 +		     (prog2 (forward-list 1) (setq e0 (1- (point)))))
    7.73 +		    label-list (cons label label-list))
    7.74 +	      (or initl
    7.75 +		  (if (< p (point)) (setq initl lnum)))
    7.76 +	      (beginning-of-line)
    7.77 +	      (skip-chars-forward " \t\n" nil)
    7.78 +	      (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label
    7.79 +			     (buffer-substring (point) (point-end-of-line))))
    7.80 +	      (setq lnum (1+ lnum))
    7.81 +	      (message "Collecting \\%s{}... %d" labelcmd lnum)
    7.82  	      (goto-char e0))
    7.83  	    (princ YaTeX-label-menu-other)
    7.84  	    (princ YaTeX-label-menu-repeat)
    7.85  	    (princ YaTeX-label-menu-any)
    7.86  	    );with
    7.87  	  (goto-char p)
    7.88 -	  (message "Collecting labels...Done")
    7.89 +	  (message "Collecting %s...Done" labelcmd)
    7.90  	  (pop-to-buffer YaTeX-label-buffer)
    7.91  	  (YaTeX::label-setup-key-map)
    7.92  	  (setq truncate-lines t)
    7.93 @@ -379,12 +396,12 @@
    7.94  		  (save-excursion
    7.95  		    (switch-to-buffer buf)
    7.96  		    (goto-char p)
    7.97 -		    (if (re-search-backward "\\\\ref{\\([^}]+\\)}" nil t)
    7.98 -			(setq label (buffer-substring
    7.99 -				     (match-beginning 1) (match-end 1)))
   7.100 +		    (if (re-search-backward
   7.101 +			 (concat "\\\\" refcmd "{\\([^}]+\\)}") nil t)
   7.102 +			(setq label (YaTeX-match-string 1))
   7.103  		      (setq label ""))))
   7.104  		 ((>= line (+ lnum 2))
   7.105 -		  (setq label (read-string "\\ref{???}: ")))
   7.106 +		  (setq label (read-string (format "\\%s{???}: " refcmd))))
   7.107  		 (t (setq label (nth (- lnum line 1) label-list)))))
   7.108  	    (bury-buffer YaTeX-label-buffer)))
   7.109  	label
   7.110 @@ -392,19 +409,33 @@
   7.111      ))
   7.112  )
   7.113  (fset 'YaTeX::pageref 'YaTeX::ref)
   7.114 +(defun YaTeX::cite (argp)
   7.115 +  (cond
   7.116 +   ((eq argp 1)
   7.117 +    (YaTeX::ref argp "bibitem\\(\\[.*\\]\\)?" "cite"))
   7.118 +   (t nil)))
   7.119  
   7.120 -(defun YaTeX-label-other ()
   7.121 -  (let ((lbuf "*YaTeX mode buffers*") (blist (buffer-list)) (lnum -1) buf rv
   7.122 +(defun YaTeX-yatex-buffer-list ()
   7.123 +  (save-excursion
   7.124 +    (delq nil (mapcar (function (lambda (buf)
   7.125 +				  (set-buffer buf)
   7.126 +				  (if (eq major-mode 'yatex-mode) buf)))
   7.127 +		      (buffer-list))))
   7.128 +)
   7.129 +
   7.130 +(defun YaTeX-select-other-yatex-buffer ()
   7.131 +  "Select buffer from all yatex-mode's buffers interactivelly."
   7.132 +  (interactive)
   7.133 +  (let ((lbuf "*YaTeX mode buffers*") (blist (YaTeX-yatex-buffer-list))
   7.134 +	(lnum -1) buf rv
   7.135  	(ff "**find-file**"))
   7.136      (YaTeX-showup-buffer
   7.137       lbuf (function (lambda (x) 1)))	;;Select next window surely.
   7.138      (with-output-to-temp-buffer lbuf
   7.139        (while blist
   7.140 -	(if (and (buffer-file-name (setq buf (car blist)))
   7.141 -		 (progn (set-buffer buf) (eq major-mode 'yatex-mode)))
   7.142 -	    (princ
   7.143 -	     (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A)
   7.144 -		     (buffer-name buf))))
   7.145 +	(princ
   7.146 +	 (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A)
   7.147 +		 (buffer-name (car blist))))
   7.148  	(setq blist (cdr blist)))
   7.149        (princ (format "':{%s}" ff)))
   7.150      (pop-to-buffer lbuf)
   7.151 @@ -421,14 +452,20 @@
   7.152  		(if (re-search-forward "{\\([^\\}]+\\)}" (point-end-of-line) t)
   7.153  		    (buffer-substring (match-beginning 1) (match-end 1)) nil)))
   7.154        (kill-buffer lbuf))
   7.155 +    (if (string= rv ff)
   7.156 +	(progn
   7.157 +	  (call-interactively 'find-file)
   7.158 +	  (current-buffer))
   7.159 +      rv))
   7.160 +)
   7.161 +
   7.162 +(defun YaTeX-label-other ()
   7.163 +  (let ((rv (YaTeX-select-other-yatex-buffer)))
   7.164      (cond
   7.165       ((null rv) "")
   7.166 -     ((string= rv ff)
   7.167 -      (call-interactively 'find-file)
   7.168 -      (YaTeX::ref argp))
   7.169       (t
   7.170        (set-buffer rv)
   7.171 -      (YaTeX::ref argp)))
   7.172 +      (YaTeX::ref argp labelcmd refcmd)))
   7.173      )
   7.174  )
   7.175