Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.4k points)

Emacs does not create backups of files inside a git repository. I would like to have them saved since I often rely on them for undoing some changes before committing my changes to the git repo.

I was using xemacs until recently, and it would always create the usual *~ files at first save. But emacs doesn't do it if working inside a git project: it makes the usual backup files, when working outside the project, but not the ones inside a git repo.

I tried the following in my .emacs file without success:

(setq make-backup-files t)

(setq backup-inhibited nil)

I have looked at the doc here and in the section about backup-inhibited it seems as if emacs checks each time if the file is controlled by a control version system, and in case it is, it wouldn't create the backup file. This check might be the one preventing the creation of the desired backup file. Is there a way to change this behavior?

1 Answer

0 votes
by (12.4k points)

As you can see here, If your files are under version control then 

"vc-checkin" sets backup-inhibited" to "t".

Now check if you have module activated as in this: the"lisp/vc.el

This module includes:

;; (unless vc-make-backup-files

;;   (make-local-variable 'backup-inhibited)

;;   (setq backup-inhibited t))



would help.

Are you interested in knowing more about DevOps and its Tools? Come & join: DevOps Certification

Browse Categories