unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* make-manual-backup
@ 2007-06-07 19:27 weber
  2007-06-07 19:38 ` make-manual-backup Joost Kremers
  0 siblings, 1 reply; 2+ messages in thread
From: weber @ 2007-06-07 19:27 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all!
I just wrote this function to make a backup of the current file, but
I'm not happy with the solution I used: I have this second write-file
to return to the original file.
Is there a better (probably also faster) way?
Thanks in advance,
weber

(defun make-manual-backup ()
  "Save a copy without changing to new filename.
Useful for making a copy of working file in development."
  (interactive)
  (let ((old-filename (buffer-file-name))
        (new-filename (concat (buffer-file-name) (format-time-string
"%Y%m%d_%Hh%M"))))
    (write-file new-filename)
    (write-file old-filename)
    (message (concat "Wrote backup " new-filename))))

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

end of thread, other threads:[~2007-06-07 19:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-07 19:27 make-manual-backup weber
2007-06-07 19:38 ` make-manual-backup Joost Kremers

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).