hatenahelper-modeでシンタックス・ハイライトを便利に

simple-hatena-modeと一緒にhatenahelper-modeを使おうという気になったので設定してみた。
便利そうなんだけどスーパーpre記法のときにシンタックス・ハイライトする場合にちょっと面倒だったので適当に書き換えた。私は使わないのでC-c C-sの方はそのまま。

--- hatenahelper-mode.el.orig	2007-11-20 04:35:47.000000000 +0900
+++ hatenahelper-mode.el	2007-11-20 05:30:27.000000000 +0900
@@ -101,6 +101,11 @@
 ;; hatena-mode ともども 非公式 debian パッケージを作る
 ;; w3m.el から使うときに便利になるよう拡張する
 
+;; シンタックス・ハイライトの補完リスト
+(defvar hatenahelper-syntax-highlight-language-list
+  '("awk" "c" "changelog" "cpp" "cs" "csc" "csh" "css" "cvs" "cvsrc" "diff"
+    "eruby" "haskell" "html" "java" "javascript" "jsp" "lisp" "perl" "php"
+    "python" "screen" "sh" "svn" "tags" "vim" "viminfo" "xhtml" "xml" "zsh"))
 
 ;;; Code:
 (defconst hatenahelper-mode-version 
@@ -230,10 +235,10 @@
   "Hatena blockquote prefix")
 (defvar hatenahelper-seikeizumi-textblock-suffix "|<"
   "Hatena blockquote suffix")
-(defvar hatenahelper-sonomama-textblock-prefix ">||"
-  "Hatena blockquote prefix")
-(defvar hatenahelper-sonomama-textblock-suffix "||<"
-  "Hatena blockquote suffix")
+;(defvar hatenahelper-sonomama-textblock-suffix ">||"
+;  "Hatena blockquote prefix")
+;(defvar hatenahelper-sonomama-textblock-suffix "||<"
+;  "Hatena blockquote suffix")
 (defvar hatenahelper-draft-tag-prefix "><!--"
   "Hatena Draft prefix")
 (defvar hatenahelper-draft-tag-suffix "--><"
@@ -331,10 +336,21 @@
   (hatenahelper-insert-block-aux hatenahelper-seikeizumi-textblock-prefix
     				 hatenahelper-seikeizumi-textblock-suffix))
 (defun hatenahelper-insert-sonomama-textblock ()
-  "Insert Hatena blockquote '>>| |<<' on current cursor position."
+  "Insert Hatena blockquote '>|| ||<' on current cursor position."
   (interactive)
-  (hatenahelper-insert-block-aux hatenahelper-sonomama-textblock-prefix
-    				 hatenahelper-sonomama-textblock-suffix))
+  (let
+      ((lang
+	(completing-read
+	 "language? " hatenahelper-syntax-highlight-language-list nil nil))
+       (syntax-highlight-prefix ">||")
+       (syntax-highlight-suffix "||<"))
+
+    (if (eq (length lang) 0)
+	nil
+      (setf syntax-highlight-prefix (format ">|%s|" lang)))
+
+    (hatenahelper-insert-block-aux syntax-highlight-prefix
+				   syntax-highlight-suffix)))
 (defun hatenahelper-insert-draft-tag ()
   "Insert Hatena Draft Tag '><--! --><' on current cursor position."
   (interactive)

補完する言語はhatenahelper-syntax-highlight-language-listに入れているけど私がなんとなく選んだものしか入ってないので適当に書き換えるなり再定義するなりしてください。

私はEmacsの初期化スクリプトに次のように書いています。

(defvar hatenahelper-syntax-highlight-language-list
  '("perl" "diff" "lisp" "ruby" "xhtml" "xml" "javascript"))