anything.el + howm

巷って Emacs 界隈での巷であって世間的には圧倒的少数派なのは見ないことにしつつ、Emacsユーザの端の端にいる人間として、話題なら触っておかねばなるまいと思い立ち、ちょっとやってみました。うむ。これ面白いね。

お仕事PCでは howm でメモを取っているので、最近取ったメモの一覧を出せるようにしてみようということでちょっと試してみた。まずはアイデアだけで、粗い実装を。Emacs-Lispなんて .emacs コピペ以上の作業は大学出て以来じゃないかな。

(defun howm-title2file (howm-title howm-recent-menu-list)
  (if howm-recent-menu-list
      (progn
        (let* ((top-item (car howm-recent-menu-list))
               (list-item-name (car (cdr top-item)))
               (list-item-file (car top-item)))
          (if (string-equal howm-title list-item-name)
              list-item-file
            (howm-title2file howm-title (cdr howm-recent-menu-list)))
          ))))

(defun howm-get-recent-title-list (howm-recent-menu-list)
  (if howm-recent-menu-list
      (progn
        (let* ((top-item (car howm-recent-menu-list))
               (list-item-name (car (cdr top-item))))
          (append (list list-item-name)
                  (howm-get-recent-title-list (cdr howm-recent-menu-list)))
          ))
    ()))

(setq auto-mode-alist
      (append '(("\\.howm$" . howm-mode)) auto-mode-alist))

(defvar anything-c-howm-recent
  '((name . "howm Recent")
    (candidates . (lambda ()
                    (howm-get-recent-title-list (howm-recent-menu 3))))
    (action . (("Open howm file" .
                (lambda (howm-recent-title)
                  (find-file (howm-title2file howm-recent-title
                                              (howm-recent-menu 3)))))))
    ))

(setq anything-sources
      (list anything-c-howm-recent
            anything-c-source-buffers
            anything-c-source-file-name-history
            ))
  • あ、テスト用のまま Recent 3件のままにしてた。まだいじるかもしれないからとりあえずは放置でいいや。anything-sources もテスト用に絞ってしまってるけどその辺はおいおい直そう。
  • Modeを指定して find-file ってどうやるんだかよくわからんかったので、ひとまず auto-mode-alist で逃げる。

スクリーンショット

んでちょっと調べてたらやっぱりあった。

当然 Migemize したいわけですよ。