[OS X Emacs] Aquamacs question: disable/rename backup files?
xah lee
xah at xahlee.org
Tue Jan 22 10:20:41 EST 2008
On Jan 22, 2008, at 6:48 AM, Theodore Todorov wrote:
「So the question is: how can I disable this backup mechanism, or
change the name generation template so that the extension is
modified? The "classical" emacs used to post-pend a tilde to the
name, which worked fine...」
I think the following would be of interest to you.
• How to disable emacs's automatic backup?
Use this code “(setq make-backup-files nil)”.
• How to stop emacs's backup changing the file's creation date of
the original file?
Put this code in your emacs init file: “(setq backup-by-copying t)”
Explanation: when emacs does a backup, by default it renames the
original file into the backup file name, then create a new file as
the original file. So that, the original file effectively have its
creation date and other data changed.
• How to set emacs so that all backups are directed into one folder?
(such as at a directory "~/myBackups")
Use the following lisp code in init file:
; return a backup file path of a give file path
; with full directory mirroring from a root dir
; non-existant dir will be created
(defun my-backup-file-name (fpath)
"Return a new file path of a given file path.
If the new path's directories does not exist, create them."
(let (backup-root bpath)
(setq backup-root "~/.emacs.d/emacs-backup")
(setq bpath (concat backup-root fpath "~"))
(make-directory (file-name-directory bpath) bpath)
bpath
)
)
(setq make-backup-file-name-function 'my-backup-file-name)
The above will mirror all directories at the given backup dir. For
example, if you are editing a file “/Users/jane/web/xyz/
myfile.txt”, and your backup root is “/Users/jane/.emacs.d/emacs-
backup”, then the backup will be at “/Users/jane/.emacs.d/emacs-
backup/Users/jane/web/xyz/myfile.txt~”.
If you want all backup to be flat in a dir, use the following:
(setq backup-directory-alist '(("" . "~/.emacs.d/emacs-backup")))
This will create backup files flat in the given dir, and the backup
file names will have “!” characters in place of the directory
separator. For example, if you are editing a file at “/Users/jane/
web/xyz/myfile.txt”, and your backup dir is set at “/Users/
jane/.emacs.d/emacs-backup”, then the backup file will be at: “/
Users/jane/.emacs.d/emacs-backup/Users!jane!web!emacs!myfile.txt~”.
If you use long file names or many nested dirs, this scheme will
reach file name length limit quickly.
----------
I have some other emacs tips you might be interested here:
http://xahlee.org/emacs/emacs.html
Xah
xah at xahlee.org
∑ http://xahlee.org/
On Jan 22, 2008, at 6:48 AM, Theodore Todorov wrote:
Hello,
I discovered Aquamacs two weeks ago, and I find it very, very good.
It has become my main editor for development (C++ mostly).
There is just one small thing that is annoying, and that I hope an
expert can answer off the top of her head (and yes, I looked in the
help, the FAQ and the Wiki before asking):
aquamacs creates a backup file with the
name ._OriginalName.originalExtension
in the same directory as the original file, for each file I edit.
This conflicts with the build system that I have to use (and cannot
change), which
simply compiles everything with a *.cxx extension in the src
subdirectory of each package.
When it tries to compile the ._Whatever.cxx file I have a problem :-)
So the question is: how can I disable this backup mechanism, or
change the name generation template so that the extension is
modified? The "classical" emacs used to post-pend a tilde to the
name, which worked fine...
Thank you in advance,
Teddy
_____________________________________________________________
MacOSX-Emacs mailing list
MacOSX-Emacs at email.esm.psu.edu
http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx
☄
More information about the MacOSX-Emacs
mailing list