annotate yatexlib.el @ 56:a9653fbd1c1c

Bug fix version
author yuuji
date Thu, 29 Jun 1995 13:46:57 +0000
parents 2d45e43fb35f
children 3a7c0c2bf16d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
1 ;;; -*- Emacs-Lisp -*-
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
2 ;;; YaTeX library of general functions.
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
3 ;;; yatexlib.el
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
4 ;;; (c )1994-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
56
a9653fbd1c1c Bug fix version
yuuji
parents: 54
diff changeset
5 ;;; Last modified Fri Apr 28 16:17:44 1995 on VFR
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
6 ;;; $Id$
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
7
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
8 ;;;###autoload
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
9 (defun YaTeX-search-active-forward (string cmntrx &optional bound err cnt func)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
10 "Search STRING which is not commented out by CMNTRX.
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
11 Optional arguments after BOUND, ERR, CNT are passed literally to search-forward
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
12 or search-backward.
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
13 Optional sixth argument FUNC changes search-function."
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 47
diff changeset
14 (let ((sfunc (or func 'search-forward)) found md)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
15 (while (and (prog1
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
16 (setq found (funcall sfunc string bound err cnt))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
17 (setq md (match-data)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
18 (or
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
19 (YaTeX-in-verb-p (match-beginning 0))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
20 (save-excursion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
21 (beginning-of-line)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
22 (re-search-forward cmntrx (match-beginning 0) t)))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
23 (store-match-data md)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
24 found)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
25 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
26
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
27 (defun YaTeX-re-search-active-forward (regexp cmntrx &optional bound err cnt)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
28 "Search REGEXP backward which is not commented out by regexp CMNTRX.
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
29 See also YaTeX-search-active-forward."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
30 (YaTeX-search-active-forward regexp cmntrx bound err cnt 're-search-forward)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
31 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
32 (defun YaTeX-search-active-backward (string cmntrx &optional bound err cnt)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
33 "Search STRING backward which is not commented out by regexp CMNTRX.
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
34 See also YaTeX-search-active-forward."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
35 (YaTeX-search-active-forward string cmntrx bound err cnt 'search-backward)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
36 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
37 (defun YaTeX-re-search-active-backward (regexp cmntrx &optional bound err cnt)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
38 "Search REGEXP backward which is not commented out by regexp CMNTRX.
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
39 See also YaTeX-search-active-forward."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
40 (YaTeX-search-active-forward regexp cmntrx bound err cnt 're-search-backward)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
41 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
42
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
43
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
44 ;;;###autoload
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
45 (defun YaTeX-switch-to-buffer (file &optional setbuf)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
46 "Switch to buffer if buffer exists, find file if not.
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
47 Optional second arg SETBUF t make use set-buffer instead of switch-to-buffer."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
48 (interactive "Fswitch to file: ")
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
49 (if (bufferp file) (setq file (buffer-file-name file)))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
50 (let (buf (hilit-auto-highlight (not setbuf)))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
51 (cond
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
52 ((setq buf (get-file-buffer file))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
53 (funcall (if setbuf 'set-buffer 'switch-to-buffer)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
54 (get-file-buffer file))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
55 buf)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
56 ((or YaTeX-create-file-prefix-g (file-exists-p file))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
57 (or ;find-file returns nil but set current-buffer...
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
58 (if setbuf (set-buffer (find-file-noselect file))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
59 (find-file file))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
60 (current-buffer)))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
61 (t (message "%s was not found in this directory." file)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
62 nil)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
63 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
64
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
65 ;;;###autoload
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
66 (defun YaTeX-switch-to-buffer-other-window (file)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
67 "Switch to buffer if buffer exists, find file if not."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
68 (interactive "Fswitch to file: ")
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
69 (if (bufferp file) (setq file (buffer-file-name file)))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
70 (cond
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
71 ((get-file-buffer file)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
72 (switch-to-buffer-other-window (get-file-buffer file))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
73 t)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
74 ((or YaTeX-create-file-prefix-g (file-exists-p file))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
75 (find-file-other-window file) t)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
76 (t (message "%s was not found in this directory." file)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
77 nil))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
78 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
79
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
80 (defun YaTeX-replace-format-sub (string format repl)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
81 (let ((beg (or (string-match (concat "^\\(%" format "\\)") string)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
82 (string-match (concat "[^%]\\(%" format "\\)") string)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
83 (len (length format)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
84 (if (null beg) string ;no conversion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
85 (concat
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
86 (substring string 0 (match-beginning 1)) repl
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
87 (substring string (match-end 1)))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
88 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
89
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
90 ;;;###autoload
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
91 (defun YaTeX-replace-format (string format repl)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
92 "In STRING, replace first appearance of FORMAT to REPL as if
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
93 function `format' does. FORMAT does not contain `%'"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
94 (let ((ans string))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
95 (while (not (string=
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
96 ans (setq string (YaTeX-replace-format-sub ans format repl))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
97 (setq ans string))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
98 string)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
99 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
100
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
101 ;;;###autoload
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
102 (defun YaTeX-replace-format-args (string &rest args)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
103 "Translate the argument mark #1, #2, ... #n in the STRING into the
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
104 corresponding real arguments ARGS."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
105 (let ((argp 1))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
106 (while args
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
107 (setq string
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
108 (YaTeX-replace-format string (int-to-string argp) (car args)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
109 (setq args (cdr args) argp (1+ argp))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
110 string
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
111 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
112
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
113 ;;;###autoload
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
114 (defun rindex (string char)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
115 (let ((pos (1- (length string)))(index -1))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
116 (while (>= pos 0)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
117 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
118 ((= (aref string pos) char)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
119 (setq index pos) (setq pos -1))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
120 (t (setq pos (1- pos))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
121 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
122 index)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
123 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
124
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
125 ;;;###autoload
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
126 (defun YaTeX-showup-buffer (buffer &optional func select)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
127 "Make BUFFER show up in certain window (but current window)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
128 that gives the maximum value by the FUNC. FUNC should take an argument
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
129 of its window object. Non-nil for optional third argument SELECT selects
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 47
diff changeset
130 that window. This function never selects minibuffer window."
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
131 (or (and (if (and YaTeX-emacs-19 select)
47
d7e7b4654058 Support special popup frame.
yuuji
parents: 46
diff changeset
132 (get-buffer-window buffer t)
d7e7b4654058 Support special popup frame.
yuuji
parents: 46
diff changeset
133 (get-buffer-window buffer))
d7e7b4654058 Support special popup frame.
yuuji
parents: 46
diff changeset
134 (progn
d7e7b4654058 Support special popup frame.
yuuji
parents: 46
diff changeset
135 (if select
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
136 (goto-buffer-window buffer))
47
d7e7b4654058 Support special popup frame.
yuuji
parents: 46
diff changeset
137 t))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
138 (let ((window (selected-window))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
139 (wlist (YaTeX-window-list)) win w (x 0))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
140 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
141 ((> (length wlist) 2)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
142 (if func
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
143 (while wlist
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
144 (setq w (car wlist))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
145 (if (and (not (eq window w))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
146 (> (funcall func w) x))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
147 (setq win w x (funcall func w)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
148 (setq wlist (cdr wlist)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
149 (setq win (get-lru-window)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
150 (select-window win)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
151 (switch-to-buffer buffer)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
152 (or select (select-window window)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
153 ((= (length wlist) 2)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 47
diff changeset
154 ;(other-window 1);This does not work properly on Emacs-19
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 47
diff changeset
155 (select-window (get-lru-window))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
156 (switch-to-buffer buffer)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
157 (or select (select-window window)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
158 (t ;if one-window
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
159 (cond
47
d7e7b4654058 Support special popup frame.
yuuji
parents: 46
diff changeset
160 ((and YaTeX-emacs-19 (get-buffer-window buffer t))
d7e7b4654058 Support special popup frame.
yuuji
parents: 46
diff changeset
161 nil) ;if found in other frame
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
162 (YaTeX-default-pop-window-height
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
163 (split-window-calculate-height YaTeX-default-pop-window-height)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
164 (pop-to-buffer buffer)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
165 (or select (select-window window)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
166 (t nil)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
167 )))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
168 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
169
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
170 ;;;###autoload
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
171 (defun split-window-calculate-height (height)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
172 "Split current window wight specified HEIGHT.
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
173 If HEIGHT is number, make new window that has HEIGHT lines.
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
174 If HEIGHT is string, make new window that occupy HEIGT % of screen height.
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
175 Otherwise split window conventionally."
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
176 (if (one-window-p)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
177 (split-window
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
178 (selected-window)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
179 (max
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
180 (min
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
181 (- (screen-height)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
182 (if (numberp YaTeX-default-pop-window-height)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
183 (+ YaTeX-default-pop-window-height 2)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
184 (/ (* (screen-height)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
185 (string-to-int YaTeX-default-pop-window-height))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
186 100)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
187 (- (screen-height) window-min-height 1))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
188 window-min-height)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
189 )
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
190
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
191 ;;;###autoload
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
192 (defun YaTeX-window-list ()
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
193 (let*((curw (selected-window)) (win curw) (wlist (list curw)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
194 (while (not (eq curw (setq win (next-window win))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
195 (or (eq win (minibuffer-window))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
196 (setq wlist (cons win wlist))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
197 wlist)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
198 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
199
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
200 ;;;###autoload
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
201 (defun substitute-all-key-definition (olddef newdef keymap)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
202 "Replace recursively OLDDEF with NEWDEF for any keys in KEYMAP now
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
203 defined as OLDDEF. In other words, OLDDEF is replaced with NEWDEF
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
204 where ever it appears."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
205 (mapcar
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
206 (function (lambda (key) (define-key keymap key newdef)))
47
d7e7b4654058 Support special popup frame.
yuuji
parents: 46
diff changeset
207 (where-is-internal olddef keymap))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
208 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
209
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
210 ;;;###autoload
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
211 (defun YaTeX-match-string (n &optional m)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
212 "Return (buffer-substring (match-beginning n) (match-beginning m))."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
213 (if (match-beginning n)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
214 (buffer-substring (match-beginning n)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 47
diff changeset
215 (match-end (or m n))))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
216 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
217
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
218 ;;;###autoload
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
219 (defun YaTeX-minibuffer-complete ()
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 47
diff changeset
220 "Complete in minibuffer.
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
221 If the symbol 'delim is bound and is string, its value is assumed to be
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 47
diff changeset
222 the character class of delimiters. Completion will be performed on
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
223 the last field separated by those delimiters.
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
224 If the symbol 'quick is bound and is 't, when the try-completion results
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
225 in t, exit minibuffer immediately."
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
226 (interactive)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
227 (let ((md (match-data)) beg word compl
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
228 (quick (and (boundp 'quick) (eq quick t)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
229 (displist ;function to display completion-list
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
230 (function
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
231 (lambda ()
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
232 (with-output-to-temp-buffer "*Completions*"
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
233 (display-completion-list
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
234 (all-completions word minibuffer-completion-table)))))))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 47
diff changeset
235 (setq beg (if (and (boundp 'delim) (stringp delim))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
236 (save-excursion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
237 (skip-chars-backward (concat "^" delim))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 47
diff changeset
238 (point))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
239 (point-min))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
240 word (buffer-substring beg (point-max))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
241 compl (try-completion word minibuffer-completion-table))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
242 (cond
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 47
diff changeset
243 ((eq compl t)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
244 (if quick (exit-minibuffer)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
245 (let ((p (point)) (max (point-max)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
246 (unwind-protect
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
247 (progn
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
248 (goto-char max)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
249 (insert " [Sole completion]")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
250 (goto-char p)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
251 (sit-for 1))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
252 (delete-region max (point-max))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
253 (goto-char p)))))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
254 ((eq compl nil)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
255 (ding)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
256 (save-excursion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
257 (let (p)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
258 (unwind-protect
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
259 (progn
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
260 (goto-char (setq p (point-max)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
261 (insert " [No match]")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
262 (goto-char p)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
263 (sit-for 2))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
264 (delete-region p (point-max))))))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
265 ((string= compl word)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
266 (funcall displist))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
267 (t (delete-region beg (point-max))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
268 (insert compl)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
269 (if quick
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
270 (if (eq (try-completion compl minibuffer-completion-table) t)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
271 (exit-minibuffer)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
272 (funcall displist)))))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 47
diff changeset
273 (store-match-data md))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
274 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
275
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
276 (defun YaTeX-minibuffer-quick-complete ()
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
277 "Set 'quick to 't and call YaTeX-minibuffer-complete.
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
278 See documentation of YaTeX-minibuffer-complete."
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
279 (interactive)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
280 (let ((quick t))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
281 (self-insert-command 1)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
282 (YaTeX-minibuffer-complete)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
283
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
284 (defun foreach-buffers (pattern job)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
285 "For each buffer which matches with PATTERN, do JOB."
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
286 (let ((list (buffer-list)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
287 (save-excursion
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
288 (while list
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
289 (set-buffer (car list))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
290 (if (or (and (stringp pattern)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
291 (buffer-file-name)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
292 (string-match pattern (buffer-file-name)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
293 (and (symbolp pattern) major-mode (eq major-mode pattern)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
294 (eval job))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
295 (setq list (cdr list)))))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
296 )
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
297
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
298 (defun goto-buffer-window (buffer)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
299 "Select window which is bound to BUFFER.
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
300 If no such window exist, switch to buffer BUFFER."
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
301 (interactive "BGoto buffer: ")
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
302 (if (stringp buffer)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
303 (setq buffer (or (get-file-buffer buffer) (get-buffer buffer))))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
304 (if (get-buffer buffer)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
305 (cond
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
306 ((get-buffer-window buffer)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
307 (select-window (get-buffer-window buffer)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
308 ((and YaTeX-emacs-19 (get-buffer-window buffer t))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
309 (let*((win (get-buffer-window buffer t))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
310 (frame (window-frame win)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
311 (select-frame frame)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
312 (raise-frame frame)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
313 (focus-frame frame)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
314 (select-window win)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
315 (set-mouse-position frame 0 0)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
316 (and (featurep 'windows) (fboundp 'win:adjust-window)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
317 (win:adjust-window))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
318 ((and (featurep 'windows) (fboundp 'win:get-buffer-window)
56
a9653fbd1c1c Bug fix version
yuuji
parents: 54
diff changeset
319 (let ((w (win:get-buffer-window buffer)))
a9653fbd1c1c Bug fix version
yuuji
parents: 54
diff changeset
320 (and w (win:switch-window w))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
321 (select-window (get-buffer-window buffer)))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
322 (t (switch-to-buffer buffer))))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
323 )
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
324
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
325 ;; Here starts the functions which support gmhist-vs-Emacs19 compatible
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
326 ;; reading with history.
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
327 ;;;###autoload
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
328 (defun completing-read-with-history
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
329 (prompt table &optional predicate must-match initial hsym)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
330 "Completing read with general history: gmhist, Emacs-19."
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
331 (let ((minibuffer-history
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
332 (or (symbol-value hsym)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
333 (and (boundp 'minibuffer-history) minibuffer-history)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
334 (minibuffer-history-symbol (or hsym 'minibuffer-history)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
335 (prog1
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
336 (if (fboundp 'completing-read-with-history-in)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
337 (completing-read-with-history-in
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
338 minibuffer-history-symbol prompt table predicate must-match initial)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
339 (completing-read prompt table predicate must-match initial))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
340 (if (and YaTeX-emacs-19 hsym) (set hsym minibuffer-history)))))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
341
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
342 ;;;###autoload
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
343 (defun read-from-minibuffer-with-history (prompt &optional init map read hsym)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
344 "Read from minibuffer with general history: gmhist, Emacs-19."
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
345 (cond
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
346 (YaTeX-emacs-19
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
347 (read-from-minibuffer prompt init map read hsym))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
348 (t
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
349 (let ((minibuffer-history-symbol hsym))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
350 (read-from-minibuffer prompt init map read)))))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
351
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
352 ;;;###autoload
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
353 (defun read-string-with-history (prompt &optional init hsym)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
354 "Read string with history: gmhist(Emacs-18) and Emacs-19."
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
355 (cond
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
356 (YaTeX-emacs-19
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
357 (read-from-minibuffer prompt init minibuffer-local-map nil hsym))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
358 ((featurep 'gmhist-mh)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
359 (read-with-history-in hsym prompt init))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
360 (t (read-string prompt init))))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
361
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
362 ;;;
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
363 ;; Interface function for windows.el
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
364 ;;;
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
365 ;;;###autoload
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
366 (defun YaTeX-switch-to-window ()
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
367 "Switch to windows.el's window decided by last pressed key."
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
368 (interactive)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
369 (or (featurep 'windows) (error "Why don't you use `windows.el'?"))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
370 (win-switch-to-window 1 (- last-command-char win:base-key)))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
371
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
372 (provide 'yatexlib)

yatex.org