狐の王国


2005年06月03日(金) [過去の今日]

#1 time-stamp.el

へー、Emacsにはこんなもん付いてたんだな。これは気持ちいい。

参考にした(あるいはコピペした)サイトは、 ~/.emacsへの雑多な設定 とか Meadow/Emacs memo とか Emacs Lisp TIPS とかそのへん。

htmlんときは下の方に書くことにしたので、

(add-hook 'html-helper-mode-hook
          '(lambda ()
             (make-variable-buffer-local
              (setq time-stamp-line-limit -10))))

という設定も追加。 これでhtml-helper-modeんときだけ下から10行を見てくれる。ちなみにデフォルトは上から8行。

(@533)

で、:

全体としてはこんな設定にした。

;; timestamp.el
(setq time-stamp-start "[Ll]ast[ \-][Mm]odified:[ \t]*")
(setq time-stamp-end "\\($\\|<\\)")
(setq time-stamp-format "%3a %3b %2d %02H:%02M:%02S %Z %:y")
(add-hook 'before-save-hook 'time-stamp)

(defun time-stamp-with-locale-c ()
  (let ((system-time-locale "C"))
    (time-stamp)
    nil))

(if (not (memq 'time-stamp-with-locale-c write-file-hooks))
    (add-hook 'write-file-hooks 'time-stamp-with-locale-c))

(add-hook 'html-helper-mode-hook
          '(lambda ()
             (make-variable-buffer-local
              (setq time-stamp-line-limit -10))))

基本的に RFC2822形式 の日付表記で、「last modified:」とか「Last-Modified:」とかいう文字列を探して挿入。終端は行末、あるいは閉じタグを探すために"\\($\\|<\\)"としてみた。

(@564)

ちげ:

間違えてた

(add-hook 'html-helper-mode-hook
          '(lambda ()
             (make-variable-buffer-local 'time-stamp-line-limit)
             (setq time-stamp-line-limit -10)))

こうやるのか、ふむふむ。

(@605)

この記事のURI

最近の記事

以上、1 日分

タイトル一覧


カテゴリ分類
Powered by hns-2.19.8, HyperNikkiSystem Project

過去にこの日記が置いてあったcgi.misao.gr.jpは廃止されました。それによって記事へのURIが変わってしまっています。cgi.misao.gr.jpをwww.misao.gr.jpと置き換えるだけで同じ記事にアクセスできるはずです。

Sugano "狐志庵" Yoshihisa(E) @ 美紗緒ネットワーク <koshian@misao.gr.jp>
日記管理ページ