annotate yatexsec.el @ 61:b9f753846b6b

Bug fix release
author yuuji
date Mon, 07 Apr 1997 20:07:48 +0000
parents 3a7c0c2bf16d
children 36a48185b95a
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 sectioning browser.
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
3 ;;; yatexsec.el
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
4 ;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
61
b9f753846b6b Bug fix release
yuuji
parents: 58
diff changeset
5 ;;; Last modified Mon Feb 17 11:26:44 1997 on supra
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 (defvar YaTeX-sectioning-level
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
9 '(("part" . 0)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
10 ("chapter" . 1)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
11 ("section" . 2)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
12 ("subsection" . 3)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
13 ("subsubsection" . 4)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
14 ("paragraph" . 5)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
15 ("subparagraph" . 6))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
16 "*Alist of LaTeX's sectioning command and its level.
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
17 This value must be written in numerically ascending order and consecutive.
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
18 Needn't define the level of `*' commands such as `section*'.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
19
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
20 (defvar YaTeX-sectioning-max-level
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
21 (cdr (nth (1- (length YaTeX-sectioning-level)) YaTeX-sectioning-level))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
22 "*The heighest(numerically) level of sectioning command.
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
23 This must be the heighest number in YaTeX-sectioning-level.")
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
24
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
25 (defun YaTeX-sectioning-map-hide (map)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
26 (let ((ch ?0))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
27 (while (<= ch ?9)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
28 (define-key map (char-to-string ch) 'YaTeX-sectioning-hide)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
29 (setq ch (1+ ch))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
30 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
31
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
32 (defvar YaTeX-sectioning-minibuffer-map nil
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
33 "Key map used in minibuffer for sectioning.")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
34 (if YaTeX-sectioning-minibuffer-map nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
35 (setq YaTeX-sectioning-minibuffer-map
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
36 (copy-keymap minibuffer-local-completion-map))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
37 (define-key YaTeX-sectioning-minibuffer-map "\C-p"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
38 'YaTeX-sectioning-up)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
39 (define-key YaTeX-sectioning-minibuffer-map "\C-e"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
40 'YaTeX-sectioning-up)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
41 (define-key YaTeX-sectioning-minibuffer-map "\C-i"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
42 'YaTeX-minibuffer-complete)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
43 (define-key YaTeX-sectioning-minibuffer-map " "
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
44 'YaTeX-minibuffer-complete)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
45 (define-key YaTeX-sectioning-minibuffer-map "\C-n"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
46 'YaTeX-sectioning-down)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
47 (define-key YaTeX-sectioning-minibuffer-map "\C-x"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
48 'YaTeX-sectioning-down)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
49 (define-key YaTeX-sectioning-minibuffer-map "\C-v"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
50 'YaTeX-sectioning-scroll-up)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
51 (define-key YaTeX-sectioning-minibuffer-map "\C-c"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
52 'YaTeX-sectioning-scroll-up)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
53 (define-key YaTeX-sectioning-minibuffer-map "\M-v"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
54 'YaTeX-sectioning-scroll-down)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
55 (define-key YaTeX-sectioning-minibuffer-map "\C-r"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
56 'YaTeX-sectioning-scroll-down)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
57 (define-key YaTeX-sectioning-minibuffer-map "\C-w"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
58 '(lambda () (interactive) (YaTeX-sectioning-scroll-down 1)))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
59 (define-key YaTeX-sectioning-minibuffer-map "\C-z"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
60 '(lambda () (interactive) (YaTeX-sectioning-scroll-up 1)))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
61 (define-key YaTeX-sectioning-minibuffer-map "\C-l"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
62 'YaTeX-sectioning-recenter)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
63 (define-key YaTeX-sectioning-minibuffer-map "?"
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
64 'YaTeX-sectioning-help)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
65 (YaTeX-sectioning-map-hide YaTeX-sectioning-minibuffer-map)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
66 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
67
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
68 (defvar YaTeX-sectioning-buffer-map nil
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
69 "Key map used in YaTeX-sectioning-buffer.")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
70 (if YaTeX-sectioning-buffer-map nil
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
71 (setq YaTeX-sectioning-buffer-map (make-sparse-keymap))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
72 (define-key YaTeX-sectioning-buffer-map " " 'YaTeX-sectioning-buffer-jump)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
73 (define-key YaTeX-sectioning-buffer-map "." 'YaTeX-sectioning-buffer-show)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
74 (define-key YaTeX-sectioning-buffer-map (concat YaTeX-prefix "\C-c")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
75 'YaTeX-sectioning-buffer-jump)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
76 (define-key YaTeX-sectioning-buffer-map "u" 'YaTeX-shift-section-up)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
77 (define-key YaTeX-sectioning-buffer-map "d" 'YaTeX-shift-section-down)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
78 (define-key YaTeX-sectioning-buffer-map "U" 'YaTeX-shift-section-up-region)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
79 (define-key YaTeX-sectioning-buffer-map "D" 'YaTeX-shift-section-down-region)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
80 (define-key YaTeX-sectioning-buffer-map "s" 'YaTeX-sync-section-buffer)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
81 (define-key YaTeX-sectioning-buffer-map "n"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
82 'YaTeX-sectioning-buffer-next-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
83 (define-key YaTeX-sectioning-buffer-map "p"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
84 'YaTeX-sectioning-buffer-prev-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
85 (define-key YaTeX-sectioning-buffer-map "h" 'describe-mode)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
86 (define-key YaTeX-sectioning-buffer-map "o" 'other-window)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
87 (define-key YaTeX-sectioning-buffer-map "-" 'shrink-window)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
88 (define-key YaTeX-sectioning-buffer-map "+" 'enlarge-window)
61
b9f753846b6b Bug fix release
yuuji
parents: 58
diff changeset
89 (define-key YaTeX-sectioning-buffer-map "q" 'delete-window)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
90 (define-key YaTeX-sectioning-buffer-map "\C-_" 'YaTeX-shift-section-undo)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
91 (and YaTeX-emacs-19 (boundp 'window-system) (eq window-system 'x)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
92 (define-key YaTeX-sectioning-buffer-map [?\C-/]
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
93 'YaTeX-shift-section-undo))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
94 (YaTeX-sectioning-map-hide YaTeX-sectioning-buffer-map)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
95 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
96
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
97 (defun YaTeX-sectioning-mode ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
98 "Mode for browsing document's sectioning structure.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
99 \\[YaTeX-shift-section-up] Shift up a sectioning command
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
100 \\[YaTeX-shift-section-down] Shift down a sectioning command
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
101 \\[YaTeX-shift-section-up-region] Shift up sectioning commands in region
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
102 \\[YaTeX-shift-section-down-region] Shift down sectioning commands in region
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
103 \\[YaTeX-shift-section-undo] Undo changes of shifting
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
104 \\[YaTeX-sync-section-buffer] Synchronize sectioning buffer with source
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
105 \\[YaTeX-sectioning-buffer-next-line] Next line
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
106 \\[YaTeX-sectioning-buffer-prev-line] Previous line
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
107 \\[YaTeX-sectioning-buffer-jump] Previous line
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
108 \\[YaTeX-sectioning-buffer-show] Show curresponding source line
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
109 "
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
110 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
111 (setq major-mode 'YaTeX-sectioning-mode
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
112 mode-name "sectioning")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
113 (use-local-map YaTeX-sectioning-buffer-map)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
114 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
115
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
116 (defvar YaTeX-sectioning-buffer-parent nil)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
117 (defun YaTeX-sectioning-buffer-jump-internal (&optional keep)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
118 (let (ptn (p (point))) ;save-excursion is NG because
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
119 (beginning-of-line) ;this function should switch buffer
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
120 (if (re-search-forward YaTeX-sectioning-regexp)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
121 (progn (setq ptn (buffer-substring
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
122 (1- (match-beginning 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
123 (progn (skip-chars-forward "^}") (1+ (point)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
124 (goto-char p)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
125 (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent nil t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
126 (goto-char (point-max))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
127 (search-backward ptn)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
128 (if keep (goto-buffer-window YaTeX-sectioning-buffer))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
129 (current-buffer))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
130 nil))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
131 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
132 (defun YaTeX-sectioning-buffer-jump (&optional keep)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
133 "Goto corresponding sectioning unit with current line in the next window.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
134 If optional argument KEEP is non-nil, only shows the line."
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
135 (interactive)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
136 (if (and YaTeX-sectioning-buffer-parent
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
137 (get-buffer YaTeX-sectioning-buffer-parent))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
138 (YaTeX-sectioning-buffer-jump-internal keep)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
139 (message "No line number expression."))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
140 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
141
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
142 (defun YaTeX-sectioning-buffer-show ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
143 "Show corresponding sectioning unit with current line."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
144 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
145 (YaTeX-sectioning-buffer-jump-internal t)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
146 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
147
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
148 (defun YaTeX-sectioning-hide-under (n)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
149 "Hide sectioning commands under level N."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
150 (let ((cw (selected-window)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
151 (YaTeX-showup-buffer YaTeX-sectioning-buffer nil t)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
152 (if (>= n YaTeX-sectioning-max-level)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
153 (progn
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
154 (set-selective-display nil)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
155 (message "Show all."))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
156 (set-selective-display (1+ n))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
157 (if (rassq n YaTeX-sectioning-level)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
158 (message "Hide lower than %s" (car (rassq n YaTeX-sectioning-level)))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
159 (message "")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
160 (if (numberp selective-display)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
161 (setq mode-name (format "level %d" (1- selective-display)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
162 (setq mode-name (format "all")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
163 (select-window cw))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
164 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
165 (defun YaTeX-sectioning-hide ()
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
166 "Call YaTeX-sectioning-hide-under with argument according to pressed key."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
167 (interactive)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
168 (YaTeX-sectioning-hide-under (- last-command-char ?0)))
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 (defun YaTeX-sectioning-help ()
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
171 "Show help of sectioning."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
172 (interactive)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
173 (let ((cw (selected-window)) sb (hb (get-buffer-create "*Help*")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
174 (unwind-protect
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
175 (progn
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
176 (other-window 1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
177 (setq sb (current-buffer))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
178 (switch-to-buffer hb)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
179 (erase-buffer)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
180 (insert "===== View sectioning =====
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
181 C-p Up sectioning level. 0 Show only \\part,
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
182 C-n Down sectioning level. 1 and \\chapter,
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
183 C-v Scroll up *Sectioning line* buffer. 2 and \\section,
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
184 M-v Scroll down *Sectioning line* buffer. 3 and \\subsection,
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
185 C-z Scroll up by 1 line. 4 and \\subsubsection,
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
186 C-w Scroll down by 1 line. 5 and \\paragraph.
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
187 SPC Complete word. 6 Show all.
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
188 TAB Complete word.
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
189 C-l Recenter recent line.
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
190 RET Select.
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
191 ==== End of HELP =====
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
192 ")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
193 (set-buffer-modified-p nil)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
194 (goto-char (point-min))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
195 (momentary-string-display "" (point-min)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
196 (bury-buffer hb)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
197 (switch-to-buffer sb)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
198 (select-window cw)))
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
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
201 (defun YaTeX-sectioning-up (n)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
202 "Up section level.
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
203 Refers the YaTeX-read-section-in-minibuffer's local variable minibuffer-start."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
204 (interactive "p")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
205 (if (eq (selected-window) (minibuffer-window))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
206 (let*((command (buffer-string))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 49
diff changeset
207 (aster (and (string< "" command)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 49
diff changeset
208 (equal (substring command -1) "*")))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
209 (command (if aster (substring command 0 -1) command))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
210 (alist YaTeX-sectioning-level)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
211 (level 0))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
212 (or (assoc command alist) (error "No such sectioning command."))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
213 (while (not (string= (car (nth level alist)) command))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
214 (setq level (1+ level))) ;I want to use `member'....
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
215 (setq level (- level n))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
216 (if (or (< level 0) (>= level (length alist)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
217 (ding)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
218 (erase-buffer)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
219 (insert (concat (car (nth level alist)) (if aster "*" ""))))))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
220 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
221
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
222 (defun YaTeX-sectioning-down (n)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
223 "Down section level."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
224 (interactive "p")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
225 (YaTeX-sectioning-up (- n))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
226 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
227
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
228 (defun YaTeX-sectioning-scroll-up (n)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
229 (interactive "P")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
230 (let ((section-buffer YaTeX-sectioning-buffer)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
231 (cw (selected-window)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
232 (YaTeX-showup-buffer section-buffer nil t)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
233 (unwind-protect
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
234 (scroll-up (or n (- (window-height) 2)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
235 (select-window cw)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
236 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
237
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
238 (defun YaTeX-sectioning-scroll-down (n)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
239 (interactive "P")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
240 (let ((section-buffer YaTeX-sectioning-buffer)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
241 (cw (selected-window)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
242 (YaTeX-showup-buffer section-buffer nil t)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
243 (unwind-protect
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
244 (scroll-down (or n (- (window-height) 2)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
245 (select-window cw)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
246 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
247
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
248 (defun YaTeX-sectioning-recenter (arg)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
249 "Recenter `<<--' line"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
250 (interactive "P")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
251 (let ((cw (selected-window)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
252 (unwind-protect
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
253 (progn
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
254 (YaTeX-showup-buffer YaTeX-sectioning-buffer nil t)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
255 (or (search-forward "<<--" nil t)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
256 (search-backward "<<--" nil))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
257 (recenter (or arg (/ (window-height) 2))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
258 (select-window cw)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
259 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
260
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
261 (defvar YaTeX-sectioning-minibuffer " *sectioning*"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
262 "Miniuffer used for sectioning")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
263 ;;;###autoload
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
264 (defun YaTeX-read-section-in-minibuffer (prompt table &optional default delim)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
265 (interactive)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
266 (let ((minibuffer-completion-table table))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
267 (read-from-minibuffer
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
268 prompt default YaTeX-sectioning-minibuffer-map))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
269 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
270
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
271 (defun YaTeX-get-sectioning-level ()
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
272 "Get section-level on the cursor."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
273 (cdr-safe (assoc (buffer-substring
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
274 (point)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
275 (progn (skip-chars-forward "a-z") (point)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
276 YaTeX-sectioning-level))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
277 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
278
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
279 (defvar YaTeX-sectioning-buffer "*Sectioning lines*")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
280 (defun YaTeX-colloect-sections ()
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
281 "Collect all the lines which contains sectioning command."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
282 (let ((cw (selected-window)) level indent begp (prevp 1) (prevl 1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
283 (pattern (concat YaTeX-ec-regexp
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
284 "\\(" YaTeX-sectioning-regexp "\\)\\*?{"))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
285 (cb (current-buffer)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
286 (save-excursion
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
287 (set-buffer (get-buffer-create YaTeX-sectioning-buffer))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
288 (setq buffer-read-only nil)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
289 (set-buffer cb)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
290 (YaTeX-showup-buffer YaTeX-sectioning-buffer) ;show buffer
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
291 (goto-char (point-min))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
292 (with-output-to-temp-buffer YaTeX-sectioning-buffer
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
293 (while (re-search-forward pattern nil t)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
294 (goto-char (1+ (match-beginning 0)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
295 (setq level (YaTeX-get-sectioning-level)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
296 begp (match-beginning 0))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
297 ;;(beginning-of-line)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
298 ;;(skip-chars-forward " \t")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
299 (setq indent (format "%%%ds" level))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
300 (princ (format indent ""))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
301 (if (YaTeX-on-comment-p) (princ "%"))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
302 (princ (buffer-substring begp (progn (forward-list 1) (point))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
303 (setq prevl (+ prevl (count-lines prevp (point)) -1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
304 prevp (point))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
305 (princ (format " (line:%d)" prevl))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
306 (princ "\n")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
307 (set-buffer YaTeX-sectioning-buffer)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
308 (make-local-variable 'YaTeX-sectioning-buffer-parent)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
309 (YaTeX-sectioning-mode)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
310 (use-local-map YaTeX-sectioning-buffer-map)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
311 (setq YaTeX-sectioning-buffer-parent cb)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
312 (if (numberp selective-display)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
313 (setq mode-name (format "level %d" (1- selective-display))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
314 YaTeX-sectioning-buffer))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
315 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
316
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
317 (defvar YaTeX-pending-undo nil)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
318 (defun YaTeX-section-overview ()
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
319 "Show section overview. Return the nearest sectioning command."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
320 (interactive)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
321 (let ((cw (selected-window)) (ln (count-lines (point-min) (point)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
322 (pattern "(line:\\([0-9]+\\))")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
323 secbuf (command ""))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
324 (save-excursion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
325 (setq secbuf (YaTeX-colloect-sections))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
326 (YaTeX-showup-buffer secbuf nil t)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
327 (set-buffer secbuf)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
328 (goto-char (point-max))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
329 (while (re-search-backward pattern nil t)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
330 (if (< ln (string-to-int (YaTeX-match-string 1))) nil
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
331 (beginning-of-line)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
332 (search-forward YaTeX-ec)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
333 (looking-at YaTeX-TeX-token-regexp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
334 (setq command (YaTeX-match-string 0))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
335 (end-of-line)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
336 (insert " <<--")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
337 (setq pattern (concat "HackyRegexp" "ForFailure"))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
338 (set-buffer-modified-p nil)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
339 (setq buffer-read-only t buffer-undo-list nil)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
340 (make-local-variable 'YaTeX-pending-undo)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
341 (forward-line 1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
342 (if (eobp) (recenter -1) (recenter -3))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
343 (select-window cw)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
344 command))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
345 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
346
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 46
diff changeset
347 ;;;###autoload
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
348 (defun YaTeX-make-section-with-overview ()
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
349 "Input sectining command with previous overview."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
350 (interactive)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
351 (insert
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
352 YaTeX-ec
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
353 (YaTeX-read-section-in-minibuffer
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
354 "Sectioning(Up=C-p, Down=C-n, Help=?): "
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
355 YaTeX-sectioning-level (YaTeX-section-overview))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
356 "{}")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
357 (forward-char -1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
358 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
359
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
360 (defun YaTeX-shifted-section (sc n)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
361 "Get SC's N-shifted sectioning command."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
362 (let (lv)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
363 (setq lv (- (cdr (assoc sc YaTeX-sectioning-level)) n)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
364 lv (max (min YaTeX-sectioning-max-level lv) 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
365 (car (nth lv YaTeX-sectioning-level)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
366 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
367
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
368 (defun YaTeX-shift-section-up (n)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
369 "Shift sectioning command down by level N."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
370 (interactive "p")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
371 (let ((cb (current-buffer)) sc nsc lv)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
372 (if (and YaTeX-sectioning-buffer-parent
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
373 (get-buffer YaTeX-sectioning-buffer-parent)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
374 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
375 (or (= (char-after (point)) ?\\ )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
376 (skip-chars-backward "^\\\\" (point-beginning-of-line)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
377 (YaTeX-on-section-command-p YaTeX-sectioning-regexp)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
378 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
379 (or (buffer-name (get-buffer YaTeX-sectioning-buffer-parent))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
380 (error "This buffer is obsolete."))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
381 (setq nsc (YaTeX-shifted-section (YaTeX-match-string 1) n))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
382 (YaTeX-sectioning-buffer-jump-internal)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
383 (undo-boundary)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
384 (goto-char (match-beginning 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
385 (skip-chars-forward "\\\\")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
386 (delete-region
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
387 (point) (progn (skip-chars-forward "^*{") (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
388 (insert nsc)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
389 (undo-boundary)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
390 ;; Return to *Sectioning Lines* buffer
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
391 (select-window (get-buffer-window cb))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
392 (beginning-of-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
393 (let (buffer-read-only)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
394 (delete-region
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
395 (point) (progn (skip-chars-forward " \t") (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
396 (indent-to-column (cdr (assoc nsc YaTeX-sectioning-level)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
397 (skip-chars-forward "^\\\\")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
398 (delete-region
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
399 (1+ (point)) (progn (skip-chars-forward "^*{") (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
400 (insert nsc)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
401 (undo-boundary))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
402 (set-buffer-modified-p nil)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
403 (setq YaTeX-pending-undo pending-undo-list)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
404 )))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
405 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
406 (defun YaTeX-shift-section-down (n)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
407 "Shift sectioning command down by level N."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
408 (interactive "p")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
409 (YaTeX-shift-section-up (- n))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
410 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
411 (defun YaTeX-shift-section-undo (arg)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
412 "Undo YaTeX-shift-section-up/down."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
413 (interactive "p")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
414 (and YaTeX-sectioning-buffer-parent
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
415 (get-buffer YaTeX-sectioning-buffer-parent)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
416 (equal (current-buffer) (get-buffer YaTeX-sectioning-buffer))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
417 (let ((cb (current-buffer))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
418 (lc (if (eq last-command 'YaTeX-shift-section-undo) 'undo t)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
419 (let ((pending-undo-list YaTeX-pending-undo)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
420 buffer-read-only (last-command lc))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
421 (undo arg)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
422 (setq YaTeX-pending-undo pending-undo-list))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
423 (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
424 (goto-buffer-window YaTeX-sectioning-buffer-parent)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
425 (undo-boundary)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
426 (let ((last-command lc)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
427 (pending-undo-list
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
428 (if (eq lc 'undo) YaTeX-pending-undo pending-undo-list)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
429 (undo arg)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
430 (setq YaTeX-pending-undo pending-undo-list))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
431 (goto-buffer-window cb)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
432 (setq this-command 'YaTeX-shift-section-undo)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
433 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
434 (defun YaTeX-sync-section-buffer ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
435 "Synchronize *Sectioning Lines* buffer with parent buffer."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
436 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
437 (if (and YaTeX-sectioning-buffer-parent
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
438 (get-buffer YaTeX-sectioning-buffer-parent))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
439 (let ((cb (current-buffer)) (p (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
440 (set-buffer (get-buffer YaTeX-sectioning-buffer-parent))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
441 (YaTeX-section-overview)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
442 (switch-to-buffer cb)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
443 (goto-char p)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
444 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
445 (defun YaTeX-shift-section-up-region (beg end n)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
446 "Shift sectioning commands in region down by level N."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
447 (interactive "r\np")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
448 (or YaTeX-sectioning-buffer-parent
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
449 (get-buffer YaTeX-sectioning-buffer-parent)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
450 (error "Can't find corresponding LaTeX buffer"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
451 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
452 (goto-char beg)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
453 (let ((cb (current-buffer)) nsc from to repllist (e (make-marker)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
454 (set-marker e end)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
455 (while (progn (skip-chars-forward "^\\\\") (< (point) e))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
456 (YaTeX-on-section-command-p YaTeX-sectioning-regexp)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
457 (setq from (YaTeX-match-string 0)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
458 nsc (YaTeX-shifted-section (YaTeX-match-string 1) n))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
459 (goto-char (match-beginning 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
460 (let (buffer-read-only)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
461 (delete-region (point) (progn (beginning-of-line) (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
462 (indent-to-column (cdr (assoc nsc YaTeX-sectioning-level)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
463 (delete-region
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
464 (1+ (point)) (progn (skip-chars-forward "^*{") (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
465 (insert nsc))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
466 (YaTeX-on-section-command-p YaTeX-sectioning-regexp)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
467 (setq to (YaTeX-match-string 0)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
468 repllist (cons (cons from to) repllist))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
469 (forward-line 1))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
470 (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
471 (goto-buffer-window YaTeX-sectioning-buffer-parent)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
472 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
473 (goto-char (point-max))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
474 (undo-boundary)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
475 (while repllist
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
476 (if (search-backward (car (car repllist)) nil t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
477 (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
478 (goto-char (match-beginning 0)) ;confirm
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
479 (delete-region (point) (match-end 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
480 (insert (cdr (car repllist)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
481 (goto-char (match-beginning 0))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
482 (setq repllist (cdr repllist))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
483 (goto-buffer-window cb)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
484 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
485 (defun YaTeX-shift-section-down-region (beg end n)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
486 "Shift sectioning commands in region down by level N."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
487 (interactive "r\np")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
488 (YaTeX-shift-section-up-region beg end (- n))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
489 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
490 (defun YaTeX-sectioning-buffer-next-line (n)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
491 "Move to next line in *Sectioning Lines* buffer."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
492 (interactive "p")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
493 (forward-line n)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
494 (skip-chars-forward " \t%")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
495 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
496 (defun YaTeX-sectioning-buffer-prev-line (n)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
497 "Move to previous line in *Sectioning Lines* buffer."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
498 (interactive "p")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
499 (YaTeX-sectioning-buffer-next-line (- n))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 53
diff changeset
500 )
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents:
diff changeset
501 (provide 'yatexsec)

yatex.org