[Emacs] Scriptlet patch for Emacs-21


Emacs 21 の sgml-mode.el などの html-mode に対してScriptlet (JSP) 対応なんかやってみた。近いうちに#{mes}(#{link})あたりに置いてみる。



--- lisp/files.el.scriptlet Sun Mar 24 08:41:33 2002
+++ lisp/files.el Sun Mar 31 07:22:51 2002
@@ -1355,6 +1355,7 @@
("\.ad[abs]\'" . ada-mode)
("\.\([pP]\([Llm]\|erl\)\|al\)\'" . perl-mode)
("\.s?html?\'" . html-mode)
+ ("\.jsp\'" . html-mode)
("\.cc\'" . c++-mode)
("\.hh\'" . c++-mode)
("\.hpp\'" . c++-mode)
--- lisp/textmodes/sgml-mode.el.scriptlet Sun Mar 31 07:20:18 2002
+++ lisp/textmodes/sgml-mode.el Sun Mar 31 07:18:28 2002
@@ -65,7 +65,6 @@
?\" Makes " in text start a string.
?' Makes ' in text start a string.
?- Makes -- in text start a comment.
- ?- Makes % in text start a scriptlet (JSP).
When only one of ?\" or ?' are included, "'" or '"', as can be found in
DTDs, start a string. To partially avoid this problem this also makes these
@@ -302,6 +301,9 @@
(make-local-variable 'comment-start)
(make-local-variable 'comment-end)
(make-local-variable 'comment-indent-function)
+ (make-local-variable 'scriptlet-start)
+ (make-local-variable 'scriptlet-end)
+ (make-local-variable 'scriptlet-indent-function)
(make-local-variable 'sgml-tags-invisible)
(make-local-variable 'skeleton-transformation)
(make-local-variable 'skeleton-further-elements)
@@ -332,6 +334,9 @@
comment-start "<!-- "
comment-end " -->"
comment-indent-function 'sgml-comment-indent
+ scriptlet-start "<%"
+ scriptlet-end "%>"
+ scriptlet-indent-function 'sgml-comment-indent
skeleton-transformation sgml-transformation
skeleton-further-elements '((completion-ignore-case t))
skeleton-end-hook (lambda ()
@@ -352,6 +357,8 @@
;; recognized.
(set (make-local-variable 'comment-start-skip) "\(?:<!\)?--[ t]*")
(set (make-local-variable 'comment-end-skip) "[ t]*--\([ tn]*>\)?")
+ (set (make-local-variable 'scriptlet-start-skip) "\(?:<!\)?%[ t]*")
+ (set (make-local-variable 'scriptlet-end-skip) "[ t]*%\([ tn]*>\)?")
(dolist (pair sgml-display-text)
(put (car pair) 'before-string (cdr pair))))


あとは PHP なんかを参考にして、Scriptlet の部分の Parse なんか出来るようになると便利なんだろうけど。

コメント

このブログの人気の投稿

ICOM IC-7300 と RS-BA1 Version 2 でリモート操作

Windows 11 で Win10Pcap のアンインストール方法

大型特殊自動車免許を取った時の話。