[xyzzy:01571] Re: 昨日思い付いた事
- Subject: [xyzzy:01571] Re: 昨日思い付いた事
- From: Tetsuya Kamei <kamei@xxxxxxxxxxxx>
- X-mailer: Denshin 8 Go V321.2b5
- X-yzzy-version: 0.0.0.70.1
逸見さん、こんにちは。
Thu, 24 Dec 1998 13:49:41 +0900 の
“[xyzzy:01569] 昨日思い付いた事”
への返事です.
| SCRIPTタグの中にカーソルが入ったら言語モード
| を変えるなんて芸当できませんかね?
こんなことをすればモードは変わりますけど、色がうまく変わらない
みたいです。
(defvar-local *foo-beg* nil)
(defvar-local *foo-end* nil)
(defun foo-hook ()
(let ((new-mode (if (<= (marker-point *foo-beg*)
(point)
(marker-point *foo-end*))
'c-mode 'lisp-mode)))
(or (eq buffer-mode new-mode)
(let ((beg *foo-beg*)
(end *foo-end*))
(funcall new-mode)
(setq *foo-beg* beg
*foo-end* end
*post-command-hook* #'foo-hook)))))
(defun parse-foo ()
(interactive)
(make-local-variable '*post-command-hook*)
(setq *post-command-hook* nil)
(save-excursion
(goto-char (point-min))
(let ((beg (if (scan-buffer "<script" :case-fold t)
(point)
(error "`<script'がないっす")))
(end (if (scan-buffer "</script" :case-fold t)
(point)
(error "`</script'がないっす"))))
(setq *foo-beg* (make-marker))
(set-marker *foo-beg* beg)
(setq *foo-end* (make-marker))
(set-marker *foo-end* end)
(setq *post-command-hook* #'foo-hook))))
--
亀井哲弥(Tetsuya Kamei)
kamei@xxxxxxxxxxxx/JCA00343@xxxxxxxxxxx