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

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

Re: backup-each-save.el


From: Kevin Rodgers
Subject: Re: backup-each-save.el
Date: Tue, 05 Oct 2004 16:28:08 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Francesco Potorti` wrote:
>>I know emacs makes backup files (~-files) but that appears to take
>>place among file visits (series of opens and closes), not among file
>>saves.
>
> It does, if you give a prefix to C-x C-s:
>
> C-x C-s runs the command save-buffer
>    which is an interactive compiled Lisp function in `files'.
> (save-buffer &optional ARGS)
>
> Save current buffer in visited file if modified.  Versions described below.
> By default, makes the previous version into a backup file
>  if previously requested or if this is the first save.
> With 1 C-u, marks this version
>  to become a backup when the next save is done.
> With 2 C-u's,
>  unconditionally makes the previous version into a backup file.
> With 3 C-u's, marks this version
>  to become a backup when the next save is done,
>  and unconditionally makes the previous version into a backup file.
>
> With argument of 0, never make the previous version into a backup file.

So for the OP:

(defadvice save-buffer (before always-backup activate)
  "When called interactively, act as if 3 \\[universal-argument]'s were typed."
  (when (interactive-p)
    (ad-set-arg 0 64)))

--
Kevin Rodgers



reply via email to

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