该接受的答案是好的,但它可以通过额外得到很大的提高上备份 每一个保存和备份版本的文件。首先,如接受的答案中所述的基本设置:(setq version-control t ;; Use version numbers for backups. kept-new-versions 10 ;; Number of newest versions to keep. kept-old-versions 0 ;; Number of oldest versions to keep. delete-old-versions t ;; Don't ask to delete excess backup versions. backup-by-copying t) ;; Copy all files, don't rename them.接下来,还要备份版本控制的文件,Emacs默认不会备份这些文件(您不会在每次保存时都提交,对吗?):(setq vc-make-backup-files t)最后,对每个保存进行备份,而不仅仅是第一次。我们进行两种备份:每会话备份:在每个Emacs会话中第一次保存缓冲区时一次。这些模拟Emac的默认备份行为。每次保存备份:每次保存一次。Emacs默认情况下不执行此操作,但是如果长时间保持Emacs运行,这将非常有用。该备份去不同的地方和Emacs自动创建备份迪尔斯如果它们不存在:;; Default and per-save backups go here:(setq backup-directory-alist '(("" . "~/.emacs.d/backup/per-save")))(defun force-backup-of-buffer () ;; Make a special "per session" backup at the first save of each ;; emacs session. (when (not buffer-backed-up) ;; Override the default parameters for per-session backups. (let ((backup-directory-alist '(("" . "~/.emacs.d/backup/per-session"))) (kept-new-versions 3)) (backup-buffer))) ;; Make a "per save" backup on each save. The first save results in ;; both a per-session and a per-save backup, to keep the numbering ;; of per-save backups consistent. (let ((buffer-backed-up nil)) (backup-buffer)))(add-hook 'before-save-hook 'force-backup-of-buffer)我开始对这个话题很感兴趣后,我写$<的,而不是 $@我的Makefile,约后,我的前三年时间内调动:P