FirefoxのIt's all text ではてなダイアリーを書くモード作った。

hatena-diary-modehttp://d.hatena.ne.jp/lightcyan/20120715/1342329627 で使ってみたと書きましたが、確認してから公開する事ができないようで、いきなり公開されてしまうので、FirefoxのIt's all textを試してみましたが、選択範囲をboldにするとかそれくらいの機能は欲しかったので、自分で作りました。

ブラウザ上でやった方がよさそうな操作は、一回ファイルを保存すると、ブラウザ上のテキストエリアが変更されてますので、そちらで操作して、もう一回テキストエリア右下にある編集ボタン

を押すとEmacsのミニバッファに、

Revert buffer from file c:/Documents and Settings/navi/Application Data/Mozilla/Firefox/Profiles/********.default/itsalltext/d.hatena.ne.jp.**********.txt? (yes or no)

とか出るので、yesを選んでバッファにファイルを再読み込みさせてから、Emacsでの編集を再開してください。

;;; my-hatena-mode.el - major mode for Hatena::Diary with It's All Text!(add-on of Firefox)
;; Author: lightcyan
;; URL: http://d.hatena.ne.jp/lightcyan/

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; Add these lines to your .emacs file.
;; (setq auto-mode-alist
;;       (append '(("d\\.hatena\\.ne\\.jp\\..*\\.txt" . my-hatena-mode))auto-mode-alist))
;; (modify-coding-system-alist 'file "d\\.hatena\\.ne\\.jp\\..*\\.txt" 'utf-8)

;;; Commands:

;; `my-hatena-bold'
;;     put tag like "B" button pushed.
;; `my-hatena-italic'
;;     put tag like "I" button pushed.
;; `my-hatena-red'
;;     put tag like "#FF0000" button pushed.
;; `my-hatena-green'
;;     put tag like "#00FF00" button pushed.
;; `my-hatena-blue'
;;     put tag like "#0000FF" button pushed.

(require 'skeleton)

(defvar my-hatena-mode-map nil "Keymap for my hatena mode.")
(unless my-hatena-mode-map
  (setq my-hatena-mode-map (make-keymap))
  (define-key my-hatena-mode-map "\C-ctf" 'my-hatena-bold)
  (define-key my-hatena-mode-map "\C-cti" 'my-hatena-italic)
  (define-key my-hatena-mode-map "\C-ctr" 'my-hatena-red)
  (define-key my-hatena-mode-map "\C-ctg" 'my-hatena-green)
  (define-key my-hatena-mode-map "\C-cta" 'my-hatena-blue))

(defun my-hatena-mode ()
  (interactive)
  (setq major-mode 'my-hatena-mode
	mode-name "my-hatena")
  (use-local-map my-hatena-mode-map))

(define-skeleton my-hatena-bold
  "hatena futoji tag."
  nil
  "<span class=\"deco\" style=\"font-weight:bold\;\">" _ "</span>")

(define-skeleton my-hatena-italic
  "hatena futoji tag."
  nil
  "<span class=\"deco\" style=\"font-weight:italic\;\">" _ "</span>")

(define-skeleton my-hatena-red
  "hatena futoji tag."
  nil
  "<span class=\"deco\" style=\"color:#FF0000\;\">" _ "</span>")
(define-skeleton my-hatena-green
  "hatena futoji tag."
  nil
  "<span class=\"deco\" style=\"color:#00FF00\;\">" _ "</span>")

(define-skeleton my-hatena-blue
  "hatena futoji tag."
  nil
  "<span class=\"deco\" style=\"color:#0000FF\;\">" _ "</span>")

他にも簡単に出来てあった方がいい物ありますかねー。