emacs-devel
[Top][All Lists]
Advanced

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

Re: deleting rcs keywords from emacs sources


From: Robert J. Chassell
Subject: Re: deleting rcs keywords from emacs sources
Date: Fri, 26 Mar 2004 19:05:14 +0000 (UTC)

   If you put a date manually into the files when you send an entire
   file to someone, it would achieve the same purpose, right?
   You'd be doing it manually instead of automatically.

   How much extra work would that impose on you?
   (It depends on how often you actually do this.)

Here is a function to insert the date at point.  I put it in my .emacs
file and use it all the time.

    ;;; Insert current date and, optionally, UTC time into current buffer
    (defun date (&optional full)
      "Insert current date; with optional arg, insert UTC time"
      (interactive "P")
      (if full
          ;; The third, last, optional, argument to format-time-string means
          ;; describe time as Universal Time; this may be labled GMT
          ;; rather than UTC.  2001 Aug 16: Gerd says
          ;;     This is a feature of the OS.  Strftime.c only adds a
          ;;     zone name when gmtime(3) doesn't already return one.
          ;; (format-time-string "%a, %Y %h %e  %H:%M %Z" nil t)
          (insert (format-time-string "%a, %Y %h %e  %H:%M %Z"))
        (insert (format-time-string "%Y %h %e"))))

For example, 

    M-x date  ==> 2004 Mar 26

C-u M-x date  ==> Fri, 2004 Mar 26  19:00 UTC

(I once formatted time strings as day - month - year, but then found
that I often need to see the year, so for this function and the way I
use it, the better format is year - month - day.)

-- 
    Robert J. Chassell                         Rattlesnake Enterprises
    http://www.rattlesnake.com                  GnuPG Key ID: 004B4AC8
    http://www.teak.cc                             address@hidden




reply via email to

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