yaotti's diary

Software is Eating the World

simple-hatena-modeでエラーが出ていたのを解決

simple-hatena-modeで,simple-hatena-default-groupやsimple-hatena-default-idを設定していないときにエラーが出ていたので追ってみたところ,どうやらcycle-mini.elがcompleting-readコマンドを変えている(?)ため,エラーを吐いてたっぽい.simple-hatenaに以下のパッチを当てると問題なく動く.

---
 hatena/simple-hatena-mode.el |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hatena/simple-hatena-mode.el b/hatena/simple-hatena-mode.el
index dbefd2e..03423cf 100644
--- a/hatena/simple-hatena-mode.el
+++ b/hatena/simple-hatena-mode.el
@@ -654,7 +654,7 @@ dirが存在しない場合は`simple-hatena-setup'を呼ぶ。"
             (car numbar-of-ids)
           (completing-read
            "Hatena id: "
-           (simple-hatena-internal-list-directories dir) nil t))
+           (mapcar 'list (simple-hatena-internal-list-directories dir)) nil t))
       (and
        (simple-hatena-setup)
        (simple-hatena-internal-completing-read-id dir)))))
@@ -662,8 +662,9 @@ dirが存在しない場合は`simple-hatena-setup'を呼ぶ。"
 (defun simple-hatena-internal-completing-read-group (id)
   "dir以下からグループ名を抽出し、補完入力させる。"
   (completing-read
-   "Group: " (simple-hatena-internal-list-directories
-              (concat simple-hatena-root "/" id "/group")) nil t))
+   "Group: " (mapcar 'list (simple-hatena-internal-list-directories
+              (concat simple-hatena-root "/" id "/group")))
+   nil t))
 
 (defun simple-hatena-internal-do-submit (&optional flag)

cycle-mini.elを読み込むと,completing-readの引数collectionに渡すリストの形式を,

'(("hoge") ("fuga") ("piyo"))

のようにしなければならないらしい.
これはcycle-miniの機能上仕方なさそうなので,simple-hatena側に(mapcar 'list ...)を追加して対応.