yatex

view yahtml.el @ 57:18f4939986e6

(j)LaTeX2e supported yatex19.el fixed a lot
author yuuji
date Sat, 02 Dec 1995 18:35:28 +0000
parents 2d45e43fb35f
children 3a7c0c2bf16d
line source
1 ;;; -*- Emacs-Lisp -*-
2 ;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@ascii-net.or.jp]
3 ;;; Last modified Mon Nov 20 11:26:38 1995 on inspire
4 ;;; This is PURELY tentative.
5 ;;; $Id$
7 ;;;[Commentary]
8 ;;;
9 ;;; It is assumed you are already familiar with YaTeX. The following
10 ;;; completing featureas are available: ([prefix] means `C-c' by default)
11 ;;;
12 ;;; * [prefix] b X Complete environments such as `H1' which
13 ;;; normally requires closing tag `</H1>
14 ;;; <a href=foo> ... </a> is also classified into
15 ;;; this group
16 ;;; * [prefix] s Complete declarative notations such as
17 ;;; `<img src="foo.gif">'
18 ;;; `<input name="var" ...>'
19 ;;; * [prefix] l Complete typeface-changing commands such as
20 ;;; `<i> ... </i>' or `<samp> ... </samp>'
21 ;;; * [prefix] m Complete single commands such as
22 ;;; `<br>' or `<hr>'
23 ;;; * menu-bar yahtml Complete all by selecting a menu item (Though I
24 ;;; hate menu, this is most useful)
25 ;;;
26 ;;; NOTE! This program is truly tentative. If you find some bright
27 ;;; future with this, please send me a mail to drive me to maintain this :)
30 (require 'yatex)
31 (defvar yahtml-prefix-map nil)
32 (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.")
34 (defun yahtml-define-begend-key-normal (key env &optional map)
35 "Define short cut yahtml-insert-begin-end key."
36 (YaTeX-define-key
37 key
38 (list 'lambda '(arg) '(interactive "P")
39 (list 'yahtml-insert-begin-end env 'arg))
40 map))
42 (defun yahtml-define-begend-region-key (key env &optional map)
43 "Define short cut yahtml-insert-begin-end-region key."
44 (YaTeX-define-key key (list 'lambda nil '(interactive)
45 (list 'yahtml-insert-begin-end env t)) map))
47 (defun yahtml-define-begend-key (key env &optional map)
48 "Define short cut key for begin type completion both for
49 normal and region mode. To customize yahtml, user should use this function."
50 (yahtml-define-begend-key-normal key env map)
51 (if YaTeX-inhibit-prefix-letter nil
52 (yahtml-define-begend-region-key
53 (concat (upcase (substring key 0 1)) (substring key 1)) env)))
56 (if yahtml-mode-map nil
57 (setq yahtml-mode-map (make-sparse-keymap)
58 yahtml-prefix-map (make-sparse-keymap))
59 (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map)
60 (define-key yahtml-mode-map "\M-\C-@" 'YaTeX-mark-environment)
61 (define-key yahtml-mode-map "\M-\C-a" 'YaTeX-beginning-of-environment)
62 (define-key yahtml-mode-map "\M-\C-e" 'YaTeX-end-of-environment)
63 (define-key yahtml-mode-map "\C-i" 'YaTeX-indent-line)
64 (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map)
65 (let ((map yahtml-prefix-map))
66 (YaTeX-define-key "^" 'yahtml-visit-main map)
67 (YaTeX-define-key "4^" 'yahtml-visit-main-other-window map)
68 (YaTeX-define-key "4g" 'yahtml-goto-corresponding-*-other-window map)
69 (YaTeX-define-key "44" 'YaTeX-switch-to-window map)
70 (and YaTeX-emacs-19 window-system
71 (progn
72 (YaTeX-define-key "5^" 'yahtml-visit-main-other-frame map)
73 (YaTeX-define-key "5g" 'yahtml-goto-corresponding-*-other-frame map)
74 (YaTeX-define-key "55" 'YaTeX-switch-to-window map)))
75 (YaTeX-define-key "v" 'YaTeX-version map)
76 (YaTeX-define-key "}" 'YaTeX-insert-braces-region map)
77 (YaTeX-define-key "]" 'YaTeX-insert-brackets-region map)
78 (YaTeX-define-key ")" 'YaTeX-insert-parens-region map)
79 (YaTeX-define-key "s" 'yahtml-insert-form map)
80 (YaTeX-define-key "l" 'yahtml-insert-tag map)
81 (YaTeX-define-key "m" 'yahtml-insert-single map)
82 (YaTeX-define-key "n" '(lambda () (interactive) (insert "<br>\n")) map)
83 (if YaTeX-no-begend-shortcut
84 (progn
85 (YaTeX-define-key "B" 'yahtml-insert-begend-region map)
86 (YaTeX-define-key "b" 'yahtml-insert-begend map))
87 (yahtml-define-begend-key "bh" "HTML" map)
88 (yahtml-define-begend-key "bH" "HEAD" map)
89 (yahtml-define-begend-key "bt" "TITLE" map)
90 (yahtml-define-begend-key "bb" "BODY" map)
91 (yahtml-define-begend-key "bd" "DL" map)
92 (yahtml-define-begend-key "b1" "H1" map)
93 (yahtml-define-begend-key "b2" "H2" map)
94 (yahtml-define-begend-key "b3" "H3" map)
95 (yahtml-define-begend-key "ba" "a" map)
96 (yahtml-define-begend-key "bf" "form" map)
97 (yahtml-define-begend-key "bs" "select" map)
98 (YaTeX-define-key "b " 'yahtml-insert-begend map)
99 (YaTeX-define-key "B " 'yahtml-insert-begend map)
100 )
101 (YaTeX-define-key "e" 'yahtml-end-environment map)
102 (YaTeX-define-key ">" 'yahtml-comment-region map)
103 (YaTeX-define-key "<" 'yahtml-uncomment-region map)
104 (YaTeX-define-key "g" 'yahtml-goto-corresponding-* map)
105 )
106 )
108 (defvar yahtml-paragraph-separate
109 (concat
110 "^$\\|<br>\\|<p>\\|^[ \t]*</?\\(h[1-6]\\|p\\|dl\\|dd\\|dt\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\)>")
111 "*Regexp of html paragraph separater")
112 (defvar yahtml-syntax-table nil
113 "*Syntax table for typesetting buffer")
115 (if yahtml-syntax-table nil
116 (setq yahtml-syntax-table
117 (make-syntax-table (standard-syntax-table)))
118 (modify-syntax-entry ?\< "(" yahtml-syntax-table)
119 (modify-syntax-entry ?\> ")" yahtml-syntax-table)
120 )
121 (defvar yahtml-command-regexp "[A-Za-z0-9]+"
122 "Regexp of constituent of html commands.")
123 (defvar yahtml-kanji-code 2
124 "Kanji coding system of html file; 1=sjis, 2=jis, 3=euc")
126 ;;; Completion tables for `form'
127 (defvar yahtml-form-table
128 '(("img") ("input")))
129 (defvar yahtml-user-form-table nil)
130 (defvar yahtml-tmp-form-table nil)
132 (defvar yahtml-env-table
133 '(("html") ("head") ("title") ("body") ("dl") ("a") ("form") ("select")
134 ("h1") ("h2") ("h3") ("h4") ("h5") ("h6") ("ul")))
136 (defvar yahtml-user-env-table nil)
137 (defvar yahtml-tmp-env-table nil)
139 ;;; Completion tables for typeface designator
140 (defvar yahtml-typeface-table
141 '(("defn") ("em") ("cite") ("code") ("kbd") ("samp")
142 ("strong") ("var") ("b") ("i") ("tt") ("u") ("address"))
143 "Default completion table of typeface designator")
144 (defvar yahtml-user-typeface-table nil)
145 (defvar yahtml-tmp-typeface-table nil)
147 (defvar yahtml-single-cmd-table
148 '(("hr") ("br") ("option") ("p"))
149 "Default completion table of HTML single command.")
150 (defvar yahtml-user-single-cmd-table nil)
151 (defvar yahtml-tmp-single-cmd-table nil)
152 (defvar yahtml-last-single-cmd nil)
154 (defvar yahtml-prefer-upcases nil)
155 (cond
156 (yahtml-prefer-upcases
157 (setq yahtml-form-table
158 (mapcar (function (lambda (list) (list (upcase (car list)))))
159 yahtml-form-table))
160 (setq yahtml-env-table
161 (mapcar (function (lambda (list) (list (upcase (car list)))))
162 yahtml-env-table))
163 (setq yahtml-typeface-table
164 (mapcar (function (lambda (list) (list (upcase (car list)))))
165 yahtml-typeface-table))))
167 (defvar yahtml-struct-name-regexp
168 "\\<\\(h[1-6]\\|[uod]l\\|body\\|title\\|head\\)")
171 (defun yahtml-mode ()
172 (interactive)
173 (yatex-mode)
174 (cond
175 ((boundp 'MULE)
176 (set-file-coding-system
177 (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist))))
178 ((boundp 'NEMACS)
179 (make-local-variable 'kanji-fileio-code)
180 (setq kanji-fileio-code yahtml-kanji-code)))
181 (setq major-mode 'yahtml-mode
182 mode-name "yahtml")
183 (make-local-variable 'YaTeX-ec) (setq YaTeX-ec "")
184 (make-local-variable 'YaTeX-struct-begin) (setq YaTeX-struct-begin "<%1%2>")
185 (make-local-variable 'YaTeX-struct-end) (setq YaTeX-struct-end "</%1>")
186 (make-local-variable 'YaTeX-struct-name-regexp)
187 (setq YaTeX-struct-name-regexp yahtml-struct-name-regexp)
188 (make-local-variable 'YaTeX-prefix-map)
189 (make-local-variable 'YaTeX-command-token-regexp)
190 (setq YaTeX-command-token-regexp yahtml-command-regexp)
191 (make-local-variable 'YaTeX-environment-indent)
192 (setq YaTeX-environment-indent 0)
193 (make-local-variable 'fill-prefix)
194 (setq fill-prefix nil)
195 (make-local-variable 'paragraph-separate)
196 (setq paragraph-separate yahtml-paragraph-separate
197 paragraph-start yahtml-paragraph-separate)
198 (make-local-variable 'comment-start)
199 (make-local-variable 'comment-end)
200 (setq comment-start "<!-- " comment-end " -->")
201 (set-syntax-table yahtml-syntax-table)
202 (use-local-map yahtml-mode-map)
203 (run-hooks 'yahtml-mode-hook))
205 (defun yahtml-define-menu (keymap bindlist)
206 (mapcar
207 (function
208 (lambda (bind)
209 (define-key keymap (vector (car bind)) (cdr bind))))
210 bindlist))
212 (defvar yahtml-menu-map nil "Menu map of yahtml")
213 (defvar yahtml-menu-map-sectioning nil "Menu map of yahtml(sectioning)")
214 (defvar yahtml-menu-map-listing nil "Menu map of yahtml(listing)")
215 (defvar yahtml-menu-map-logical nil "Menu map of yahtml(logical tags)")
216 (defvar yahtml-menu-map-typeface nil "Menu map of yahtml(typeface tags)")
218 ;;; Variables for mosaic url history
219 (defvar yahtml-urls nil "Alist of global history")
220 (defvar yahtml-url-history-file "~/.mosaic-global-history"
221 "File name of url history")
223 (cond
224 ((and YaTeX-emacs-19 (null yahtml-menu-map))
225 (setq yahtml-menu-map (make-sparse-keymap "yahtml menu"))
226 (setq yahtml-menu-map-sectioning (make-sparse-keymap "sectioning menu"))
227 (yahtml-define-menu
228 yahtml-menu-map-sectioning
229 (nreverse
230 '((1 "H1" . (lambda () (interactive) (yahtml-insert-begin-end "H1" nil)))
231 (2 "H2" . (lambda () (interactive) (yahtml-insert-begin-end "H2" nil)))
232 (3 "H3" . (lambda () (interactive) (yahtml-insert-begin-end "H3" nil)))
233 (4 "H4" . (lambda () (interactive) (yahtml-insert-begin-end "H4" nil)))
234 (5 "H5" . (lambda () (interactive) (yahtml-insert-begin-end "H5" nil)))
235 (6 "H6" . (lambda () (interactive) (yahtml-insert-begin-end "H6" nil)))
236 )))
237 (setq yahtml-menu-map-logical (make-sparse-keymap "logical tags"))
238 (yahtml-define-menu
239 yahtml-menu-map-logical
240 (nreverse
241 '((em "Embolden" .
242 (lambda () (interactive) (yahtml-insert-tag "EM")))
243 (defn "Define a word" .
244 (lambda () (interactive) (yahtml-insert-tag "DEFN")))
245 (cite "Citation" .
246 (lambda () (interactive) (yahtml-insert-tag "CITE")))
247 (code "Code" .
248 (lambda () (interactive) (yahtml-insert-tag "CODE")))
249 (kbd "Keyboard" .
250 (lambda () (interactive) (yahtml-insert-tag "KBD")))
251 (samp "Sample display" .
252 (lambda () (interactive) (yahtml-insert-tag "SAMP")))
253 (strong "Strong" .
254 (lambda () (interactive) (yahtml-insert-tag "STRONG")))
255 (VAR "Variable notation" .
256 (lambda () (interactive) (yahtml-insert-tag "VAR")))
257 )))
258 (setq yahtml-menu-map-typeface (make-sparse-keymap "typeface tags"))
259 (yahtml-define-menu
260 yahtml-menu-map-typeface
261 (nreverse
262 '((b "Bold" .
263 (lambda () (interactive) (yahtml-insert-tag "B")))
264 (i "Italic" .
265 (lambda () (interactive) (yahtml-insert-tag "I")))
266 (tt "Typewriter" .
267 (lambda () (interactive) (yahtml-insert-tag "TT")))
268 (u "Underlined" .
269 (lambda () (interactive) (yahtml-insert-tag "U")))
270 )))
271 (setq yahtml-menu-map-listing (make-sparse-keymap "listing"))
272 (yahtml-define-menu
273 yahtml-menu-map-listing
274 (nreverse
275 '((ul "Unnumbered" .
276 (lambda () (interactive) (yahtml-insert-begin-end "UL" nil)))
277 (ol "Numbered" .
278 (lambda () (interactive) (yahtml-insert-begin-end "OL" nil)))
279 (dl "Description" .
280 (lambda () (interactive) (yahtml-insert-begin-end "DL" nil)))
281 )))
282 (setq yahtml-menu-map-item (make-sparse-keymap "item"))
283 (yahtml-define-menu
284 yahtml-menu-map-item
285 (nreverse
286 '((li "Simple item" .
287 (lambda () (interactive) (yahtml-insert-single "li")))
288 (dt "Define term" .
289 (lambda () (interactive) (yahtml-insert-single "dt")))
290 (dd "Description of term" .
291 (lambda () (interactive) (yahtml-insert-single "dd")))
292 )))
293 (define-key yahtml-mode-map [menu-bar yahtml]
294 (cons "yahtml" yahtml-menu-map))
295 (yahtml-define-menu
296 yahtml-menu-map
297 (nreverse
298 (list
299 (cons (list 'sect "Sectioning")
300 (cons "sectioning" yahtml-menu-map-sectioning))
301 (cons (list 'list "Listing")
302 (cons "Listing" yahtml-menu-map-listing))
303 (cons (list 'item "Item")
304 (cons "Itemizing" yahtml-menu-map-item));;;
305 (cons (list 'logi "Logical tags")
306 (cons "logical" yahtml-menu-map-logical))
307 (cons (list 'type "Typeface tags")
308 (cons "typeface" yahtml-menu-map-typeface))
309 )))
310 ))
312 (defun yahtml-collect-url-history ()
313 "Collect urls from global history file."
314 (interactive)
315 (save-excursion
316 (set-buffer
317 (find-file-noselect (expand-file-name yahtml-url-history-file)))
318 (goto-char (point-min))
319 (setq yahtml-urls)
320 (message "Collecting global history...")
321 (while (re-search-forward "^[A-Za-z]+:" nil t)
322 (setq yahtml-urls
323 (cons (list
324 (buffer-substring
325 (progn (beginning-of-line) (point))
326 (progn (skip-chars-forward "^ ") (point))))
327 yahtml-urls)))
328 (message "Collecting global history...Done")))
330 ;;; ----------- Completion ----------
331 (defvar yahtml-last-begend "html")
332 (defun yahtml-insert-begend (&optional region)
333 "Insert <cmd> ... </cmd>."
334 (interactive "P")
335 (let ((cmd (YaTeX-cplread-with-learning
336 (format "Environment(default %s): " yahtml-last-begend)
337 'yahtml-env-table 'yahtml-user-env-table 'yahtml-tmp-env-table))
338 (bolp (bolp)))
339 (if (string< "" cmd) (setq yahtml-last-begend cmd))
340 (setq cmd yahtml-last-begend)
341 (if region
342 (let ((beg (region-beginning))
343 (end (region-end))
344 (addin (yahtml-addin cmd)))
345 (goto-char end)
346 (insert (format "</%s>%s" cmd (if bolp "\n" "")))
347 (goto-char beg)
348 (insert (format "<%s%s>%s" cmd addin (if bolp "\n" ""))))
349 (insert (format "<%s%s" cmd (yahtml-addin cmd)))
350 (if bolp (progn (insert (format ">\n</%s>\n" cmd cmd))
351 (forward-line -1))
352 (insert ">")
353 (save-excursion (insert (format "</%s>" cmd)))))))
355 (defun yahtml-insert-begend-region ()
356 "Call yahtml-insert-begend in the region mode."
357 (interactive)
358 (yahtml-insert-begend t))
361 (defun yahtml-insert-form (&optional form)
362 "Insert <FORM option=\"argument\">."
363 (interactive)
364 (or form
365 (setq form
366 (YaTeX-cplread-with-learning
367 "Form: "
368 'yahtml-form-table 'yahtml-user-form-table
369 'yahtml-tmp-form-table)))
370 (let ((p (point)) q)
371 (insert (format "<%s%s>" form (yahtml-addin (downcase form))))
372 ;;(indent-relative-maybe)
373 (if (cdr (assoc form yahtml-form-table))
374 (save-excursion (insert (format "</%s>" form))))
375 (if (search-backward "\"\"" p t) (forward-char 1))))
377 (defun yahtml-addin (form)
378 "Check add-in function's existence and call it if exists."
379 (let ((addin (concat "yahtml:" form)))
380 (if (and (intern-soft addin) (fboundp (intern-soft addin)))
381 (concat " " (funcall (intern addin)))
382 "")))
384 (defun yahtml:a ()
385 "Add-in function for <a>"
386 ; (or yahtml-urls (yahtml-collect-url-history))
387 ; (concat "href=\""
388 ; (completing-read "href: " yahtml-urls)
389 ; "\"")
390 (concat "href=\"" (read-file-name "href: " "" nil nil "") "\"")
391 )
393 (defun yahtml:img ()
394 "Add-in function for <img>"
395 (or yahtml-urls (yahtml-collect-url-history))
396 (let ((src (read-file-name "src: " "" nil t ""))
397 (alg (completing-read "align: " '(("top") ("middle") ("bottom")))))
398 (concat "src=\"" src "\""
399 (if (string< "" alg) (concat " align=\"" alg "\"")))))
401 (defun yahtml:form ()
402 "Add-in function `form' input format"
403 (concat
404 " method=" (completing-read "Method: " '(("POST") ("GET")) nil t)
405 " action=\"" (read-string "Action: ") "\""
406 ))
408 (defun yahtml:select ()
409 "Add-in function for `select' input format"
410 (setq yahtml-last-single-cmd "option")
411 (concat " name=\"" (read-string "name: ") "\""))
413 (defvar yahtml-input-types
414 '(("text") ("password") ("checkbox") ("radio") ("submit")
415 ("reset") ("image") ("hidden")))
417 (defun yahtml:input ()
418 "Add-in function for `input' form"
419 (let (name type value checked (size "") (maxlength ""))
420 (setq name (read-string "name: ")
421 type (completing-read "type (default=text): "
422 yahtml-input-types nil t)
423 value (read-string "value: "))
424 (if (string-match "text\\|password\\|^$" type)
425 (setq size (read-string "size: ")
426 maxlength (read-string "maxlength: ")))
427 (concat
428 "name=\"" name "\""
429 (if (string< "" type) (concat " type=\"" type "\""))
430 (if (string< "" value) (concat " value=\"" value "\""))
431 (if (string< "" size) (concat " size=\"" size "\""))
432 (if (string< "" maxlength) (concat " maxlength=\"" maxlength "\""))
433 )))
436 (defun yahtml-insert-begin-end (env &optional region-mode)
437 "Insert <ENV> \\n </ENV> by calling YaTeX-insert-begin-end."
438 (interactive "sEnv: ")
439 (setq env (funcall (if yahtml-prefer-upcases 'upcase 'downcase) env))
440 (YaTeX-insert-begin-end env region-mode))
442 (defun yahtml-insert-tag (tag)
443 "Insert <TAG> </TAG> and put cursor inside of them."
444 (interactive
445 (list
446 (YaTeX-cplread-with-learning
447 "Tag: "
448 'yahtml-typeface-table 'yahtml-user-typeface-table
449 'yahtml-tmp-typeface-table)))
450 (setq tag (funcall (if yahtml-prefer-upcases 'upcase 'downcase) tag))
451 (insert (format "<%s> " tag))
452 (save-excursion (insert (format "</%s>" tag))))
454 (defun yahtml-insert-single (cmd)
455 "Insert <CMD>."
456 (interactive
457 (list (YaTeX-cplread-with-learning
458 (format "Command%s: "
459 (if yahtml-last-single-cmd
460 (concat "(default " yahtml-last-single-cmd ")") ""))
461 'yahtml-single-cmd-table 'yahtml-user-single-cmd-table
462 'yahtml-tmp-single-cmd-table)))
463 (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase) cmd))
464 (if (string< "" cmd) (setq yahtml-last-single-cmd cmd))
465 (insert (format "<%s>" yahtml-last-single-cmd)))
467 ;;; ---------- Jump ----------
468 (defun yahtml-on-href-p ()
469 "Check if point is on href clause."
470 (let ((p (point)) cmd)
471 (save-excursion
472 (or (bobp) (skip-chars-backward "^ \t"))
473 (and (looking-at "href\\s *=\\s *\"?\\([^\"]+\\)\"?")
474 (< p (match-end 0))
475 (YaTeX-match-string 1)))))
477 (defun yahtml-goto-corresponding-href (&optional other)
478 "Go to corresponding name."
479 (let ((href (yahtml-on-href-p)) file name)
480 (if href
481 (cond
482 ((string-match "^http:" href)
483 (message "Sorry, jump across http is not supported."))
484 (t (setq file (substring href 0 (string-match "#" href)))
485 (if (string-match "#" href)
486 (setq name (substring href (1+ (string-match "#" href)))))
487 (if (string< "" file)
488 (progn
489 (if (string-match "/$" file)
490 (setq file (concat file "index.html")))
491 (if other (YaTeX-switch-to-buffer-other-window file)
492 (YaTeX-switch-to-buffer file))))
493 (if name
494 (progn (set-mark-command nil) (yahtml-jump-to-name name)))
495 t)))))
497 (defun yahtml-jump-to-name (name)
498 "Jump to html's named tag."
499 (setq name (format "name\\s *=\\s *\"?%s\"?" name))
500 (or (and (re-search-forward name nil t) (goto-char (match-beginning 0)))
501 (and (re-search-backward name nil t) (goto-char (match-beginning 0)))
502 (message "Named tag `%s' not found" (substring href 1))))
504 (defun yahtml-on-begend-p (&optional p)
505 "Check if point is on begend clause."
506 (let ((p (point)) cmd)
507 (save-excursion
508 (if p (goto-char p))
509 (if (= (char-after (point)) ?<) (forward-char 1))
510 (if (and (re-search-backward "<" nil t)
511 (looking-at
512 (concat "<\\(/?" yahtml-command-regexp "\\)\\b"))
513 (condition-case nil
514 (forward-list 1))
515 (< p (point)))
516 (YaTeX-match-string 1)))))
518 (defun yahtml-goto-corresponding-begend ()
519 (let ((cmd (yahtml-on-begend-p)))
520 (if cmd
521 (progn
522 (if (= (aref cmd 0) ?/) ;on </cmd> line
523 (re-search-backward (format "<%s" (substring cmd 1)))
524 (re-search-forward (format "</%s" cmd)))
525 (if (match-beginning 0) (goto-char (match-beginning 0)))))))
527 (defun yahtml-goto-corresponding-* (&optional other)
528 "Go to corresponding object."
529 (interactive)
530 (cond
531 ((yahtml-goto-corresponding-href other))
532 ((yahtml-goto-corresponding-begend other))
533 ))
535 (defun yahtml-goto-corresponding-*-other-window ()
536 "Go to corresponding object."
537 (interactive)
538 (yahtml-goto-corresponding-* t))
540 ;;; ---------- commenting ----------
541 (defun yahtml-comment-region (beg end)
542 (interactive "r")
543 (comment-region beg end nil))
545 (defun yahtml-uncomment-region (beg end)
546 (interactive "r")
547 (comment-region beg end '(4)))
551 ;;; ---------- ----------
552 ;;; ---------- ----------
553 ;;; ---------- ----------
555 ;;;
556 ;;hilit19
557 ;;;
558 (defvar yahtml-default-face-table
559 '(
560 (form black/ivory white/hex-442233 italic)
561 ))
562 (defvar yahtml-hilit-patterns-alist
563 '(
564 ;; comments
565 ("<!--\\s " "-->" comment)
566 ;; include&exec
567 ("<!--#\\(include\\|exec\\)" "-->" include)
568 ;; string
569 (hilit-string-find 39 string)
570 (yahtml-hilit-region-tag "\\(em\\|strong\\)" bold)
571 ("</?[uod]l>" 0 decl)
572 ("<\\(di\\|dt\\|li\\|dd\\)>" 0 label)
573 ("<a\\s +href" "</a>" crossref)
574 ("</?\\sw+>" 0 decl)
575 ("<form" "</form" form)
576 ))
578 (defun yahtml-hilit-region-tag (tag)
579 "Return list of start/end point of <TAG> form."
580 (if (re-search-forward (concat "<" tag ">") nil t)
581 (let ((m0 (match-beginning 0)))
582 (skip-chars-forward " \t\n")
583 (cons (point)
584 (progn (re-search-forward (concat "</" tag ">") nil t)
585 (1- (match-beginning 0)))))))
587 ;(setq hilit-patterns-alist (delq (assq 'yahtml-mode hilit-patterns-alist) hilit-patterns-alist))
588 (cond
589 ((and (featurep 'hilit19) (featurep 'yatex19))
590 (or (assq 'yahtml-mode hilit-patterns-alist)
591 (setq hilit-patterns-alist
592 (cons (cons 'yahtml-mode yahtml-hilit-patterns-alist)
593 hilit-patterns-alist)))))
595 (provide 'yahtml)
597 ; Local variables:
598 ; fill-prefix: ";;; "
599 ; paragraph-start: "^$\\| \\|;;;$"
600 ; paragraph-separate: "^$\\| \\|;;;$"
601 ; End: