# HG changeset patch # User yuuji # Date 768258851 0 # Node ID cb9afa9c12130f5552430457f0eceb13bd014153 # Parent cd762e8543379955d8f9b85d972938565c08f7bf Auto-indentation at begin-type completion works correctly. Hack for gmhist&gmhist-mh. Fix the bug on \ref-completion. YaTeX-help is now available. diff -r cd762e854337 -r cb9afa9c1213 docs/yatex.ref --- a/docs/yatex.ref Mon Apr 25 03:18:12 1994 +0000 +++ b/docs/yatex.ref Fri May 06 21:14:11 1994 +0000 @@ -114,6 +114,7 @@ 新規作成/更新モード、数式モードの切り替えメニューが出ます。 ◆%# 記法の編集 [prefix] % + ◆オンラインヘルプ [prefix] ? 広瀬雄二 yuuji@ae.keio.ac.jp diff -r cd762e854337 -r cb9afa9c1213 docs/yatexadd.doc --- a/docs/yatexadd.doc Mon Apr 25 03:18:12 1994 +0000 +++ b/docs/yatexadd.doc Fri May 06 21:14:11 1994 +0000 @@ -32,10 +32,10 @@ さすがに、関数を書くだけでは使えません:-)。yatex-mode 起動時には、 その関数を定義したファイルがロードされていなくてはなりません。関数 を定義するファイル名を yatexadd.el(またはバイトコンパイルした形式 - のyatexadd.elc)にし、そのファイルを load-path 中に置いておけば、 + の yatexadd.elc)にし、そのファイルを load-path 中に置いておけば、 野鳥が自動的にロードします。それ以外のファイル名にする場合は、 - yatex-mode-hook に付加関数を定義する Emacs-Lisp ファイルをロードす - るような仕掛けを書いておくのがよいでしょう。 + yatex-mode-load-hook に付加関数を定義する Emacs-Lisp ファイルをロー + ドするような仕掛けを書いておくのがよいでしょう。 【関数定義】 @@ -66,10 +66,10 @@ ~~~~ ~~~ 引数型付加関数は『LaTeXコマンド名の前に YaTeX:: をつけた名前』で定 - 義します。また引数型付加関数が呼ばれる時には何番目の引数を入力して - いるのかが引数として渡されます。したがって、引数型付加関数は整数の - 引数を一つ取るものとして定義し、その引数の値により処理を決定するこ - とになります。 + 義します。また引数型付加関数が呼ばれる時にはsection型コマンドの何 + 番目の引数を入力しているのかが関数への引数として渡されます。したがっ + て、引数型付加関数は整数の引数を一つ取るものとして定義し、その引数 + の値により処理を決定することになります。 【定義例】 @@ -106,8 +106,8 @@ (defun YaTeX::newcommand (n) ;nは引数の位置 (cond ((= n 1) ;第一引数ならコマンド名 - (concat "\\" (read-string "Command: "))) - ((= n 2) "") ;第二引数なら何も入れない + (read-string "Command: " "\\")) ;\を初期入力とする + ((= n 2) "") ;第二引数なら何もしない (t nil))) なお、引数型付加関数が nil を返した場合は、通常の引数入力関数が呼 diff -r cd762e854337 -r cb9afa9c1213 yahtml.el --- a/yahtml.el Mon Apr 25 03:18:12 1994 +0000 +++ b/yahtml.el Fri May 06 21:14:11 1994 +0000 @@ -1,6 +1,6 @@ ;;; -*- Emacs-Lisp -*- -;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@asciinet.or.jp] -;;; Last modified Sat Apr 23 02:27:54 1994 on pajero +;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@ascii-net.or.jp] +;;; Last modified Wed May 4 05:31:29 1994 on 98fa ;;; This is sample hack definition for HTML. ;;; ;;; [Purely tentative version] diff -r cd762e854337 -r cb9afa9c1213 yatex.el Binary file yatex.el has changed diff -r cd762e854337 -r cb9afa9c1213 yatex.new --- a/yatex.new Mon Apr 25 03:18:12 1994 +0000 +++ b/yatex.new Fri May 06 21:14:11 1994 +0000 @@ -1,7 +1,14 @@ - Yet Another tex-mode for Emacs yatex.el 各バージョンの変更点について。 +1.48 [prefix] ? の YaTeX-help でカーソル位置の LaTeX コマンドのヘルプ + が出るようにした(ヘルプ内容は未完成)。 + begin 型補完全般でのインデント調整処理の改善。 + gmhistとの連携により Preview, Lpr, call-command それぞれのヒスト + リを他のヒストリとは分離させた。 + \ref 補完でカレントバッファのラベルが出なくなっていたバグを修正。 + outline-minor-mode との連携がうまくいかなかったのを修正。 + 1.47 YaTeX-quick-in-environment-p と YaTeX-get-latex-command の バグフィクス。 @@ -10,6 +17,8 @@ エラー行ジャンプの適正化。 再帰的 section 型補完時のバグフィクス。 親ファイルを手入力した時に二度目以降もそのファイルを親とみなす。 + [prefix] g でファイル間ジャンプをする時に、既にそのファイルがど + こかのウィンドウに出ていれば、そのウィンドウに移るようにした。 \verbのアドイン関数追加。 1.45: comment-region を begin/end 行で起動した時にメッセージを出す。 @@ -122,3 +131,7 @@ fill-prefix を null にした。 1.27: 最初の正式リリース版 + +Local Variables: +mode: indented-text +End: diff -r cd762e854337 -r cb9afa9c1213 yatexadd.el --- a/yatexadd.el Mon Apr 25 03:18:12 1994 +0000 +++ b/yatexadd.el Fri May 06 21:14:11 1994 +0000 @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX add-in functions. -;;; yatexadd.el rev.7 +;;; yatexadd.el rev.8 ;;; (c )1991-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Sat Apr 23 02:26:47 1994 on pajero +;;; Last modified Sat May 7 06:09:39 1994 on pajero ;;; $Id$ (provide 'yatexadd) @@ -80,6 +80,10 @@ (fset 'YaTeX:eqnarray 'YaTeX:equation) (fset 'YaTeX:displaymath 'YaTeX:equation) +(defun YaTeX:list () + "%\n{} %default label\n{} %formatting parameter" +) + ;;; ;;Sample functions for section-type command. ;;; @@ -292,6 +296,7 @@ )) )) ) +(fset 'YaTeX::pageref 'YaTeX::ref) (defun YaTeX-label-other () (let ((lbuf "*YaTeX mode buffers*") (blist (buffer-list)) (lnum -1) buf rv @@ -360,6 +365,24 @@ (t "")) ) +;; +; completion for the arguments of \pagestyle +;; +(defun YaTeX::pagestyle (&optional argp) + "Read the pagestyle with completion." + (completing-read + "Page style: " + '(("plain") ("empty") ("headings") ("myheadings") ("normal") nil)) +) +;; +; completion for the arguments of \pagenumbering +;; +(defun YaTeX::pagenumbering (&optional argp) + "Read the numbering style." + (completing-read + "Page numbering style: " + '(("arabic") ("Alpha") ("alpha") ("Roman") ("roman"))) +) ;;; ;; global subroutines diff -r cd762e854337 -r cb9afa9c1213 yatexhlp.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yatexhlp.el Fri May 06 21:14:11 1994 +0000 @@ -0,0 +1,198 @@ +;;; -*- Emacs-Lisp -*- +;;; YaTeX helper with LaTeX commands and macros. +;;; yatexhlp.el +;;; (c )1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] +;;; Last modified Thu May 5 16:09:42 1994 on 98fa +;;; $Id$ + +(let ((help-file + (concat "YATEXHLP." + (cond (YaTeX-japan "jp") + (t "eng"))))) + (defvar YaTeX-help-file + (expand-file-name help-file exec-directory) + "*Help file of LaTeX/TeX commands or macros.") + (defvar YaTeX-help-file-private + (expand-file-name (concat "~/" help-file)) + "*Private help file of LaTeX/TeX macros.") +) +(defvar YaTeX-help-delimiter "\C-_" "Delimiter of each help entry.") +(defvar YaTeX-help-entry-map (copy-keymap YaTeX-mode-map) + "Key map used in help entry.") +(defvar YaTeX-help-file-current nil + "Holds help file name to which the description in current buffer should go.") +(defvar YaTeX-help-command-current nil + "Holds command name on which the user currently write description.") +(defvar YaTeX-help-saved-config nil + "Holds window configruation before the editing of manual.") +(defvar YaTeX-help-synopsis + (cond (YaTeX-japan "【書式】") + (t "[[ Synopsis ]]")) + "Section header of synopsis.") +(defvar YaTeX-help-description + (cond (YaTeX-japan "【説明】") + (t "[[ Description ]]")) + "Section header of description.") + +(defun YaTeX-refer-help (command help-file) + "Refer the COMMAND's help into HELP-FILE. +\[Help-file format\] + + + +Where: is the value of YaTeX-help-delimiter. + is newline. + is newline or end of buffer." + (let ((hfbuf (find-file-noselect help-file)) + (hbuf (get-buffer-create "** YaTeX HELP **")) + (curwin (selected-window)) + sb se db de) + (set-buffer hfbuf) + (goto-char (point-min)) + (if (null + (re-search-forward + (concat (regexp-quote YaTeX-help-delimiter) + (regexp-quote command) + "$") nil t)) + nil ;if not found, return nil + (forward-line 1) + (setq sb (point) + se (progn (forward-line 1) (point)) + db (point) + de (progn + (re-search-forward (regexp-quote YaTeX-help-delimiter) nil 1) + (1- (match-beginning 0)))) + (YaTeX-showup-buffer hbuf) + (pop-to-buffer hbuf) + (erase-buffer) + (insert YaTeX-help-synopsis "\n") + (insert-buffer-substring hfbuf sb se) + (insert "\n" YaTeX-help-description "\n") + (insert-buffer-substring hfbuf db de) + (goto-char (point-min)) + (select-window curwin) + t)) +) +(defun YaTeX-help-newline (&optional arg) + (interactive "P") + (if (and (= (current-column) 1) (= (preceding-char) ?.) (eolp)) + (let ((cbuf (current-buffer))) + (beginning-of-line) + (kill-line 1) + (save-excursion + (YaTeX-help-add-entry + YaTeX-help-command-current YaTeX-help-file-current)) + (set-window-configuration YaTeX-help-saved-config) + (bury-buffer cbuf)) + (newline arg)) +) +(defun YaTeX-help-add-entry (command help-file) + (let ((hfbuf (find-file-noselect help-file)) + (dbuf (current-buffer)) beg end) + (goto-char (point-min)) + (re-search-forward (concat "^" (regexp-quote YaTeX-help-synopsis))) + (forward-line 1) (setq beg (point)) + (end-of-line) (setq end (point)) + (set-buffer hfbuf) + (goto-char (point-min)) + (insert YaTeX-help-delimiter command "\n") + (insert-buffer-substring dbuf beg end) + (insert "\n") + (set-buffer dbuf) + (re-search-forward (concat "^" (regexp-quote YaTeX-help-description))) + (forward-line 1) + (setq beg (point)) + (setq end (point-max)) + (set-buffer hfbuf) + (insert-buffer-substring dbuf beg end) + (insert "\n\n") + (forward-line -1) + (delete-blank-lines) + (let ((make-backup-files t)) + (basic-save-buffer)) + (bury-buffer hfbuf)) +) +(defun YaTeX-help-prepare-entry (command help-file) + "Read help description on COMMAND and add it to HELP-FILE." + (let ((buf (get-buffer-create "**Description**")) + (conf (current-window-configuration))) + (YaTeX-showup-buffer buf) + (pop-to-buffer buf) + (make-local-variable 'YaTeX-help-file-current) + (make-local-variable 'YaTeX-help-command-current) + (make-local-variable 'YaTeX-help-saved-config) + (setq YaTeX-help-file-current help-file + YaTeX-help-command-current command + YaTeX-help-saved-config conf + mode-name "Text" + major-mode 'text) + (erase-buffer) + (insert YaTeX-help-synopsis "\n\n" YaTeX-help-description "\n\n") + (define-key YaTeX-help-entry-map "\r" 'YaTeX-help-newline) + (use-local-map YaTeX-help-entry-map) + (message + (cond (YaTeX-japan "入力を終えたら . のみ入力してRET") + (t "Type only `.' and RET to exit.")))) +) +(defun YaTeX-enrich-help (command) + "Add the COMMAND's help to help file." + (if (y-or-n-p (format "No help on `%s'. Create help?" command)) + (YaTeX-help-prepare-entry + command + (if (y-or-n-p "Add help to global documentation?") + YaTeX-help-file YaTeX-help-file-private))) +) + +(defun YaTeX-help-sort (&optional help-file) + "Sort help file HELP-FILE. +If HELP-FILE is nil or called interactively, sort current buffer +as a help file." + (interactive) + (if help-file (set-buffer (find-file-noselect help-file))) + (sort-regexp-fields + nil "\\(\\sw+\\)\\([^]+\\|\\s'\\)" "\\1" (point-min) (point-max)) +) + +;;;###autoload +(defun YaTeX-help () + "Show help buffer of LaTeX/TeX commands or macros." + (interactive) + (let (p beg end command) + (save-excursion + (if (looking-at YaTeX-ec-regexp) + (goto-char (match-end 0))) + (setq p (point)) ;remember current position. + (cond + ((YaTeX-on-begin-end-p) + ;;if on \begin or \end, extract its environment. + (setq command + (cond ((match-beginning 1) + (buffer-substring (match-beginning 1) (match-end 1))) + ((match-beginning 2) + (buffer-substring (match-beginning 2) (match-end 2)))))) + ((search-backward YaTeX-ec (point-beginning-of-line) t) + (goto-char (setq beg (match-end 0))) + (re-search-forward "\\sw+") + (setq end (point)) + (if (and (<= beg p) (<= p end)) + (setq command (buffer-substring beg end))))) + (if (or (string= command "begin") (string= command "end")) + (progn + (search-forward "{" (point-end-of-line)) + (setq beg (point)) + (search-forward "}" (point-end-of-line)) + (setq command (buffer-substring beg (match-beginning 0))))) + (setq command + (completing-read + "Describe (La)TeX command: " + (append + section-table user-section-table tmp-section-table + article-table user-article-table + env-table user-env-table tmp-env-table + singlecmd-table user-singlecmd-table tmp-singlecmd-table) + nil nil command)) ;no-predicate, not require match + );end excursion + (or (YaTeX-refer-help command YaTeX-help-file) + (YaTeX-refer-help command YaTeX-help-file-private) + (YaTeX-enrich-help command))) +) diff -r cd762e854337 -r cb9afa9c1213 yatexm-o.el --- a/yatexm-o.el Mon Apr 25 03:18:12 1994 +0000 +++ b/yatexm-o.el Fri May 06 21:14:11 1994 +0000 @@ -1,7 +1,7 @@ ;;; -*- Emacs-Lisp -*- ;;; Sample startup file to invoke yatex-mode with outline-minor mode. ;;; (c )1993 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] -;;; Last modified Sat Jan 29 16:55:05 1994 on gloria +;;; Last modified Wed May 4 19:44:53 1994 on 98fa ;;; ;; outline-minor-mode(使用しない場合は不要です) @@ -26,11 +26,12 @@ (defvar yatex-mode-hook '(lambda () (setq outline-regexp LaTeX-outline-regexp) ;;@ - (outline-minor-mode) ;;@ - (YaTeX-define-begend-key "ba" "abstract"))) + (outline-minor-mode 1) ;;@ + )) (defvar yatex-mode-load-hook '(lambda () (setq-default outline-prefix-char (concat YaTeX-prefix "\C-o"));;@ (require 'min-out) ;;@ (define-key outline-minor-keymap "\C-?" 'hide-subtree) ;;@ + (YaTeX-define-begend-key "ba" "abstract") )) diff -r cd762e854337 -r cb9afa9c1213 yatexprc.el --- a/yatexprc.el Mon Apr 25 03:18:12 1994 +0000 +++ b/yatexprc.el Fri May 06 21:14:11 1994 +0000 @@ -2,7 +2,7 @@ ;;; YaTeX process handler. ;;; yatexprc.el ;;; (c )1993-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Mon Apr 25 12:13:17 1994 on alto +;;; Last modified Thu May 5 17:33:04 1994 on 98fa ;;; $Id$ (require 'yatex) @@ -132,21 +132,21 @@ (let* ((end "") typeout ;Type out message that tells the method of cutting. (cmd (concat (YaTeX-get-latex-command nil) " " YaTeX-texput-file)) - (buffer (current-buffer)) opoint preamble - (region - (if (re-search-backward - "%#BEGIN" nil t) - (progn - (setq typeout "--- Region from BEGIN to " end "END ---") - (buffer-substring - (match-end 0) - (if (re-search-forward "%#END" nil t) - (match-beginning 0) - (setq end "end of buffer ---") - (point-max)))) - (setq typeout "=== Region from (point) to (mark) ===") - (buffer-substring (point) (mark))))) + (buffer (current-buffer)) opoint preamble main + reg-begin reg-end) + + (if (re-search-backward "%#BEGIN" nil t) + (progn + (setq typeout "--- Region from BEGIN to " end "END ---" + reg-begin (match-end 0)) + (if (re-search-forward "%#END" nil t) + (setq reg-end (match-beginning 0) + end "end of buffer ---") + (setq reg-end (point-max)))) + (setq typeout "=== Region from (point) to (mark) ===") + (setq reg-begin (point) reg-end (mark))) (YaTeX-visit-main t) + (setq main (current-buffer)) (setq opoint (point)) (goto-char (point-min)) (setq @@ -157,17 +157,18 @@ "\\begin{document}"))) (goto-char opoint) ;;(set-buffer buffer) ;for clarity - (find-file YaTeX-texput-file) + (set-buffer (find-file-noselect YaTeX-texput-file)) + ;;(find-file YaTeX-texput-file) (erase-buffer) (if YaTeX-need-nonstop (insert "\\nonstopmode{}\n")) (insert preamble "\n") - (insert region) + (insert-buffer-substring buffer reg-begin reg-end) (insert "\\typeout{" typeout end "}\n") ;Notice the selected method. (insert "\n\\end{document}\n") (basic-save-buffer) (kill-buffer (current-buffer)) - (YaTeX-visit-main t) + (set-buffer main) ;return to parent file or itself. (YaTeX-typeset cmd YaTeX-typeset-buffer) (put 'dvi2-command 'region t))) ) @@ -226,11 +227,15 @@ (put 'dvi2-command 'region nil)) ) +(defvar YaTeX-call-command-history nil + "Holds history list of YaTeX-call-command-on-file.") +(put 'YaTeX-call-command-history 'no-default t) (defun YaTeX-call-command-on-file (base-cmd buffer) (YaTeX-save-buffers) (YaTeX-typeset - (read-string "Call command: " - (concat base-cmd " " (YaTeX-get-preview-file-name))) + (let ((minibufer-history-symbol 'YaTeX-call-command-history)) + (read-string "Call command: " + (concat base-cmd " " (YaTeX-get-preview-file-name)))) buffer) ) @@ -262,16 +267,25 @@ (start-process "system" buffer shell-file-name "-c" command)))) ) +(defvar YaTeX-preview-command-history nil + "Holds minibuffer history of preview command.") +(put 'YaTeX-preview-command-history 'no-default t) +(defvar YaTeX-preview-file-history nil + "Holds minibuffer history of file to preview.") +(put 'YaTeX-preview-file-history 'no-default t) (defun YaTeX-preview (preview-command preview-file) "Execute xdvi (or other) to tex-preview." (interactive - (list (read-string "Preview command: " dvi2-command) - (read-string "Preview file[.dvi]: " - (if (get 'dvi2-command 'region) - (substring YaTeX-texput-file - 0 (rindex YaTeX-texput-file ?.)) - (YaTeX-get-preview-file-name)) - ))) + (list + (let ((minibuffer-history-symbol 'YaTeX-preview-command-history)) + (read-string "Preview command: " dvi2-command)) + (let ((minibuffer-history-symbol 'YaTeX-preview-file-history)) + (read-string "Preview file[.dvi]: " + (if (get 'dvi2-command 'region) + (substring YaTeX-texput-file + 0 (rindex YaTeX-texput-file ?.)) + (YaTeX-get-preview-file-name)) + )))) (setq dvi2-command preview-command) (save-excursion (YaTeX-visit-main t) @@ -480,9 +494,12 @@ (switch (if (string-match "\\s " magic) magic (concat magic " " parent))) (t (concat (substring magic 0 (string-match "\\s " magic)) " ")))) - (t (concat tex-command " " parent)))) + (t (concat tex-command " " (if switch parent))))) ) +(defvar YaTeX-lpr-command-history nil + "Holds command line history of YaTeX-lpr.") +(put 'YaTeX-lpr-command-history 'no-default t) (defun YaTeX-lpr (arg) "Print out. If prefix arg ARG is non nil, call print driver without page range description." @@ -511,8 +528,10 @@ "" (YaTeX-replace-format dviprint-to-format "e" to))) ) - (setq cmd (read-string "Edit command line: " - (format cmd (YaTeX-get-preview-file-name)))) + (setq cmd + (let ((minibuffer-history-symbol 'YaTeX-lpr-command-history)) + (read-string "Edit command line: " + (format cmd (YaTeX-get-preview-file-name))))) (save-excursion (YaTeX-visit-main t) ;;change execution directory (with-output-to-temp-buffer "*dvi-printing*" @@ -625,7 +644,8 @@ of its window object. Non-nil for optional third argument SELECT selects that window." (or (and (get-buffer-window buffer) - (progn (if select (select-window (get-buffer-window buffer))) t)) + (progn (if select (select-window (get-buffer-window buffer))) + t)) (cond ((> (length (YaTeX-window-list)) 2) (let ((window (selected-window)) @@ -642,8 +662,10 @@ (switch-to-buffer buffer) (or select (select-window window)))) ((= (length (YaTeX-window-list)) 2) - (other-window 1) - (switch-to-buffer buffer)) + (let ((window (selected-window))) + (other-window 1) + (switch-to-buffer buffer) + (or select (select-window window)))) (t nil))) )