2007-10-31
2007-09-27 空気読めや!
2007-09-25 暇なのでzshいじり
■[はてダラ][emacs]はてダラで更新するとアンカーが変わってしまう
俺はいつもはてダラ+Emacsで日記を書いているが、記事を追記(prepend)するとすでに書いた記事のアンカーが変わってしまってブックマークしてくれてる人に悪いと思う…。
まぁ「*label*〜」記法をつかえばいいんだけど、手書だとどうしても忘れてしまう。
とりあえずuniqueなlabelを生成させる記事追加用elispを書いてみた。現在時刻の秒数をlabelにした。とりあえずこれで急場しのぎ。
(defun hatena-prepend-article () (interactive) (goto-char (point-min)) (forward-line 1) (open-line 2) (insert (format-time-string "*%s*" (current-time)))) (define-key hatenahelper-mode-map "\C-c\C-i" 'hatena-prepend-article)
追記:
id:odzさんより「*t*」はどうかとコメントをいただきました。はてダラの「*t*」記法を使ってもその記事(つまり日記ファイル)を更新したら更新時のタイムスタンプになってしまうので、アンカーが変わってしまいます。あくまで俺が欲しいのは記事作成時のタイムスタンプであって、一度確定すると変わらないものがいいです。数分で殴り書きしたelispで事足りるので当面これでいこうと思います。
2007-08-19
■[はてな][はてダラ][emacs]はてダラ on Emacs
はてなダイアリーライターを emacs から使う(暫定版) - おもてなしの空間
save-window-excursionで*compilation*バッファを表示させないようにしているくらいで、実はこれが実運用環境です。以前はてなの調子がおかしかった時、*compilation*バッファにログが残っていたので助かりました。
はてダラがしっかりしてくれているので、Emacsインターフェース側は十分簡略化されます。
(defun myhatena-submit () "Submit hatena diary file." (interactive) (basic-save-buffer) (save-window-excursion (compile "hw.pl")))
おまけ
グループに書き込みするにはこれ。
(defvar hatena-groups '("dprogramming" "lisp" "ruby" "rubyist"))
(defun hatena-group (group)
"Open today's hatena group diary file."
(interactive
(list (completing-read "Group: " (mapcar 'list hatena-groups) nil t)))
(find-file
(concatenate 'string hatena-dir "/" group "/"
(format-time-string "%Y-%m-%d.txt" (current-time)))))
M-x hatena
emacs 上で、~/memo/hatena/2007-08-19.txt というバッファを開いて
2007-06-24
■[はてダラ]挙動不審
Compilation started at Sun Jun 24 14:28:01 hw.pl -d DEBUG: Debug flag on. Hatena Diary Writer Version 1.3.1 Copyright (C) 2004,2005 by Hiroshi Yuki. DEBUG: Loading config file (config.txt). DEBUG: load_config: id:rubikitch DEBUG: load_config: password:******** DEBUG: load_config: cookie:cookie.txt DEBUG: load_config: client_encoding:EUC-JP DEBUG: load_config: server_encoding:EUC-JP DEBUG: main: files: current dir (.): ./2007-06-24.txt ./cookie.txt ./touch.txt DEBUG: login: Loading cookie jar. DEBUG: get_rkm: $rkm = JOkeerEt6b2UBPy+9jGIzg DEBUG: login: $cookie_jar = Set-Cookie3: rk=88c78b8f6536021721a71182661358; path="/"; domain=.hatena.ne.jp; path_spec; expires="2007-07-24 05:16:23Z"; version=0 Skip login. DEBUG: read_title_body: input: ./2007-06-24.txt Post 2007-06-24. DEBUG: create_it: 2007-06-24. DEBUG: create_it: 302 Moved DEBUG: create_it: Location: http://d.hatena.ne.jp/rubikitch/20070624 DEBUG: create_it: returns 1 (OK). DEBUG: post_it: 2007-06-24. DEBUG: post_it: 500 read timeout ERROR: Post: Unexpected response: 500 read timeout Compilation exited abnormally with code 1 at Sun Jun 24 14:32:53
更新が激重だが更新はされるようだ。更新されてるのにread timeoutっていうのはなんだろうか。
あっさり更新できたと思ったら、次はまた激重だったり。はてなはよく重くなるのかな?でも俺ははてダラをM-x compileのインターフェースで使っているから更新中でも作業ができる。だから重くても許せる。
とりあえずタイムアウトをデフォルトの180から600(10分)にしてみた。
Compilation started at Sun Jun 24 14:48:45 hw.pl -d -T600 Post 2007-06-24. DEBUG: create_it: 2007-06-24. DEBUG: create_it: 500 Internal Server Error ERROR: Create: Unexpected response: 500 Internal Server Error Compilation exited abnormally with code 1 at Sun Jun 24 14:51:54
うわ、更新されてない上に500かよ。
Compilation started at Sun Jun 24 14:53:17 hw.pl -d -T600 Post 2007-06-24. DEBUG: create_it: 2007-06-24. DEBUG: create_it: 302 Moved DEBUG: create_it: Location: http://d.hatena.ne.jp/rubikitch/20070624 DEBUG: create_it: returns 1 (OK). DEBUG: post_it: 2007-06-24. DEBUG: post_it: 500 Internal Server Error ERROR: Post: Unexpected response: 500 Internal Server Error Compilation exited abnormally with code 1 at Sun Jun 24 14:56:39
更新されてるのに500…。
