diff --git a/docs/yatex.ref b/docs/yatex.ref index 5b9b3a6..bc3f830 100644 --- a/docs/yatex.ref +++ b/docs/yatex.ref @@ -114,6 +114,7 @@ �V�K�쐬/�X�V���[�h�A�������[�h�̐؂�ւ����j���[���o�܂��B ��%# �L�@�̕ҏW [prefix] % + ���I�����C���w���v [prefix] ? �L���Y�� yuuji@ae.keio.ac.jp diff --git a/docs/yatexadd.doc b/docs/yatexadd.doc index 7f59efd..132bcf7 100644 --- a/docs/yatexadd.doc +++ b/docs/yatexadd.doc @@ -32,10 +32,10 @@ �������ɁA�֐������������ł͎g���܂���:-)�Byatex-mode �N�����ɂ́A ���̊֐����`�����t�@�C�������[�h����Ă��Ȃ��Ă͂Ȃ�܂���B�֐� ���`����t�@�C������ yatexadd.el(�܂��̓o�C�g�R���p�C�������`�� - ��yatexadd.elc)�ɂ��A���̃t�@�C���� load-path ���ɒu���Ă����΁A + �� yatexadd.elc)�ɂ��A���̃t�@�C���� load-path ���ɒu���Ă����΁A �쒹�������I�Ƀ��[�h���܂��B����ȊO�̃t�@�C�����ɂ���ꍇ�́A - yatex-mode-hook �ɕt���֐����`���� Emacs-Lisp �t�@�C�������[�h�� - ��悤�Ȏd�|���������Ă����̂��悢�ł��傤�B + yatex-mode-load-hook �ɕt���֐����`���� Emacs-Lisp �t�@�C�������[ + �h����悤�Ȏd�|���������Ă����̂��悢�ł��傤�B �y�֐���`�z @@ -66,10 +66,10 @@ ~~~~ ~~~ �����^�t���֐��́wLaTeX�R�}���h���̑O�� YaTeX:: ���‚������O�x�Œ� - �`���܂��B�܂������^�t���֐����Ă΂�鎞�ɂ͉��Ԗڂ̈�������͂��� - ����̂��������Ƃ��ēn����܂��B���������āA�����^�t���֐��͐����� - ��������Ž����̂Ƃ��Ē�`���A���̈����̒l�ɂ�菈�������肷�邱 - �ƂɂȂ�܂��B + �`���܂��B�܂������^�t���֐����Ă΂�鎞�ɂ�section�^�R�}���h�̉� + �Ԗڂ̈�������͂��Ă���̂����֐��ւ̈����Ƃ��ēn����܂��B�������� + �āA�����^�t���֐��͐����̈�������Ž����̂Ƃ��Ē�`���A���̈��� + �̒l�ɂ�菈�������肷�邱�ƂɂȂ�܂��B �y��`��z @@ -106,8 +106,8 @@ (defun YaTeX::newcommand (n) ;n�͈����̈ʒu (cond ((= n 1) ;�������Ȃ�R�}���h�� - (concat "\\" (read-string "Command: "))) - ((= n 2) "") ;�������Ȃ牽������Ȃ� + (read-string "Command: " "\\")) ;\���������͂Ƃ��� + ((= n 2) "") ;�������Ȃ牽�����Ȃ� (t nil))) �Ȃ��A�����^�t���֐��� nil ��Ԃ����ꍇ�́A�ʏ�̈������͊֐����� diff --git a/yahtml.el b/yahtml.el index 3d8b43b..8483770 100644 --- a/yahtml.el +++ b/yahtml.el @@ -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 --git a/yatex.el b/yatex.el index 2a3f2a6..4b01328 100644 --- a/yatex.el +++ b/yatex.el Binary files differ diff --git a/yatex.new b/yatex.new index ef1a2c3..c393d60 100644 --- a/yatex.new +++ b/yatex.new @@ -1,7 +1,14 @@ - Yet Another tex-mode for Emacs yatex.el �e�o�[�W�����̕ύX�_�ɂ‚��āB +1.48 [prefix] ? �� YaTeX-help �ŃJ�[�\���ʒu�� LaTeX �R�}���h�̃w���v + ���o��悤�ɂ���(�w���v���e�͖�����)�B + begin �^�⊮�S�ʂł̃C���f���g���������̉��P�B + gmhist�Ƃ̘A�g�ɂ�� Preview, Lpr, call-command ���ꂼ��̃q�X�g + ���𑼂̃q�X�g���Ƃ͕����������B + \ref �⊮�ŃJ�����g�o�b�t�@�̃��x�����o�Ȃ��Ȃ��Ă����o�O���C���B + outline-minor-mode �Ƃ̘A�g�����܂������Ȃ������̂��C���B + 1.47 YaTeX-quick-in-environment-p �� YaTeX-get-latex-command �� �o�O�t�B�N�X�B @@ -10,6 +17,8 @@ �G���[�s�W�����v�̓K�����B �ċA�I section �^�⊮���̃o�O�t�B�N�X�B �e�t�@�C��������͂������ɓ�x�ڈȍ~�����̃t�@�C����e�Ƃ݂Ȃ��B + [prefix] g �Ńt�@�C���ԃW�����v�����鎞�ɁA���ɂ��̃t�@�C������ + �����̃E�B���h�E�ɏo�Ă���΁A���̃E�B���h�E�Ɉڂ�悤�ɂ����B \verb�̃A�h�C���֐��lj��B 1.45: comment-region �� begin/end �s�ŋN���������Ƀ��b�Z�[�W���o���B @@ -122,3 +131,7 @@ fill-prefix �� null �ɂ����B 1.27: �ŏ��̐��������[�X�� + +Local Variables: +mode: indented-text +End: diff --git a/yatexadd.el b/yatexadd.el index 5eaa98f..61ca116 100644 --- a/yatexadd.el +++ b/yatexadd.el @@ -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 --git a/yatexhlp.el b/yatexhlp.el new file mode 100644 index 0000000..452e3fc --- /dev/null +++ b/yatexhlp.el @@ -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 "�y�����z") + (t "[[ Synopsis ]]")) + "Section header of synopsis.") +(defvar YaTeX-help-description + (cond (YaTeX-japan "�y�����z") + (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 "���͂��I������ . �̂ݓ��͂���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 --git a/yatexm-o.el b/yatexm-o.el index 6b61dcb..8826a47 100644 --- a/yatexm-o.el +++ b/yatexm-o.el @@ -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(�g�p���Ȃ��ꍇ�͕s�v�ł�) @@ -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 --git a/yatexprc.el b/yatexprc.el index c59fffb..7de3442 100644 --- a/yatexprc.el +++ b/yatexprc.el @@ -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))) )