annotate yatexhlp.el @ 364:d69fd7b1ac4d dev yatex-1.78

yatex-1.78
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 26 Dec 2014 01:02:52 +0900
parents 5465428f5a68
children 77a2fd4fd634
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
287
5921f28ef77c Change the first lines.
HIROSE Yuuji <yuuji@gentei.org>
parents: 80
diff changeset
1 ;;; yatexhlp.el --- YaTeX helper with LaTeX commands and macros
5921f28ef77c Change the first lines.
HIROSE Yuuji <yuuji@gentei.org>
parents: 80
diff changeset
2 ;;;
353
2a72779d9c50 Rewrite lambda notations to suppress annoying warnings from emacs24
HIROSE Yuuji <yuuji@gentei.org>
parents: 339
diff changeset
3 ;;; (c)1994,1998,2004,2014 by HIROSE Yuuji.[yuuji@yatex.org]
354
5465428f5a68 `[prefix] t e' displays typesetting image in the next window, if possible.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
4 ;;; Last modified Sun Dec 21 22:55:07 2014 on firestorm
364
d69fd7b1ac4d yatex-1.78
HIROSE Yuuji <yuuji@gentei.org>
parents: 354
diff changeset
5 ;;; $Id: yatexhlp.el,v 1.78 2014/12/25 15:11:02 yuuji Rel $
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
6
287
5921f28ef77c Change the first lines.
HIROSE Yuuji <yuuji@gentei.org>
parents: 80
diff changeset
7 ;;; Code:
46
cd1b63102eed Support Mule2
yuuji
parents: 23
diff changeset
8 (let ((help-file (concat "YATEXHLP."
cd1b63102eed Support Mule2
yuuji
parents: 23
diff changeset
9 (cond (YaTeX-japan "jp")
cd1b63102eed Support Mule2
yuuji
parents: 23
diff changeset
10 (t "eng"))))
cd1b63102eed Support Mule2
yuuji
parents: 23
diff changeset
11 (help-dir
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
12 (cond
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 59
diff changeset
13 ((and (boundp 'site-directory) site-directory) site-directory)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
14 ((string-match "\\.app/" doc-directory) ;For Emacs.app(Darwin)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
15 (expand-file-name "../site-lisp" doc-directory))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
16 (YaTeX-emacs-19 (expand-file-name "../../site-lisp" doc-directory))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
17 (t exec-directory))))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
18 (defvar YaTeX-help-file
46
cd1b63102eed Support Mule2
yuuji
parents: 23
diff changeset
19 (expand-file-name help-file help-dir)
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
20 "*Help file of LaTeX/TeX commands or macros.")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
21 (defvar YaTeX-help-file-private
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
22 (expand-file-name (concat "~/" help-file))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 59
diff changeset
23 "*Private help file of LaTeX/TeX macros."))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 59
diff changeset
24
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
25 (defvar YaTeX-help-delimiter "\C-_" "Delimiter of each help entry.")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
26 (defvar YaTeX-help-entry-map (copy-keymap YaTeX-mode-map)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
27 "Key map used in help entry.")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
28 (defvar YaTeX-help-file-current nil
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
29 "Holds help file name to which the description in current buffer should go.")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
30 (defvar YaTeX-help-command-current nil
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
31 "Holds command name on which the user currently write description.")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
32 (defvar YaTeX-help-saved-config nil
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
33 "Holds window configruation before the editing of manual.")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
34 (defvar YaTeX-help-synopsis
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
35 (cond (YaTeX-japan "yz")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
36 (t "[[ Synopsis ]]"))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
37 "Section header of synopsis.")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
38 (defvar YaTeX-help-description
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
39 (cond (YaTeX-japan "yz")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
40 (t "[[ Description ]]"))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
41 "Section header of description.")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
42
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
43 (defvar YaTeX-help-mode-map nil "Keymap used in YaTeX-help buffer")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
44 (if YaTeX-help-mode-map nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
45 (setq YaTeX-help-mode-map (make-sparse-keymap))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
46 (let ((map YaTeX-help-mode-map))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
47 (suppress-keymap map)
353
2a72779d9c50 Rewrite lambda notations to suppress annoying warnings from emacs24
HIROSE Yuuji <yuuji@gentei.org>
parents: 339
diff changeset
48 (define-key map "j" (function (lambda () (interactive) (scroll-up 1))))
2a72779d9c50 Rewrite lambda notations to suppress annoying warnings from emacs24
HIROSE Yuuji <yuuji@gentei.org>
parents: 339
diff changeset
49 (define-key map "k" (function (lambda () (interactive) (scroll-up -1))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
50 (define-key map "n" 'next-line)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
51 (define-key map "p" 'previous-line)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
52 (define-key map " " 'scroll-up)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
53 (define-key map "\C-?" 'scroll-down)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
54 (define-key map "o" 'other-window)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
55 (define-key map "h" 'describe-bindings)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
56 (define-key map "q" 'YaTeX-help-quit)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
57 (define-key map "<" 'beginning-of-buffer)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
58 (define-key map ">" 'end-of-buffer)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
59
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
60 (defun YaTeX-help-quit ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
61 "Close help and return to privious buffer"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
62 (interactive)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
63 (bury-buffer (current-buffer))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
64 (set-window-configuration YaTeX-help-saved-config))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
65
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
66 (defvar YaTeX-help-reference-regexp "<refer\\s +\\([^>]+\\)>"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
67 "Regexp of reference format of YaTeX-help file.")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
68 (defvar YaTeX-help-buffer "** YaTeX HELP **" "Help buffer name for yatexhlp")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
69
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
70 (defun YaTeX-help-entries ()
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
71 "Return the alist which contains all the entries in YaTeX-help file."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
72 (let (entries entry)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
73 (save-excursion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
74 (mapcar
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
75 (function
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
76 (lambda (help)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
77 (if (file-exists-p help)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
78 (progn
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
79 (set-buffer (find-file-noselect help))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
80 (save-excursion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
81 (goto-char (point-min))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
82 (while (re-search-forward
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
83 (concat "^" (regexp-quote YaTeX-help-delimiter)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
84 "\\(.+\\)$") nil t)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
85 (setq entry (buffer-substring
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
86 (match-beginning 1) (match-end 1)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
87 (or (assoc entry entries)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
88 (setq entries (cons (list entry) entries)))))))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
89 (list YaTeX-help-file YaTeX-help-file-private)))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
90 entries))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
91
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
92 (defvar YaTeX-help-entries nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
93 "Helo entries alist.")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
94 (setq YaTeX-help-entries (YaTeX-help-entries))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
95
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
96 (defun YaTeX-help-resolve-reference (buffer1 buffer2 &optional done-list)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
97 "Replace reference format in buffer1 with refered contents in buffer2."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
98 (let (ref ref-list beg end)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
99 (save-excursion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
100 (switch-to-buffer buffer1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
101 (goto-char (point-min))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
102 (while (re-search-forward YaTeX-help-reference-regexp nil t)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
103 (setq ref (buffer-substring (match-beginning 1) (match-end 1))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
104 ref-list (cons (list ref) ref-list))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
105 (replace-match "")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
106 (if (assoc ref done-list) nil ;already documented.
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
107 (switch-to-buffer buffer2)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
108 (save-excursion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
109 (goto-char (point-min))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
110 (if (re-search-forward
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
111 (concat (regexp-quote YaTeX-help-delimiter)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
112 (regexp-quote ref)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
113 "$") nil t)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
114 (progn
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
115 (setq beg (progn (forward-line 2) (point))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
116 end (progn
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
117 (re-search-forward
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
118 (concat "^" (regexp-quote YaTeX-help-delimiter))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
119 nil 1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
120 (goto-char (match-beginning 0))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
121 (forward-line -1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
122 (while (and (bolp) (eolp) (not (bobp)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
123 (forward-char -1))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
124 (point)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
125 (switch-to-buffer buffer1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
126 (insert-buffer-substring buffer2 beg end))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
127 (switch-to-buffer buffer1)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
128 (if beg (YaTeX-help-resolve-reference
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
129 buffer1 buffer2 (append done-list ref-list))))))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
130
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
131 (defun YaTeX-refer-help (command help-file &optional append)
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
132 "Refer the COMMAND's help into HELP-FILE.
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
133 \[Help-file format\]
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
134 <DELIM><LaTeX/TeX command without escape character(\\)><NL>
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
135 <Synopsis><NL>
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
136 <Documentation><TERM>
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
137 Where: <DELIM> is the value of YaTeX-help-delimiter.
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
138 <NL> is newline.
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
139 <TERM> is newline or end of buffer."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
140 (let ((hfbuf (find-file-noselect help-file))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
141 (hbuf (get-buffer-create YaTeX-help-buffer))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
142 (curwin (selected-window))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
143 sb se db de)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
144 (set-buffer hfbuf)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
145 (goto-char (point-min))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
146 (if (null
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
147 (let ((case-fold-search nil))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
148 (re-search-forward
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
149 (concat (regexp-quote YaTeX-help-delimiter)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
150 (regexp-quote command)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
151 "$") nil t)))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
152 nil ;if not found, return nil
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
153 (forward-line 1)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
154 (setq sb (point)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
155 se (progn (forward-line 1) (point))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
156 db (point)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
157 de (progn
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
158 (re-search-forward
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
159 (concat "^" (regexp-quote YaTeX-help-delimiter)) nil 1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
160 (- (point) (length YaTeX-help-delimiter))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
161 (YaTeX-showup-buffer
354
5465428f5a68 `[prefix] t e' displays typesetting image in the next window, if possible.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
162 hbuf 'YaTeX-showup-buffer-bottom-most t)
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
163 (set-buffer hbuf)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
164 (setq buffer-read-only nil)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
165 (if append (goto-char (point-max)) (erase-buffer))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
166 (insert YaTeX-help-synopsis "\n")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
167 (insert-buffer-substring hfbuf sb se)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
168 (insert "\n" YaTeX-help-description "\n")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
169 (insert-buffer-substring hfbuf db de)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
170 (YaTeX-help-resolve-reference hbuf hfbuf (list (list command)))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
171 (goto-char (point-min))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
172 (setq buffer-read-only t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
173 (set-buffer-modified-p nil)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
174 (YaTeX-help-mode)
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
175 (select-window curwin)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
176 t)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
177
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
178 (defun YaTeX-help-mode ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
179 (interactive)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
180 (use-local-map YaTeX-help-mode-map)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
181 (setq major-mode 'yatex-help-mode
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
182 mode-name "YaTeX-HELP"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
183
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
184 (defun YaTeX-help-newline (&optional arg)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
185 (interactive "P")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
186 (if (and (= (current-column) 1) (= (preceding-char) ?.) (eolp))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
187 (let ((cbuf (current-buffer)))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
188 (beginning-of-line)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 49
diff changeset
189 (delete-region (point) (progn (forward-line 1) (point)))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
190 (save-excursion
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
191 (YaTeX-help-add-entry
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
192 YaTeX-help-command-current YaTeX-help-file-current))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
193 (set-window-configuration YaTeX-help-saved-config)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
194 (bury-buffer cbuf))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
195 (newline arg)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
196
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
197 (defun YaTeX-help-add-entry (command help-file)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
198 (let ((hfbuf (find-file-noselect help-file))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
199 (dbuf (current-buffer)) beg end)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
200 (goto-char (point-min))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
201 (re-search-forward (concat "^" (regexp-quote YaTeX-help-synopsis)))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
202 (forward-line 1) (setq beg (point))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
203 (end-of-line) (setq end (point))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
204 (set-buffer hfbuf)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
205 (goto-char (point-min))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
206 (insert YaTeX-help-delimiter command "\n")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
207 (insert-buffer-substring dbuf beg end)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
208 (insert "\n")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
209 (set-buffer dbuf)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
210 (re-search-forward (concat "^" (regexp-quote YaTeX-help-description)))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
211 (forward-line 1)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
212 (setq beg (point))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
213 (setq end (point-max))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
214 (set-buffer hfbuf)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
215 (insert-buffer-substring dbuf beg end)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
216 (insert "\n\n")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
217 (forward-line -1)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
218 (delete-blank-lines)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
219 (let ((make-backup-files t))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
220 (basic-save-buffer))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
221 (bury-buffer hfbuf)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
222 (setq YaTeX-help-entries (cons (list command) YaTeX-help-entries))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
223
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
224 (defun YaTeX-help-prepare-entry (command help-file)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
225 "Read help description on COMMAND and add it to HELP-FILE."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
226 (let ((buf (get-buffer-create "**Description**"))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
227 (conf (current-window-configuration)))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
228 (YaTeX-showup-buffer
354
5465428f5a68 `[prefix] t e' displays typesetting image in the next window, if possible.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
229 buf 'YaTeX-showup-buffer-bottom-most t)
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
230 (make-local-variable 'YaTeX-help-file-current)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
231 (make-local-variable 'YaTeX-help-command-current)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
232 (make-local-variable 'YaTeX-help-saved-config)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
233 (setq YaTeX-help-file-current help-file
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
234 YaTeX-help-command-current command
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
235 YaTeX-help-saved-config conf
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
236 mode-name "Text"
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
237 major-mode 'text)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
238 (erase-buffer)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
239 (insert YaTeX-help-synopsis "\n\n" YaTeX-help-description "\n\n")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
240 (define-key YaTeX-help-entry-map "\r" 'YaTeX-help-newline)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
241 (use-local-map YaTeX-help-entry-map)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
242 (message
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
243 (cond (YaTeX-japan "͂I . ̂ݓ͂RET")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
244 (t "Type only `.' and RET to exit.")))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
245
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
246 (defun YaTeX-enrich-help (command)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
247 "Add the COMMAND's help to help file."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
248 (if (y-or-n-p (format "No help on `%s'. Create help?" command))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
249 (YaTeX-help-prepare-entry
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
250 command
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
251 (if (y-or-n-p "Add help to global documentation?")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
252 YaTeX-help-file YaTeX-help-file-private))))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
253
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
254 (defun YaTeX-help-sort (&optional help-file)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
255 "Sort help file HELP-FILE.
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
256 If HELP-FILE is nil or called interactively, sort current buffer
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
257 as a help file."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
258 (interactive)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
259 (if help-file (set-buffer (find-file-noselect help-file)))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
260 (sort-regexp-fields
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
261 nil "\\(\\sw+\\)\\([^]+\\|\\s'\\)" "\\1" (point-min) (point-max)))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
262
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
263 (defun YaTeX-apropos-file (keyword help-file &optional append)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
264 (let ((hb (find-file-noselect help-file))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
265 (ab (get-buffer-create YaTeX-help-buffer))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
266 (sw (selected-window))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
267 (head (concat "^" (regexp-quote YaTeX-help-delimiter)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
268 pt command)
354
5465428f5a68 `[prefix] t e' displays typesetting image in the next window, if possible.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
269 (YaTeX-showup-buffer ab 'YaTeX-showup-buffer-bottom-most)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
270 (select-window (get-buffer-window ab))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
271 (set-buffer ab) ;assertion
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
272 (setq buffer-read-only nil)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
273 (or append (erase-buffer))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
274 (set-buffer hb)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
275 (goto-char (point-min))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
276 (while (re-search-forward keyword nil t)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
277 (setq pt (point))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
278 (re-search-backward head nil t)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
279 (setq command (buffer-substring (match-end 0) (point-end-of-line)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
280 (switch-to-buffer ab)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
281 (goto-char (point-max))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
282 (insert-char ?- (1- (window-width)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
283 (insert (format "\n<<%s>>\n" command))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
284 (YaTeX-refer-help command help-file t) ;append mode
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
285 (setq buffer-read-only nil)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
286 (set-buffer hb)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
287 (goto-char pt)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
288 (if (re-search-forward head nil 1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
289 (goto-char (1- (match-beginning 0)))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
290 (setq buffer-read-only t)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
291 (select-window sw)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
292 pt))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
293
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
294 ;;;###autoload
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
295 (defun YaTeX-apropos (key)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
296 (interactive "sLaTeX apropos (regexp): ")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
297 (if (string= "" key) (error "Nothing to show"))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
298 (setq YaTeX-help-saved-config (current-window-configuration))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
299 (or (YaTeX-apropos-file key YaTeX-help-file)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
300 (YaTeX-apropos-file key YaTeX-help-file-private t)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
301 (message "No matches found.")))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
302
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
303 ;;;###autoload
339
9c39aa8a50e9 YaTeX-help takes one optional argument which directly taken as keyword.
HIROSE Yuuji <yuuji@gentei.org>
parents: 287
diff changeset
304 (defun YaTeX-help (&optional macro)
9c39aa8a50e9 YaTeX-help takes one optional argument which directly taken as keyword.
HIROSE Yuuji <yuuji@gentei.org>
parents: 287
diff changeset
305 "Show help buffer of LaTeX/TeX commands or macros.
9c39aa8a50e9 YaTeX-help takes one optional argument which directly taken as keyword.
HIROSE Yuuji <yuuji@gentei.org>
parents: 287
diff changeset
306 Optional argument MACRO, if supplied, is directly selected to keyword."
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
307 (interactive)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
308 (let (p beg end command)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
309 (save-excursion
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
310 (if (looking-at YaTeX-ec-regexp)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
311 (goto-char (match-end 0)))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
312 (setq p (point)) ;remember current position.
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
313 (cond
339
9c39aa8a50e9 YaTeX-help takes one optional argument which directly taken as keyword.
HIROSE Yuuji <yuuji@gentei.org>
parents: 287
diff changeset
314 (macro nil)
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
315 ((YaTeX-on-begin-end-p)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
316 ;;if on \begin or \end, extract its environment.
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
317 (setq command
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
318 (cond ((match-beginning 1)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
319 (buffer-substring (match-beginning 1) (match-end 1)))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
320 ((match-beginning 2)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
321 (buffer-substring (match-beginning 2) (match-end 2))))))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
322 ((search-backward YaTeX-ec (point-beginning-of-line) t)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
323 (goto-char (setq beg (match-end 0)))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 16
diff changeset
324 (re-search-forward YaTeX-TeX-token-regexp (point-end-of-line) t)
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
325 (setq end (point))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
326 (if (and (<= beg p) (<= p end))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
327 (setq command (buffer-substring beg end)))))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
328 (if (or (string= command "begin") (string= command "end"))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
329 (progn
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
330 (search-forward "{" (point-end-of-line))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
331 (setq beg (point))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
332 (search-forward "}" (point-end-of-line))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
333 (setq command (buffer-substring beg (match-beginning 0)))))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
334 (setq command
339
9c39aa8a50e9 YaTeX-help takes one optional argument which directly taken as keyword.
HIROSE Yuuji <yuuji@gentei.org>
parents: 287
diff changeset
335 (or macro
9c39aa8a50e9 YaTeX-help takes one optional argument which directly taken as keyword.
HIROSE Yuuji <yuuji@gentei.org>
parents: 287
diff changeset
336 (completing-read
9c39aa8a50e9 YaTeX-help takes one optional argument which directly taken as keyword.
HIROSE Yuuji <yuuji@gentei.org>
parents: 287
diff changeset
337 "Describe (La)TeX command: "
9c39aa8a50e9 YaTeX-help takes one optional argument which directly taken as keyword.
HIROSE Yuuji <yuuji@gentei.org>
parents: 287
diff changeset
338 YaTeX-help-entries nil nil command))));end excursion
9c39aa8a50e9 YaTeX-help takes one optional argument which directly taken as keyword.
HIROSE Yuuji <yuuji@gentei.org>
parents: 287
diff changeset
339
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
340 (setq YaTeX-help-saved-config (current-window-configuration))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
341 (or (YaTeX-refer-help command YaTeX-help-file)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents:
diff changeset
342 (YaTeX-refer-help command YaTeX-help-file-private)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
343 (YaTeX-enrich-help command))))

yatex.org