annotate yahtml.el @ 58:3a7c0c2bf16d

Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
author yuuji
date Thu, 01 Feb 1996 18:55:47 +0000
parents 18f4939986e6
children 48ac97a6b6ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
1 ;;; -*- Emacs-Lisp -*-
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2 ;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@asciinet.or.jp]
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3 ;;; Last modified Fri Feb 2 02:37:23 1996 on supra
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
4 ;;; This package is no longer tentative.
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
5 ;;; $Id$
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
6
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
7 ;;;[Installation]
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
8 ;;;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
9 ;;; First, you have to install YaTeX and make sure it works fine. Then
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
10 ;;; put these expressions into your ~/.emacs
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
11 ;;;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
12 ;;; (setq auto-mode-alist
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
13 ;;; (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
14 ;;; (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
15 ;;; (setq yahtml-www-browser "netscape")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
16 ;;; ;Write your favorite browser. But netscape is advantageous.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
17 ;;; (setq yahtml-path-url-alist
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
18 ;;; '(("/home/yuuji/public_html" . "http://www.mynet/~yuuji")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
19 ;;; ("/home/staff/yuuji/html" . "http://www.othernet/~yuuji")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
20 ;;; ;Write correspondence alist from ABSOLUTE unix path name to URL path.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
21 ;;;
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
22 ;;;[Commentary]
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
23 ;;;
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
24 ;;; It is assumed you are already familiar with YaTeX. The following
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
25 ;;; completing featureas are available: ([prefix] means `C-c' by default)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
26 ;;;
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
27 ;;; * [prefix] b X Complete environments such as `H1' which
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
28 ;;; normally requires closing tag `</H1>
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
29 ;;; <a href=foo> ... </a> is also classified into
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
30 ;;; this group
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
31 ;;; * [prefix] s Complete declarative notations such as
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
32 ;;; `<img src="foo.gif">'
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
33 ;;; `<input name="var" ...>'
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
34 ;;; * [prefix] l Complete typeface-changing commands such as
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
35 ;;; `<i> ... </i>' or `<samp> ... </samp>'
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
36 ;;; * [prefix] m Complete single commands such as
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
37 ;;; `<br>' or `<hr> or <li>...'
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
38 ;;; * menu-bar yahtml Complete all by selecting a menu item (Though I
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
39 ;;; hate menu, this is most useful)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
40 ;;; * [prefix] g Goto corresponding Tag or HREF such as
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
41 ;;; <dl> <-> </dl> or href="xxx"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
42 ;;; * [prefix] k Kill html tags on the point. If you provide
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
43 ;;; universal-argument, kill surrounded contents too.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
44 ;;; * [prefix] c Change html tags on the point.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
45 ;;; * [prefix] t b View current html with WWW browser
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
46 ;;; (To activate this, never fail to set the lisp
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
47 ;;; variable yahtml-www-browser. Recommended value
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
48 ;;; is "netscape")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
49 ;;;
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
50 ;;; NOTE! This program is truly tentative. If you find some bright
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
51 ;;; future with this, please send me a mail to drive me to maintain this :)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
52
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
53
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
54 (require 'yatex)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
55 (defvar yahtml-prefix-map nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
56 (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
57 (defvar yahtml-image-viewer "xv" "*Image viewer program")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
58 (defvar yahtml-www-browser "netscape"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
59 "*WWW Browser command")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
60 (defvar yahtml-kanji-code 2
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
61 "Kanji coding system of html file; 1=sjis, 2=jis, 3=euc")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
62 ;;(defvar yahtml-www-server "www" "*Host name of your domain's WWW server")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
63 (defvar yahtml-path-url-alist nil
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
64 "*Alist of unix path name vs. URL name of WWW server.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
65 Ex.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
66 '((\"/usr/home/yuuji/http\" . \"http://www.comp.ae.keio.ac.jp/~yuuji\")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
67 (\"/usr/home/yuuji/darts/http\" . \"http://inspire.comp.ae.keio.ac.jp/~darts\"))")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
68 (defvar yahtml-directory-index "index.html"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
69 "*Directory index file name;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
70 Consult your site's WWW administrator.")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
71
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
72 (defun yahtml-define-begend-key-normal (key env &optional map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
73 "Define short cut yahtml-insert-begin-end key."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
74 (YaTeX-define-key
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
75 key
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
76 (list 'lambda '(arg) '(interactive "P")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
77 (list 'yahtml-insert-begin-end env 'arg))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
78 map))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
79
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
80 (defun yahtml-define-begend-region-key (key env &optional map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
81 "Define short cut yahtml-insert-begin-end-region key."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
82 (YaTeX-define-key key (list 'lambda nil '(interactive)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
83 (list 'yahtml-insert-begin-end env t)) map))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
84
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
85 (defun yahtml-define-begend-key (key env &optional map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
86 "Define short cut key for begin type completion both for
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
87 normal and region mode. To customize yahtml, user should use this function."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
88 (yahtml-define-begend-key-normal key env map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
89 (if YaTeX-inhibit-prefix-letter nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
90 (yahtml-define-begend-region-key
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
91 (concat (upcase (substring key 0 1)) (substring key 1)) env)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
92
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
93
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
94 (if yahtml-mode-map nil
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
95 (setq yahtml-mode-map (make-sparse-keymap)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
96 yahtml-prefix-map (make-sparse-keymap))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
97 (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
98 (define-key yahtml-mode-map "\M-\C-@" 'yahtml-mark-begend)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
99 (if (and (boundp 'window-system) (eq window-system 'x) YaTeX-emacs-19)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
100 (define-key yahtml-mode-map [?\M-\C- ] 'yahtml-mark-begend))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
101 (define-key yahtml-mode-map "\M-\C-a" 'YaTeX-beginning-of-environment)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
102 (define-key yahtml-mode-map "\M-\C-e" 'YaTeX-end-of-environment)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
103 (define-key yahtml-mode-map "\M-\C-m" 'yahtml-intelligent-newline)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
104 (define-key yahtml-mode-map "\C-i" 'yahtml-indent-line)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
105 (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
106 (let ((map yahtml-prefix-map))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
107 (YaTeX-define-key "^" 'yahtml-visit-main map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
108 (YaTeX-define-key "4^" 'yahtml-visit-main-other-window map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
109 (YaTeX-define-key "4g" 'yahtml-goto-corresponding-*-other-window map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
110 (YaTeX-define-key "44" 'YaTeX-switch-to-window map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
111 (and YaTeX-emacs-19 window-system
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
112 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
113 (YaTeX-define-key "5^" 'yahtml-visit-main-other-frame map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
114 (YaTeX-define-key "5g" 'yahtml-goto-corresponding-*-other-frame map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
115 (YaTeX-define-key "55" 'YaTeX-switch-to-window map)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
116 (YaTeX-define-key "v" 'YaTeX-version map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
117 (YaTeX-define-key "}" 'YaTeX-insert-braces-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
118 (YaTeX-define-key "]" 'YaTeX-insert-brackets-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
119 (YaTeX-define-key ")" 'YaTeX-insert-parens-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
120 (YaTeX-define-key "s" 'yahtml-insert-form map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
121 (YaTeX-define-key "l" 'yahtml-insert-tag map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
122 (YaTeX-define-key "m" 'yahtml-insert-single map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
123 (YaTeX-define-key "n" '(lambda () (interactive) (insert "<br>\n")) map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
124 (if YaTeX-no-begend-shortcut
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
125 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
126 (YaTeX-define-key "B" 'yahtml-insert-begend-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
127 (YaTeX-define-key "b" 'yahtml-insert-begend map))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
128 (yahtml-define-begend-key "bh" "HTML" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
129 (yahtml-define-begend-key "bH" "HEAD" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
130 (yahtml-define-begend-key "bt" "TITLE" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
131 (yahtml-define-begend-key "bb" "BODY" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
132 (yahtml-define-begend-key "bd" "DL" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
133 (yahtml-define-begend-key "b1" "H1" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
134 (yahtml-define-begend-key "b2" "H2" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
135 (yahtml-define-begend-key "b3" "H3" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
136 (yahtml-define-begend-key "ba" "a" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
137 (yahtml-define-begend-key "bf" "form" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
138 (yahtml-define-begend-key "bs" "select" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
139 (YaTeX-define-key "b " 'yahtml-insert-begend map)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
140 (YaTeX-define-key "B " 'yahtml-insert-begend-region map)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
141 )
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
142 (YaTeX-define-key "e" 'YaTeX-end-environment map)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
143 (YaTeX-define-key ">" 'yahtml-comment-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
144 (YaTeX-define-key "<" 'yahtml-uncomment-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
145 (YaTeX-define-key "g" 'yahtml-goto-corresponding-* map)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
146 (YaTeX-define-key "k" 'yahtml-kill-* map)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
147 (YaTeX-define-key "c" 'yahtml-change-* map)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
148 (YaTeX-define-key "t" 'yahtml-browse-menu map)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
149 ;;;;;(YaTeX-define-key "i" 'yahtml-fill-item map)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
150 )
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
151 )
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
152
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
153 (defvar yahtml-paragraph-separate
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
154 (concat
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
155 "^$\\|<[bh]r>\\|<p>\\|^[ \t]*</?\\(h[1-6]\\|p\\|dl\\|dd\\|dt\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\)>")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
156 "*Regexp of html paragraph separater")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
157 (defvar yahtml-syntax-table nil
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
158 "*Syntax table for typesetting buffer")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
159
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
160 (if yahtml-syntax-table nil
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
161 (setq yahtml-syntax-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
162 (make-syntax-table (standard-syntax-table)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
163 (modify-syntax-entry ?\< "(" yahtml-syntax-table)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
164 (modify-syntax-entry ?\> ")" yahtml-syntax-table)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
165 )
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
166 (defvar yahtml-command-regexp "[A-Za-z0-9]+"
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
167 "Regexp of constituent of html commands.")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
168
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
169 ;;; Completion tables for `form'
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
170 (defvar yahtml-form-table
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
171 '(("img") ("input")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
172 (defvar yahtml-user-form-table nil)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
173 (defvar yahtml-tmp-form-table nil)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
174
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
175 (defvar yahtml-env-table
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
176 '(("html") ("head") ("title") ("body") ("dl") ("a") ("form") ("select")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
177 ("OrderedList" . "ol")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
178 ("UnorderedList" . "ul")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
179 ("DefinitionList" . "dl")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
180 ("h1") ("h2") ("h3") ("h4") ("h5") ("h6") ("ul")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
181
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
182 (defvar yahtml-itemizing-regexp
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
183 "\\(ul\\|ul\\|dl\\)"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
184 "Regexp of itemizing forms")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
185
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
186 (defvar yahtml-user-env-table nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
187 (defvar yahtml-tmp-env-table nil)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
188
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
189 ;;; Completion tables for typeface designator
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
190 (defvar yahtml-typeface-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
191 '(("defn") ("em") ("cite") ("code") ("kbd") ("samp")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
192 ("strong") ("var") ("b") ("i") ("tt") ("u") ("address"))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
193 "Default completion table of typeface designator")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
194 (defvar yahtml-user-typeface-table nil)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
195 (defvar yahtml-tmp-typeface-table nil)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
196 (defvar yahtml-last-typeface-cmd "address")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
197
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
198 (defvar yahtml-single-cmd-table
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
199 '(("hr") ("br") ("option") ("p")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
200 ("HorizontalLine" . "hr")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
201 ("BreakLine" . "br")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
202 ("Paragraph" . "p")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
203 ("Item" . "li")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
204 ("DefineTerm" . "dt")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
205 ("Description" . "dd")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
206 ("dd") ("dt") ("li")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
207 )
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
208 "Default completion table of HTML single command.")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
209 (defvar yahtml-user-single-cmd-table nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
210 (defvar yahtml-tmp-single-cmd-table nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
211 (defvar yahtml-last-single-cmd nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
212
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
213 (defvar yahtml-prefer-upcases nil)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
214 (cond
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
215 (yahtml-prefer-upcases
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
216 (setq yahtml-form-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
217 (mapcar (function (lambda (list) (list (upcase (car list)))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
218 yahtml-form-table))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
219 (setq yahtml-env-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
220 (mapcar (function (lambda (list) (list (upcase (car list)))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
221 yahtml-env-table))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
222 (setq yahtml-typeface-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
223 (mapcar (function (lambda (list) (list (upcase (car list)))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
224 yahtml-typeface-table))))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
225
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
226 (defvar yahtml-struct-name-regexp
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
227 "\\<\\(h[1-6]\\|[uod]l\\|body\\|title\\|head\\|table\\|t[rhd]\\)")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
228
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
229
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
230 (defun yahtml-mode ()
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
231 (interactive)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
232 (yatex-mode)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
233 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
234 ((boundp 'MULE)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
235 (set-file-coding-system
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
236 (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
237 ((boundp 'NEMACS)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
238 (make-local-variable 'kanji-fileio-code)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
239 (setq kanji-fileio-code yahtml-kanji-code)))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
240 (setq major-mode 'yahtml-mode
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
241 mode-name "yahtml")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
242 (make-local-variable 'YaTeX-ec) (setq YaTeX-ec "")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
243 (make-local-variable 'YaTeX-struct-begin) (setq YaTeX-struct-begin "<%1%2>")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
244 (make-local-variable 'YaTeX-struct-end) (setq YaTeX-struct-end "</%1>")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
245 (make-local-variable 'YaTeX-struct-name-regexp)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
246 (setq YaTeX-struct-name-regexp yahtml-struct-name-regexp)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
247 (make-local-variable 'YaTeX-prefix-map)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
248 (make-local-variable 'YaTeX-command-token-regexp)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
249 (setq YaTeX-command-token-regexp yahtml-command-regexp)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
250 ;;(make-local-variable 'YaTeX-environment-indent)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
251 ;;(setq YaTeX-environment-indent 0)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
252 (make-local-variable 'fill-prefix)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
253 (setq fill-prefix nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
254 (make-local-variable 'paragraph-separate)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
255 (setq paragraph-separate yahtml-paragraph-separate
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
256 paragraph-start yahtml-paragraph-separate)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
257 (make-local-variable 'comment-start)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
258 (make-local-variable 'comment-end)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
259 (setq comment-start "<!-- " comment-end " -->")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
260 (make-local-variable 'indent-line-function)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
261 (setq indent-line-function 'yahtml-indent-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
262 (make-local-variable 'YaTeX-item-regexp)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
263 (setq YaTeX-item-regexp "<\\(li\\|d[td]\\)>")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
264 (set-syntax-table yahtml-syntax-table)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
265 (use-local-map yahtml-mode-map)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
266 (run-hooks 'yahtml-mode-hook))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
267
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
268 (defun yahtml-define-menu (keymap bindlist)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
269 (mapcar
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
270 (function
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
271 (lambda (bind)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
272 (define-key keymap (vector (car bind)) (cdr bind))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
273 bindlist))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
274
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
275 (defvar yahtml-menu-map nil "Menu map of yahtml")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
276 (defvar yahtml-menu-map-sectioning nil "Menu map of yahtml(sectioning)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
277 (defvar yahtml-menu-map-listing nil "Menu map of yahtml(listing)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
278 (defvar yahtml-menu-map-logical nil "Menu map of yahtml(logical tags)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
279 (defvar yahtml-menu-map-typeface nil "Menu map of yahtml(typeface tags)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
280
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
281 ;;; Variables for mosaic url history
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
282 (defvar yahtml-urls nil "Alist of global history")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
283 (defvar yahtml-url-history-file "~/.mosaic-global-history"
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
284 "File name of url history")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
285
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
286 (cond
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
287 ((and YaTeX-emacs-19 (null yahtml-menu-map))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
288 (setq yahtml-menu-map (make-sparse-keymap "yahtml menu"))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
289 (setq yahtml-menu-map-sectioning (make-sparse-keymap "sectioning menu"))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
290 (yahtml-define-menu
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
291 yahtml-menu-map-sectioning
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
292 (nreverse
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
293 '((1 "H1" . (lambda () (interactive) (yahtml-insert-begend nil "H1")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
294 (2 "H2" . (lambda () (interactive) (yahtml-insert-begend nil "H2")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
295 (3 "H3" . (lambda () (interactive) (yahtml-insert-begend nil "H3")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
296 (4 "H4" . (lambda () (interactive) (yahtml-insert-begend nil "H4")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
297 (5 "H5" . (lambda () (interactive) (yahtml-insert-begend nil "H5")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
298 (6 "H6" . (lambda () (interactive) (yahtml-insert-begend nil "H6")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
299 )))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
300 (setq yahtml-menu-map-logical (make-sparse-keymap "logical tags"))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
301 (yahtml-define-menu
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
302 yahtml-menu-map-logical
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
303 (nreverse
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
304 '((em "Embolden" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
305 (lambda () (interactive) (yahtml-insert-tag nil "EM")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
306 (defn "Define a word" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
307 (lambda () (interactive) (yahtml-insert-tag nil "DEFN")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
308 (cite "Citation" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
309 (lambda () (interactive) (yahtml-insert-tag nil "CITE")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
310 (code "Code" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
311 (lambda () (interactive) (yahtml-insert-tag nil "CODE")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
312 (kbd "Keyboard" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
313 (lambda () (interactive) (yahtml-insert-tag nil "KBD")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
314 (samp "Sample display" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
315 (lambda () (interactive) (yahtml-insert-tag nil "SAMP")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
316 (strong "Strong" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
317 (lambda () (interactive) (yahtml-insert-tag nil "STRONG")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
318 (VAR "Variable notation" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
319 (lambda () (interactive) (yahtml-insert-tag nil "VAR")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
320 )))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
321 (setq yahtml-menu-map-typeface (make-sparse-keymap "typeface tags"))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
322 (yahtml-define-menu
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
323 yahtml-menu-map-typeface
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
324 (nreverse
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
325 '((b "Bold" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
326 (lambda () (interactive) (yahtml-insert-tag nil "B")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
327 (i "Italic" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
328 (lambda () (interactive) (yahtml-insert-tag nil "I")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
329 (tt "Typewriter" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
330 (lambda () (interactive) (yahtml-insert-tag nil "TT")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
331 (u "Underlined" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
332 (lambda () (interactive) (yahtml-insert-tag nil "U")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
333 )))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
334 (setq yahtml-menu-map-listing (make-sparse-keymap "listing"))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
335 (yahtml-define-menu
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
336 yahtml-menu-map-listing
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
337 (nreverse
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
338 '((ul "Unordered" .
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
339 (lambda () (interactive) (yahtml-insert-begend nil "UL")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
340 (ol "Ordered" .
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
341 (lambda () (interactive) (yahtml-insert-begend nil "OL")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
342 (dl "Definition" .
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
343 (lambda () (interactive) (yahtml-insert-begend nil "DL")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
344 )))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
345 (setq yahtml-menu-map-item (make-sparse-keymap "item"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
346 (yahtml-define-menu
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
347 yahtml-menu-map-item
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
348 (nreverse
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
349 '((li "Simple item" .
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
350 (lambda () (interactive) (yahtml-insert-single "li")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
351 (dt "Define term" .
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
352 (lambda () (interactive) (yahtml-insert-single "dt")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
353 (dd "Description of term" .
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
354 (lambda () (interactive) (yahtml-insert-single "dd")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
355 )))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
356 (define-key yahtml-mode-map [menu-bar yahtml]
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
357 (cons "yahtml" yahtml-menu-map))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
358 (let ((keys (where-is-internal 'fill-paragraph global-map)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
359 (while keys
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
360 (define-key yahtml-mode-map (car keys) 'yahtml-fill-paragraph)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
361 (setq keys (cdr keys))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
362 (yahtml-define-menu
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
363 yahtml-menu-map
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
364 (nreverse
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
365 (list
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
366 (cons (list 'sect "Sectioning")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
367 (cons "sectioning" yahtml-menu-map-sectioning))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
368 (cons (list 'list "Listing")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
369 (cons "Listing" yahtml-menu-map-listing))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
370 (cons (list 'item "Item")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
371 (cons "Itemizing" yahtml-menu-map-item));;;
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
372 (cons (list 'logi "Logical tags")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
373 (cons "logical" yahtml-menu-map-logical))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
374 (cons (list 'type "Typeface tags")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
375 (cons "typeface" yahtml-menu-map-typeface))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
376 )))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
377 ))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
378
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
379 (defun yahtml-collect-url-history ()
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
380 "Collect urls from global history file."
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
381 (interactive)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
382 (save-excursion
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
383 (set-buffer
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
384 (find-file-noselect (expand-file-name yahtml-url-history-file)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
385 (goto-char (point-min))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
386 (setq yahtml-urls)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
387 (message "Collecting global history...")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
388 (while (re-search-forward "^[A-Za-z]+:" nil t)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
389 (setq yahtml-urls
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
390 (cons (list
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
391 (buffer-substring
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
392 (progn (beginning-of-line) (point))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
393 (progn (skip-chars-forward "^ ") (point))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
394 yahtml-urls)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
395 (message "Collecting global history...Done")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
396
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
397 ;;; ----------- Completion ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
398 (defvar yahtml-last-begend "html")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
399 (defun yahtml-insert-begend (&optional region env)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
400 "Insert <cmd> ... </cmd>."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
401 (interactive "P")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
402 (let*((completion-ignore-case t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
403 (cmd
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
404 (or env
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
405 (YaTeX-cplread-with-learning
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
406 (format "Environment(default %s): " yahtml-last-begend)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
407 'yahtml-env-table 'yahtml-user-env-table 'yahtml-tmp-env-table)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
408 (bolp (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
409 (skip-chars-backward " \t" (point-beginning-of-line)) (bolp)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
410 (cc (current-column)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
411 (if (string< "" cmd) (setq yahtml-last-begend cmd))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
412 (setq yahtml-last-begend
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
413 (or (cdr (assoc yahtml-last-begend yahtml-env-table))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
414 yahtml-last-begend))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
415 (setq cmd yahtml-last-begend)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
416 (if region
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
417 (let ((beg (region-beginning))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
418 (end (region-end))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
419 (addin (yahtml-addin cmd)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
420 (goto-char end)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
421 (insert (format "</%s>%s" cmd (if bolp "\n" "")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
422 (goto-char beg)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
423 (insert (format "<%s%s>%s" cmd addin (if bolp "\n" ""))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
424 (insert (format "<%s%s>" cmd (yahtml-addin cmd)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
425 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
426 (if bolp (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
427 (insert "\n")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
428 (indent-to-column cc)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
429 (insert (format "</%s>" cmd)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
430 (insert (format "</%s>" cmd))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
431 (if bolp (yahtml-intelligent-newline nil)))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
432
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
433 (defun yahtml-insert-begend-region ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
434 "Call yahtml-insert-begend in the region mode."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
435 (interactive)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
436 (yahtml-insert-begend t))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
437
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
438
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
439 (defun yahtml-insert-form (&optional form)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
440 "Insert <FORM option=\"argument\">."
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
441 (interactive)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
442 (or form
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
443 (setq form
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
444 (YaTeX-cplread-with-learning
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
445 "Form: "
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
446 'yahtml-form-table 'yahtml-user-form-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
447 'yahtml-tmp-form-table)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
448 (let ((p (point)) q)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
449 (insert (format "<%s%s>" form (yahtml-addin form)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
450 ;;(indent-relative-maybe)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
451 (if (cdr (assoc form yahtml-form-table))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
452 (save-excursion (insert (format "</%s>" form))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
453 (if (search-backward "\"\"" p t) (forward-char 1))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
454
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
455 (defun yahtml-addin (form)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
456 "Check add-in function's existence and call it if exists."
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
457 (let ((addin (concat "yahtml:" (downcase form))) s)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
458 (if (and (intern-soft addin) (fboundp (intern-soft addin))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
459 (stringp (setq s (funcall (intern addin))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
460 (string< "" s))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
461 (concat " " s)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
462 "")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
463
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
464 (defvar yahtml-url-completion-map nil "Key map used in URL completion buffer")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
465 (if yahtml-url-completion-map nil
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
466 (setq yahtml-url-completion-map
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
467 (copy-keymap minibuffer-local-completion-map))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
468 (define-key yahtml-url-completion-map "\t" 'yahtml-complete-url)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
469 (define-key yahtml-url-completion-map " " 'yahtml-complete-url)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
470 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
471
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
472 (defun yahtml-complete-url ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
473 "Complete external URL from history or local file name."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
474 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
475 (let (initial cmpl path dir file listfunc beg (p (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
476 (setq initial (buffer-string))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
477 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
478 ((string-match "^http:" initial)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
479 (setq cmpl (try-completion initial yahtml-urls)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
480 listfunc (list 'lambda nil
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
481 (list 'all-completions initial 'yahtml-urls))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
482 beg (point-min)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
483 (t
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
484 (setq path (if (string-match "^/" initial)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
485 (yahtml-url-to-path initial)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
486 initial))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
487 (setq dir (or (file-name-directory path) ".")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
488 file (file-name-nondirectory path)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
489 initial file
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
490 cmpl (file-name-completion file dir)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
491 listfunc (list 'lambda nil
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
492 (list 'file-name-all-completions
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
493 file dir))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
494 beg (save-excursion (skip-chars-backward "^/") (point)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
495 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
496 ((stringp cmpl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
497 (if (string= initial cmpl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
498 (with-output-to-temp-buffer "*Completions*"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
499 (princ "Possible completinos are:\n")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
500 (princ
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
501 (mapconcat '(lambda (x) x) (funcall listfunc) "\n")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
502 (delete-region (point) beg)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
503 (insert cmpl)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
504 ((null cmpl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
505 (ding))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
506 ((eq t cmpl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
507 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
508 (unwind-protect
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
509 (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
510 (goto-char p)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
511 (insert " [Sole completion]"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
512 (delete-region p (point-max))))))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
513
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
514 (defun yahtml:a ()
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
515 "Add-in function for <a>"
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
516 (or yahtml-urls (yahtml-collect-url-history))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
517 ; (concat "href=\""
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
518 ; (completing-read "href: " yahtml-urls)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
519 ; "\"")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
520 (message "(H)ref (N)ame?")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
521 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
522 ((string-match "[hH]" (char-to-string (read-char)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
523 (concat "href=\""
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
524 (read-from-minibuffer "href: " "" yahtml-url-completion-map)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
525 "\""))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
526 (t (concat "name=\"" (read-string "name: ") "\""))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
527
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
528 (defun yahtml:img ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
529 "Add-in function for <img>"
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
530 (or yahtml-urls (yahtml-collect-url-history))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
531 (let ((src (read-file-name "src: " "" nil nil ""))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
532 (alg (completing-read "align: " '(("top") ("middle") ("bottom")))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
533 (concat "src=\"" src "\""
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
534 (if (string< "" alg) (concat " align=\"" alg "\"")))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
535
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
536 (defun yahtml:form ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
537 "Add-in function `form' input format"
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
538 (concat
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
539 " method=" (completing-read "Method: " '(("POST") ("GET")) nil t)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
540 " action=\"" (read-string "Action: ") "\""
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
541 ))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
542
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
543 (defun yahtml:select ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
544 "Add-in function for `select' input format"
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
545 (setq yahtml-last-single-cmd "option")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
546 (concat " name=\"" (read-string "name: ") "\""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
547
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
548 (defun yahtml:ol ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
549 (setq yahtml-last-single-cmd "li") "")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
550 (defun yahtml:ul ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
551 (setq yahtml-last-single-cmd "li") "")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
552 (defun yahtml:dl ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
553 (setq yahtml-last-single-cmd "dt") "")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
554 (defun yahtml:dt ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
555 (setq yahtml-last-single-cmd "dd") "")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
556
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
557
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
558 (defvar yahtml-input-types
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
559 '(("text") ("password") ("checkbox") ("radio") ("submit")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
560 ("reset") ("image") ("hidden")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
561
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
562 (defun yahtml:input ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
563 "Add-in function for `input' form"
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
564 (let (name type value checked (size "") (maxlength ""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
565 (setq name (read-string "name: ")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
566 type (completing-read "type (default=text): "
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
567 yahtml-input-types nil t)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
568 value (read-string "value: "))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
569 (if (string-match "text\\|password\\|^$" type)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
570 (setq size (read-string "size: ")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
571 maxlength (read-string "maxlength: ")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
572 (concat
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
573 "name=\"" name "\""
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
574 (if (string< "" type) (concat " type=\"" type "\""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
575 (if (string< "" value) (concat " value=\"" value "\""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
576 (if (string< "" size) (concat " size=\"" size "\""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
577 (if (string< "" maxlength) (concat " maxlength=\"" maxlength "\""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
578 )))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
579
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
580 (defun yahtml-insert-tag (region-mode &optional tag)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
581 "Insert <TAG> </TAG> and put cursor inside of them."
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
582 (interactive "P")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
583 (or tag
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
584 (setq tag
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
585 (YaTeX-cplread-with-learning
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
586 (format "Tag %s(default %s): "
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
587 (if region-mode "region: " "") yahtml-last-typeface-cmd)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
588 'yahtml-typeface-table 'yahtml-user-typeface-table
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
589 'yahtml-tmp-typeface-table)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
590 (if (string= "" tag) (setq tag yahtml-last-typeface-cmd))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
591 (setq tag (funcall (if yahtml-prefer-upcases 'upcase 'downcase) tag)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
592 yahtml-last-typeface-cmd tag)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
593 (if region-mode
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
594 (if (if (string< "19" emacs-version) (mark t) (mark))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
595 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
596 (if (> (point) (mark)) (exchange-point-and-mark))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
597 (insert "<" tag ">")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
598 (exchange-point-and-mark)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
599 (insert "</" tag ">"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
600 (message "No mark set now"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
601 (insert (format "<%s> " tag))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
602 (save-excursion (insert (format "</%s>" tag)))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
603
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
604 (defun yahtml-insert-single (cmd)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
605 "Insert <CMD>."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
606 (interactive
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
607 (list
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
608 (let ((completion-ignore-case t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
609 (YaTeX-cplread-with-learning
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
610 (format "Command%s: "
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
611 (if yahtml-last-single-cmd
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
612 (concat "(default " yahtml-last-single-cmd ")") ""))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
613 'yahtml-single-cmd-table 'yahtml-user-single-cmd-table
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
614 'yahtml-tmp-single-cmd-table))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
615 (if (string< "" cmd) (setq yahtml-last-single-cmd cmd))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
616 (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase) cmd))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
617 (setq yahtml-last-single-cmd
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
618 (or (cdr (assoc yahtml-last-single-cmd yahtml-single-cmd-table))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
619 yahtml-last-single-cmd))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
620 (insert (format "<%s>" yahtml-last-single-cmd)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
621
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
622 ;;; ---------- Jump ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
623 (defun yahtml-on-href-p ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
624 "Check if point is on href clause."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
625 (let ((p (point)) cmd)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
626 (save-excursion
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
627 (or (bobp) (skip-chars-backward "^ \t\n"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
628 (and (looking-at "href\\s *=\\s *\"?\\([^\"> \t\n]+\\)\"?")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
629 (< p (match-end 0))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
630 (YaTeX-match-string 1)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
631
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
632 (defun yahtml-netscape-sentinel (proc mes)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
633 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
634 ((null (buffer-name (process-buffer proc)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
635 (set-process-buffer proc nil))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
636 ((eq (process-status proc) 'exit)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
637 (let ((cb (current-buffer)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
638 (set-buffer (process-buffer proc))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
639 (goto-char (point-min))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
640 (if (search-forward "not running" nil t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
641 (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
642 (message "Starting netscape...")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
643 (start-process
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
644 "browser" (process-buffer proc) shell-file-name "-c"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
645 (format "%s %s" yahtml-www-browser
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
646 (get 'yahtml-netscape-sentinel 'url)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
647 (message "Starting netscape...Done")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
648 (set-buffer cb)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
649
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
650 (defvar yahtml-browser-process nil)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
651
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
652 (defun yahtml-browse-html (href)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
653 "Call WWW Browser to see HREF."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
654 (let ((pb "* WWW Browser *") (cb (current-buffer)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
655 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
656 ((string-match "[Nn]etscape" yahtml-www-browser)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
657 (if (get-buffer pb)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
658 (progn (set-buffer pb) (erase-buffer) (set-buffer cb)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
659 (put 'yahtml-netscape-sentinel 'url href)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
660 (set-process-sentinel
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
661 (setq yahtml-browser-process
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
662 (start-process
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
663 "browser" pb shell-file-name "-c"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
664 (format "%s -remote 'openURL(%s)'" yahtml-www-browser href)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
665 'yahtml-netscape-sentinel))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
666 ((and (string= "w3" yahtml-www-browser) (fboundp 'w3-fetch))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
667 (w3-fetch href))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
668 ((stringp yahtml-www-browser)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
669 (if (eq (process-status yahtml-browser-process) 'run)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
670 (message "%s is already running" yahtml-www-browser)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
671 (setq yahtml-browser-process
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
672 (start-process
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
673 "browser" "* WWW Browser *" shell-file-name
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
674 (format "%s %s" yahtml-www-browser href)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
675 (t
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
676 (message "Sorry, jump across http is not supported.")))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
677
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
678 (defun yahtml-goto-corresponding-href (&optional other)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
679 "Go to corresponding name."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
680 (let ((href (yahtml-on-href-p)) file name)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
681 (if href
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
682 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
683 ((string-match "^http:" href)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
684 (yahtml-browse-html href))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
685 (t (setq file (substring href 0 (string-match "#" href)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
686 (if (string-match "#" href)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
687 (setq name (substring href (1+ (string-match "#" href)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
688 (if (string< "" file)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
689 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
690 (if (string-match "/$" file)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
691 (setq file (concat file yahtml-directory-index)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
692 (if (string-match "^/" file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
693 (setq file (yahtml-url-to-path file)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
694 (if other (YaTeX-switch-to-buffer-other-window file)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
695 (YaTeX-switch-to-buffer file))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
696 (if name
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
697 (progn (set-mark-command nil) (yahtml-jump-to-name name)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
698 t)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
699
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
700 (defun yahtml-jump-to-name (name)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
701 "Jump to html's named tag."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
702 (setq name (format "name\\s *=\\s *\"?%s\"?" name))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
703 (or (and (re-search-forward name nil t) (goto-char (match-beginning 0)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
704 (and (re-search-backward name nil t) (goto-char (match-beginning 0)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
705 (message "Named tag `%s' not found" (substring href 1))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
706
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
707 (defun yahtml-on-begend-p (&optional p)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
708 "Check if point is on begend clause."
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
709 (let ((p (point)) cmd (case-fold-search t))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
710 (save-excursion
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
711 (if p (goto-char p))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
712 (if (equal (char-after (point)) ?<) (forward-char 1))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
713 (if (and (re-search-backward "<" nil t)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
714 (looking-at
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
715 (concat "<\\(/?" yahtml-command-regexp "\\)\\b"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
716 (condition-case nil
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
717 (forward-list 1)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
718 (error nil))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
719 (< p (point)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
720 (YaTeX-match-string 1)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
721
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
722 (defun yahtml-goto-corresponding-begend (&optional noerr)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
723 "Go to corresponding opening/closing tag.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
724 Optional argument NOERR causes no error for unballanced tag."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
725 (let ((cmd (yahtml-on-begend-p)) m0
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
726 (p (point)) (case-fold-search t) func str (nest 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
727 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
728 (cmd
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
729 (setq m0 (match-beginning 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
730 (if (= (aref cmd 0) ?/) ;on </cmd> line
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
731 (setq cmd (substring cmd 1)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
732 str (format "\\(<%s\\)\\|\\(</%s\\)" cmd cmd)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
733 func 're-search-backward)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
734 (setq str (format "\\(</%s\\)\\|\\(<%s\\)" cmd cmd)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
735 func 're-search-forward))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
736 (while (and (>= nest 0) (funcall func str nil t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
737 (if (equal m0 (match-beginning 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
738 nil
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
739 (setq nest (+ nest (if (match-beginning 1) -1 1)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
740 (if (< nest 0)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
741 (goto-char (match-beginning 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
742 (funcall
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
743 (if noerr 'message 'error)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
744 "Corresponding tag of `%s' not found." cmd)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
745 (goto-char p)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
746 nil))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
747 (t nil))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
748
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
749 (defun yahtml-current-tag ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
750 "Return the current tag name."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
751 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
752 (let ((p (point)) b tag)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
753 (or (bobp)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
754 (looking-at "<")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
755 (progn (skip-chars-backward "^<") (forward-char -1)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
756 (setq b (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
757 (skip-chars-forward "<")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
758 (setq tag (buffer-substring
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
759 (point) (progn (skip-chars-forward "^ \t\n") (point))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
760 (goto-char b)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
761 (forward-list 1)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
762 (and (< p (point)) tag))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
763
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
764
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
765 (defun yahtml-goto-corresponding-img ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
766 "View image on point"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
767 (let ((tag (yahtml-current-tag)) image (p (point)) (case-fold-search t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
768 (if (and tag
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
769 (string-match "img" tag)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
770 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
771 (re-search-backward "<\\s *img" nil t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
772 (re-search-forward "src=\"?\\([^\"> ]+\\)\"?>")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
773 (match-beginning 1)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
774 (setq image
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
775 (buffer-substring (match-beginning 1) (match-end 1)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
776 (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
777 (message "Invoking %s %s..." yahtml-image-viewer image)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
778 (start-process
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
779 "Viewer" " * Image Viewer *" shell-file-name "-c"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
780 (concat yahtml-image-viewer " " image))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
781 (message "Invoking %s %s...Done" yahtml-image-viewer image)))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
782
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
783 (defun yahtml-goto-corresponding-* (&optional other)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
784 "Go to corresponding object."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
785 (interactive)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
786 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
787 ((yahtml-goto-corresponding-href other))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
788 ((yahtml-goto-corresponding-img))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
789 ((yahtml-goto-corresponding-begend))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
790 ))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
791
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
792 (defun yahtml-goto-corresponding-*-other-window ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
793 "Go to corresponding object."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
794 (interactive)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
795 (yahtml-goto-corresponding-* t))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
796
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
797 ;;; ---------- killing ----------
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
798 (defun yahtml-kill-begend (&optional whole)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
799 (let ((tag (yahtml-on-begend-p)) (p (make-marker)) (q (make-marker)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
800 (if tag
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
801 (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
802 (or (looking-at "<")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
803 (progn (skip-chars-backward "^<") (forward-char -1)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
804 (set-marker p (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
805 (yahtml-goto-corresponding-begend)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
806 (or (looking-at "<")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
807 (progn (skip-chars-backward "^<") (forward-char -1)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
808 (delete-region (point) (progn (forward-list 1) (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
809 (set-marker q (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
810 (beginning-of-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
811 (if (looking-at "^\\s *$")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
812 (delete-region (point) (progn (forward-line 1) (point))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
813 (goto-char p)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
814 (delete-region (point) (progn (forward-list 1) (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
815 (if (looking-at "^\\s *$")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
816 (delete-region (point) (progn (forward-line 1) (point))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
817 (if whole (delete-region p q))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
818 tag))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
819
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
820 (defun yahtml-kill-* (whole)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
821 "Kill current position's HTML tag (set)."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
822 (interactive "P")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
823 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
824 ((yahtml-kill-begend whole))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
825 ))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
826
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
827
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
828 ;;; ---------- changing ----------
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
829 (defun yahtml-change-begend ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
830 (let ((tag (yahtml-on-begend-p))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
831 (completion-ignore-case t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
832 (p (point)) (q (make-marker))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
833 (default (append yahtml-env-table yahtml-typeface-table))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
834 (user (append yahtml-user-env-table yahtml-user-typeface-table))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
835 (tmp (append yahtml-tmp-env-table yahtml-tmp-typeface-table))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
836 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
837 (if tag
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
838 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
839 (if (= (aref tag 0) ?/) (setq tag (substring tag 1)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
840 (or (= (char-after (point)) ?<) (skip-chars-backward "^<"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
841 (skip-chars-forward "^A-Za-z")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
842 (set-marker q (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
843 (setq p (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
844 (yahtml-goto-corresponding-begend)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
845 (or (= (char-after (point)) ?<)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
846 (skip-chars-backward "^<"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
847 (skip-chars-forward "^A-Za-z")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
848 (if (= (char-after (1- (point))) ?/)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
849 (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
850 (set-marker q (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
851 (goto-char p)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
852 (setq tag (YaTeX-cplread-with-learning
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
853 (format "Change `%s' to(default %s): "
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
854 tag yahtml-last-begend)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
855 'default 'user 'tmp))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
856 (delete-region (point) (progn (skip-chars-forward "^>") (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
857 (if (string= "" tag) (setq tag yahtml-last-begend))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
858 (setq yahtml-last-begend
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
859 (or (cdr (assoc tag yahtml-env-table)) tag)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
860 tag yahtml-last-begend)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
861 (insert (format "%s%s" tag (yahtml-addin tag)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
862 (goto-char q)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
863 (delete-region (point) (progn (skip-chars-forward "^>") (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
864 (insert tag)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
865
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
866 (defun yahtml-change-* ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
867 "Change current position's HTML tag (set)."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
868 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
869 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
870 ((yahtml-change-begend))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
871 ))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
872
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
873 ;;; ---------- commenting ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
874 (defun yahtml-comment-region (beg end)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
875 (interactive "r")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
876 (comment-region beg end nil))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
877
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
878 (defun yahtml-uncomment-region (beg end)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
879 (interactive "r")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
880 (comment-region beg end '(4)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
881
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
882
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
883
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
884 ;;; ---------- filling ----------
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
885 (defun yahtml-fill-paragraph (arg)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
886 (interactive "P")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
887 (let ((case-fold-search t) (p (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
888 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
889 (fill-region-as-paragraph
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
890 (progn (re-search-backward paragraph-start nil t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
891 (or (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
892 (goto-char (match-end 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
893 (if (looking-at "[ \t]*$")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
894 (progn (forward-line 1) (point))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
895 (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
896 (progn (goto-char p)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
897 (re-search-forward paragraph-start nil t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
898 (match-beginning 0))))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
899
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
900 ;;;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
901 ;;; ---------- indentation ----------
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
902 ;;;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
903 (defvar yahtml-hate-too-deep-indentation nil)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
904 (defun yahtml-indent-line ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
905 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
906 (let ((envs "[uod]l\\|table\\|t[rhd]")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
907 (itms "<\\(dt\\|dd\\|li\\|t[rdh]\\)>")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
908 inenv p col peol (case-fold-search t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
909 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
910 (beginning-of-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
911 (setq inenv (or (YaTeX-inner-environment) "html")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
912 col (get 'YaTeX-inner-environment 'indent)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
913 p (get 'YaTeX-inner-environment 'point)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
914 op))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
915 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
916 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
917 ((string-match envs inenv)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
918 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
919 (beginning-of-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
920 (skip-chars-forward " \t")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
921 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
922 ((looking-at (concat "</\\(" envs "\\)>"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
923 (YaTeX-reindent col))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
924 ((or (looking-at itms)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
925 (and yahtml-hate-too-deep-indentation
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
926 (looking-at (concat "<" envs))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
927 (YaTeX-reindent (+ col YaTeX-environment-indent)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
928 ((and (< p (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
929 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
930 (and
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
931 ;;(re-search-backward itms p t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
932 (setq op (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
933 (goto-char p)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
934 (re-search-forward itms op t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
935 (goto-char (match-end 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
936 (skip-chars-forward " \t")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
937 (setq col (current-column)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
938 (YaTeX-reindent col))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
939 (t
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
940 (YaTeX-reindent (+ col YaTeX-environment-indent)))))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
941 (and (bolp) (skip-chars-forward " \t"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
942 (if (and (setq inenv (yahtml-on-begend-p))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
943 (string-match (concat "^\\(" envs "\\)") inenv))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
944 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
945 (setq peol (point-end-of-line))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
946 (or (= (char-after (point)) ?<)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
947 (progn (skip-chars-backward "^<") (forward-char -1)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
948 (setq col (current-column))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
949 (if (and (yahtml-goto-corresponding-begend t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
950 (> (point) peol)) ;if on the different line
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
951 (YaTeX-reindent col)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
952 (and (bolp) (skip-chars-forward " \t"))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
953
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
954 ;(defun yahtml-fill-item ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
955 ; "Fill item HTML version"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
956 ; (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
957 ; (let (inenv p fill-prefix peol (case-fold-search t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
958 ; (setq inenv (or (YaTeX-inner-environment) "html")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
959 ; p (get 'YaTeX-inner-environment 'point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
960 ; (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
961 ; ((string-match "^[uod]l" inenv)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
962 ; (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
963 ; (if (re-search-backward "<\\(d[td]\\|li\\)>[ \t\n]*" p t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
964 ; (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
965 ; (goto-char (match-end 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
966 ; (setq col (current-column)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
967 ; (error "No <li>, <dt>, <dd>")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
968 ; (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
969 ; (end-of-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
970 ; (setq peol (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
971 ; (newline)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
972 ; (indent-to-column col)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
973 ; (setq fill-prefix (buffer-substring (point) (1+ peol)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
974 ; (delete-region (point) peol)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
975 ; (fill-region-as-paragraph
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
976 ; (progn (re-search-backward paragraph-start nil t) (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
977 ; (progn (re-search-forward paragraph-start nil t 2)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
978 ; (match-beginning 0)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
979 ; (t nil))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
980
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
981 ;;;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
982 ;;; ---------- Browsing ----------
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
983 ;;;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
984 (defun yahtml-browse-menu ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
985 "Browsing menu"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
986 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
987 (message "B)rowse R)eload...")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
988 (let ((c (char-to-string (read-char))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
989 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
990 ((string-match "[bj]" c)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
991 (yahtml-browse-current-file))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
992 ((string-match "r" c)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
993 (yahtml-browse-reload)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
994
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
995 (defun yahtml-file-to-url (file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
996 "Convert local unix file name to URL.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
997 If no matches found in yahtml-path-url-alist, return raw file name."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
998 (let ((list yahtml-path-url-alist) p url)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
999 (if (file-directory-p file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1000 (setq file (expand-file-name yahtml-directory-index file))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1001 (setq file (expand-file-name file)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1002 (while list
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1003 (if (string-match (concat "^" (regexp-quote (car (car list)))) file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1004 (setq url (cdr (car list))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1005 file (substring file (match-end 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1006 url (concat url file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1007 list nil))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1008 (setq list (cdr list)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1009 (or url (concat "file:" file))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1010
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1011 (defun yahtml-url-to-path (file &optional basedir)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1012 "Convert local URL name to unix file name."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1013 (let ((list yahtml-path-url-alist) url realpath docroot
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1014 (dirsufp (string-match "/$" file)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1015 (setq basedir (or basedir
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1016 (file-name-directory
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1017 (expand-file-name default-directory))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1018 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1019 ((string-match "^/" file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1020 (while list
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1021 (if (string-match (concat "^" (regexp-quote (car (car list)))) basedir)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1022 (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1023 (setq url (cdr (car list)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1024 (if (string-match "\\(http://[^/]*\\)/" url)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1025 (setq docroot (substring url (match-end 1)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1026 (setq docroot url))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1027 (if (string-match (regexp-quote docroot) file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1028 (setq realpath
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1029 (expand-file-name
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1030 (substring
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1031 file (min (1+ (match-end 0)) (length file)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1032 (car (car list)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1033 (if realpath
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1034 (progn (setq list nil)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1035 (if (and dirsufp (not (string-match "/$" realpath)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1036 (setq realpath (concat realpath "/")))))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1037 (setq list (cdr list)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1038 realpath)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1039 (t file))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1040
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1041 (defun yahtml-browse-current-file ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1042 "Call WWW browser on current file."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1043 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1044 (basic-save-buffer)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1045 (yahtml-browse-html (yahtml-file-to-url (buffer-file-name))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1046
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1047 (defun yahtml-browse-reload ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1048 "Send `reload' event to netzscape."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1049 (let ((pb "* WWW Browser *") (cb (current-buffer)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1050 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1051 ((string-match "[Nn]etscape" yahtml-www-browser)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1052 (if (get-buffer pb)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1053 (progn (set-buffer pb) (erase-buffer) (set-buffer cb)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1054 ;;(or (get 'yahtml-netscape-sentinel 'url)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1055 ;; (error "Reload should be called after Browsing."))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1056 (put 'yahtml-netscape-sentinel 'url
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1057 (yahtml-file-to-url (buffer-file-name)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1058 (basic-save-buffer)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1059 (set-process-sentinel
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1060 (setq yahtml-browser-process
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1061 (start-process
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1062 "browser" pb shell-file-name "-c"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1063 (format "%s -remote 'reload'" yahtml-www-browser)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1064 'yahtml-netscape-sentinel))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1065 (t
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1066 (message "Sorry, RELOAD is supported only for Netscape.")))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1067
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1068 ;;; ---------- Intelligent newline ----------
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1069 (defun yahtml-intelligent-newline (arg)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1070 "Intelligent newline for HTML"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1071 (interactive "P")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1072 (let ((env (downcase (or (YaTeX-inner-environment) "html"))) func)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1073 (setq func (intern-soft (concat "yahtml-intelligent-newline-" env)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1074 (end-of-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1075 (newline)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1076 (if (and env func (fboundp func))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1077 (funcall func))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1078
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1079 (defun yahtml-intelligent-newline-ul ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1080 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1081 (insert (if yahtml-prefer-upcases "<LI> " "<li> "))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1082 (yahtml-indent-line))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1083
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1084 (fset 'yahtml-intelligent-newline-ol 'yahtml-intelligent-newline-ul)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1085
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1086 (defun yahtml-intelligent-newline-dl ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1087 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1088 (let ((case-fold-search t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1089 (if (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1090 (re-search-backward "<\\(\\(dt\\)\\|\\(dd\\)\\)>"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1091 (get 'YaTeX-inner-environment 'point) t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1092 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1093 ((match-beginning 2)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1094 (insert (if yahtml-prefer-upcases "<DD> " "<dd> "))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1095 (setq yahtml-last-single-cmd "dt"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1096 ((match-beginning 3)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1097 (insert (if yahtml-prefer-upcases "<DT> " "<dt> "))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1098 (setq yahtml-last-single-cmd "dd")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1099 (insert (if yahtml-prefer-upcases "<DT> " "<dt> ")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1100 (yahtml-indent-line)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1101
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1102 ;;; ---------- Marking ----------
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1103 (defun yahtml-mark-begend ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1104 "Mark current tag"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1105 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1106 (YaTeX-beginning-of-environment)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1107 (let ((p (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1108 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1109 (skip-chars-backward " \t" (point-beginning-of-line))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1110 (if (bolp) (setq p (point))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1111 (push-mark p t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1112 (yahtml-goto-corresponding-begend)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1113 (forward-list 1)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1114 (if (eolp) (forward-char 1)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1115
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1116 ;;; ---------- ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1117 ;;; ---------- ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1118 ;;; ---------- ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1119
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1120 ;;;
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1121 ;;hilit19
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1122 ;;;
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1123 (defvar yahtml-default-face-table
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1124 '(
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1125 (form black/ivory white/hex-442233 italic)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1126 ))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1127 (defvar yahtml-hilit-patterns-alist
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1128 '(
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1129 ;; comments
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1130 ("<!--\\s " "-->" comment)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1131 ;; include&exec
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1132 ("<!--#\\(include\\|exec\\)" "-->" include)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1133 ;; string
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1134 (hilit-string-find 39 string)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1135 (yahtml-hilit-region-tag "\\(em\\|strong\\)" bold)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1136 ("</?[uod]l>" 0 decl)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1137 ("<\\(di\\|dt\\|li\\|dd\\)>" 0 label)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1138 ("<a\\s +href" "</a>" crossref)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1139 ("</?\\sw+>" 0 decl)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1140 ("<form" "</form" form)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1141 ))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1142
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1143 (defun yahtml-hilit-region-tag (tag)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1144 "Return list of start/end point of <TAG> form."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1145 (if (re-search-forward (concat "<" tag ">") nil t)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1146 (let ((m0 (match-beginning 0)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1147 (skip-chars-forward " \t\n")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1148 (cons (point)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1149 (progn (re-search-forward (concat "</" tag ">") nil t)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1150 (match-beginning 0))))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1151
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1152 ;(setq hilit-patterns-alist (delq (assq 'yahtml-mode hilit-patterns-alist) hilit-patterns-alist))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1153 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1154 ((and (featurep 'hilit19) (featurep 'yatex19))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1155 (or (assq 'yahtml-mode hilit-patterns-alist)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1156 (setq hilit-patterns-alist
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1157 (cons (cons 'yahtml-mode yahtml-hilit-patterns-alist)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1158 hilit-patterns-alist)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1159
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
1160 (provide 'yahtml)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
1161
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
1162 ; Local variables:
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
1163 ; fill-prefix: ";;; "
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
1164 ; paragraph-start: "^$\\| \\|;;;$"
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
1165 ; paragraph-separate: "^$\\| \\|;;;$"
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
1166 ; End:

yatex.org