unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: weber <hugows@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: make-manual-backup
Date: Thu, 07 Jun 2007 19:27:37 -0000	[thread overview]
Message-ID: <1181244457.515639.63610@m36g2000hse.googlegroups.com> (raw)

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	other threads:[~2007-06-07 19:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07 19:27 weber [this message]
2007-06-07 19:38 ` make-manual-backup Joost Kremers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1181244457.515639.63610@m36g2000hse.googlegroups.com \
    --to=hugows@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).