[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: timestamp in emacs

From: Marco Parrone
Subject: Re: timestamp in emacs
Date: Wed, 05 May 2004 19:35:54 GMT
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Antonio Garcia on Wed, 5 May 2004 09:21:05 -0700 writes:

> I would like to easily interject a timestamp, a la date command, in a
> buffer in emacs. Is there a pre-existing macro I can use, or do I have to
> make one myself? If the latter, pointers to how to do so appreciated.

The following code should work.

(setq substitute-keywords-keywords/expressions-alist
      (list (cons "\\$\Date:.*\\$"
                  '(format-time-string "$\Date: %a, %d %B %Y %T %Z $"

(defun substitute-keywords ()
     (lambda (keyw/exp)
       (replace-regexp (car keyw/exp)
                       (eval (cdr keyw/exp))))

;; Deprecated.
;; (add-hook 'write-file-hooks 'substitute-keywords)

Marco Parrone (marc0) <address@hidden> [0x45070AD6]

Attachment: pgpJhVNxpIQIj.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]