unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: printing file last-modify date and time
@ 2011-02-05  0:22 O
  2011-02-05  2:09 ` Le Wang
  2011-02-05  2:26 ` Deniz Dogan
  0 siblings, 2 replies; 3+ messages in thread
From: O @ 2011-02-05  0:22 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

Hi all,

I'd like to write a command that prints the last-modify date and time
of the file open in the current buffer, in the format: 20110204-1920
(for 7:20pm on 4 feb 2011).  Suggestions?

Thanks,

O

[-- Attachment #2: Type: text/html, Size: 251 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: printing file last-modify date and time
  2011-02-05  0:22 printing file last-modify date and time O
@ 2011-02-05  2:09 ` Le Wang
  2011-02-05  2:26 ` Deniz Dogan
  1 sibling, 0 replies; 3+ messages in thread
From: Le Wang @ 2011-02-05  2:09 UTC (permalink / raw)
  To: O; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

On Sat, Feb 5, 2011 at 8:22 AM, O <mondifero@gmail.com> wrote:

>
> Hi all,
>
> I'd like to write a command that prints the last-modify date and time
> of the file open in the current buffer, in the format: 20110204-1920
> (for 7:20pm on 4 feb 2011).  Suggestions?
>

Sure.  Read the emacs lisp manual, when you can't find something you need,
google it, If that fails come back and ask specific questions.


-- 
Le

[-- Attachment #2: Type: text/html, Size: 711 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: printing file last-modify date and time
  2011-02-05  0:22 printing file last-modify date and time O
  2011-02-05  2:09 ` Le Wang
@ 2011-02-05  2:26 ` Deniz Dogan
  1 sibling, 0 replies; 3+ messages in thread
From: Deniz Dogan @ 2011-02-05  2:26 UTC (permalink / raw)
  To: O; +Cc: help-gnu-emacs

2011/2/5 O <mondifero@gmail.com>:
>
> Hi all,
>
> I'd like to write a command that prints the last-modify date and time
> of the file open in the current buffer, in the format: 20110204-1920
> (for 7:20pm on 4 feb 2011).  Suggestions?
>

(defun insert-modification-time ()
  (interactive "*")
  (if buffer-file-name
      (insert
       (format-time-string
        "%Y%m%d-%H%M"
        (nth 5 (file-attributes buffer-file-name))))
    (message "No file associated with buffer.")))


-- 
Deniz Dogan



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-05  2:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-05  0:22 printing file last-modify date and time O
2011-02-05  2:09 ` Le Wang
2011-02-05  2:26 ` Deniz Dogan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).