Kodama's home / tips.
emacs でスケジュール文書の "今日" の項目を開く
スケジュール表の作成(ruby スクリプト) でスケジュール文書を生成したが...
....
2007/04/07(土)
2007/04/06(金)
2007/04/05(木)
2007/04/04(水)
....
"今日" の項目に移動するのが面倒.
そこで, emacs で自動化してみた.
次を ~/.emacs に書き込むと, C-x 4 s で schedule.txt ファイルを開いて, "今日" の項目にカーソルを移動する.
(defun schedule () (interactive)
(find-file "~/txt/schedule.txt")
(beginning-of-buffer)
(let
(
(buff0 (current-buffer))
(buff1 (generate-new-buffer "*s-buffer*"))
)
(call-process "date" nil buff1 nil "+%Y/%m/%d") ; 今日の行に移動したい
(set-buffer buff1) (setq s-string (buffer-substring-no-properties 1 11))
(set-buffer buff0) (search-forward s-string)
(kill-buffer buff1)
)
)
(define-key ctl-x-map "4s" 'schedule)
Kodama's home / tips.