howmで日記

結局あのあともう少しいじってこんなんになった。日記は1日1ファイル、早朝6時までは昨日扱いというはてなっぽい仕様。あのままC-c , nに割り当てた。
.emacs:

  (setq howm-template
	#'(lambda (n buf)
	    (interactive "p")
	    (cond
	     ((= 1 n)
	      "= %title%cursor
%date %file
")
	     ((= 2 n)
	      (concat 
	       "= nikki
%date
睡眠: %cursor
朝食: 
昼食: 
夜食: 
天気: 
 {_} 英語
 {_} 

進捗:

-
")))))

  (defun howm-current-date-lazy ()
    "6時前なら昨日の日付、それ以降なら今日の日付でemacs内部時間形式で返す(時分秒とか気にしない)"
    (let ((time (decode-time (current-time))))
      (when (< (nth 2 (decode-time (current-time))) 
	       6)				;←6時
	(setf (nth 3 time) (- (nth 3 time) 1)))
      (apply #'encode-time time)))

  (defun howm-nikki-file-name ()
    (concat howm-directory (format-time-string "%Y/%m/")
	    "d-" (format-time-string howm-date-format (howm-current-date-lazy)) ".howm"))

  (defun howm-create-nikki ()
    (interactive)
    (if (file-exists-p (howm-nikki-file-name)) 
	(progn (find-file (howm-nikki-file-name))
	       (howm-set-mode))
      (progn
	(howm-create 2 nil)
	(set-visited-file-name (howm-nikki-file-name)))))

  (define-key global-map (concat howm-prefix "n") #'howm-create-nikki)

あとかるふわすばらしいですね。emacs起動したらhowm-menu表示するようにしてしまった。