パスワードプロンプト

submit 時にパスワードを入力できる patch。パスワードが必要なら minibuffer にプロンプトが出る。
まぁ、config.txt にパスワード書いておけば済む話ではあるんだけど生パスワードを plain text に書くのはアレだし。

Index: simple-hatena-mode.el
===================================================================
--- simple-hatena-mode.el	(リビジョン 533)
+++ simple-hatena-mode.el	(作業コピー)
@@ -111,6 +111,11 @@
 
 実行時に、-cオプションとして使われる。")
 
+(defcustom simple-hatena-process-buffer-name "*SimpleHatena*"
+  "はてダラを実行するプロセスのバッファ名"
+  :type 'string
+  :group 'simple-hatena)
+
 ;; キーバインド
 (setq simple-hatena-mode-map (make-keymap))
 
@@ -468,9 +473,31 @@
     (when (buffer-modified-p)
       (save-buffer))
     (message "%s" "Now posting...")
-    (shell-command (simple-hatena-internal-build-command flag)
-                   "*SimpleHatenaOutput*" "*SimpleHatenaError*")
-    (run-hooks 'simple-hatena-after-submit-hook)))
+    (let* ((buffer (get-buffer-create simple-hatena-process-buffer-name))
+           (proc (get-buffer-process buffer)))
+      (if (and
+           proc
+           (eq (process-status proc) 'run)
+           (yes-or-no-p (format "A %s process is running; kill it?"
+                                (process-name proc))))
+          (progn
+            (interrupt-process proc)
+            (sit-for 1)
+            (delete-process proc)))
+      (with-current-buffer buffer
+        (progn
+          (erase-buffer)
+          (buffer-disable-undo (current-buffer))))
+      (make-comint-in-buffer
+       "simple-hatena-submit" buffer shell-file-name nil
+       shell-command-switch (simple-hatena-internal-build-command flag))
+      (set-process-sentinel
+       (get-buffer-process buffer)
+       '(lambda (process signal)
+          (if (string= signal "finished\n")
+              (let ((max-mini-window-height 10))
+                (display-message-or-buffer (process-buffer process))
+                (run-hooks 'simple-hatena-after-submit-hook))))))))
 
 (defun simple-hatena-internal-build-command (flag)
   "実行可能なコマンド文字列を作成する。"