help-gnu-emacs
[Top][All Lists]
Advanced

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

make-manual-backup


From: weber
Subject: make-manual-backup
Date: Thu, 07 Jun 2007 19:27:37 -0000
User-agent: G2/1.0

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



reply via email to

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