;;; -*- emacs-lisp -*-
;; RFC822 形式の日付を挿入する関数
(autoload 'timezone-make-date-arpa-standard "timezone")
(defun simm:insert-822date ()
(interactive)
(string-match "\\`\\([A-Z][a-z][a-z]\\) " date)
(insert (match-string 1 date) ", "
(timezone-make-date-arpa-standard date (current-time-zone))))
;; 変更があった場合, Last Change: の項目を保存時点の時刻に更新する
(defun simm:yahtml-save-buffer ()
(interactive)
(when (buffer-modified-p)
(save-excursion
(save-restriction
(when (or (and (goto-char (point-min))
(re-search-forward "^[Ll]ast [Mm]odified: "))
(and (goto-char (point-min))
(re-search-forward "^[Ll]ast [Mm]odify: "))
(and (goto-char (point-min))
(re-search-forward "^[Ll]ast [Cc]hange: ")))
(let ((pt (point)) (date (current-time-string)))
(end-of-line)
(delete-region pt (point))
(simm:insert-822date)
"
"))))
(save-buffer)))
;; C-c C-c にバインドしておく
(add-hook 'yahtml-mode-hook
'(lambda()
(local-set-key "\C-c\C-c" 'simm:yahtml-save-buffer)))
;; yahtml-date.el ends here