Skip to main content
Share Your Experience: Take the 2024 Developer Survey
6 votes
Accepted

recover backup files

Le Wang's backup-walker library facilitates this: traverse incremental diffs between backup versions open backup in traversal mode if the diff seems interesting traverse backups ...
phils's user avatar
  • 51.6k
5 votes

Emacs backups - why backup all files to a single directory?

There is no accounting for taste.
db48x's user avatar
  • 18.3k
4 votes
Accepted

How can I back up my init file with Git?

There is no need to to turn your whole home into a repo. .emacs.d will be enough, and cloning it whatever you go will do it too. Supposing that your .emacs.d is a repo, to do that your .gitignore ...
Muihlinn's user avatar
  • 2,634
4 votes
Accepted

How can backup-directory-alist be set to save in the files directory?

Just use relative directory name (setq backup-directory-alist '(("." . "editorbackups"))) Function make-backup-file-name-1 will make directory name relative to file's directory and create it: ;; If ...
muffinmad's user avatar
  • 2,310
3 votes
Accepted

How to stop auto backup in some directory in Emacs

Backup decisions seem to pass through the function normal-backup-enable-predicate, via the variable backup-enable-predicate which is set to this by default. You can provide your own function to return ...
meuh's user avatar
  • 160
2 votes

recover backup files

How about this: (defun revert-to-backup () "Reverts to the latest backup file associated with the current buffer." (interactive) (let ((file (buffer-file-name))) (when file (let ((bak ...
glucas's user avatar
  • 20.6k
2 votes
Accepted

Disable auto-backup only for certain files

According to my test, simply set make-backup-files to nil locally, for example, M-x add-file-local-variable-prop-line make-backup-files nil
xuchunyang's user avatar
  • 14.6k
2 votes
Accepted

Set variable not been read from .emacs

To set variables in Emacs use: (setq version-control t) ;; Use version numbers for backups. (setq kept-new-versions 10) ;; Number of newest versions to keep. (setq kept-old-versions 0) ;; ...
Daniel's user avatar
  • 3,653
2 votes

I can't backup some orgmode files

If your org files are under version control (which I would recommend) then vc-checkin sets backup-inhibited to t. This makes sense as my .org files are all under version control and don't need the ~ ...
wef's user avatar
  • 452
2 votes
Accepted

change auto-save directory

You should probably have a more explicit regex in auto-save-file-name-transforms. The regex matches against the buffer file name. So what's happening in your case is Your buffer filename is: "/home/...
nega's user avatar
  • 3,276
2 votes
Accepted

Creating backup and auto-save files that are not hidden

What do you mean by the files being "hidden"? Hidden where, how? You can specify the file names you want for backup files, if something is causing them to be somehow "hidden" based ...
Drew's user avatar
  • 77.9k
2 votes

How does emacs write files?

As an answer I cite here mostly the comments of the normal execution path in basic-save-buffer-2 which is the working horse of save-buffer: ;; Write temp name, then rename it. ;; This ...
Tobias's user avatar
  • 33.3k
2 votes

Mac restart loses buffer state silently

Enable the vc-make-backup-files user option to get normal backups despite version-control. The following is essentially untested (I've just written it), but seems like it plugs a hole in the standard ...
phils's user avatar
  • 51.6k
1 vote

How can I restore an org file from a backup?

I couldn't find any pre-written elisp code that would automate this for backup files and your use case... (but for autosave files there is recover-file, and there is a related question recover backup ...
orgtre's user avatar
  • 1,080
1 vote
Accepted

Create versioned backup file on every save into date hierachy

Got it. This code creates a backup file on each save. File path example: ~/Documents/Emacs/Emacs Backups/2022-11-04/todo (2022-11-04 00-28-00-674).org. ;;;; Create versioned backup file on every save ...
Pete's user avatar
  • 31
1 vote

Modifying local Google Drive files from Emacs

You might try Tramp's Google Drive integration. Try to write your backups to /gdrive:[email protected]:/path/to/dir. Alternatively, you could use Tramp's rclone method like /rclone:gdrive:/path/to/...
Michael Albinus's user avatar
1 vote

How to prevent backup for files larger than 3MB?

I haven't tested this, but here's an example of how you could advise backup-enable-predicate so that your size check happens only after the default backup-enable-predicate has determined that your ...
Basil's user avatar
  • 12.5k
1 vote

How to recover from a backup file

For that, I use https://github.com/lewang/backup-walker. (autoload 'backup-walker-start "backup-walker" "" t)
djangoliv's user avatar
  • 3,199
1 vote

How to ignore backup files (~) when running grep?

You could put your backup files somewhere else. When you do a grep emacs will ask for the root directory for the search, defaulting to the current directory. You could specify a directory for the ...
Iain's user avatar
  • 194
1 vote

How to ignore backup files (~) when running grep?

You can modify the pattern match to exclude file with names ending in ~ via [^~]. When M-x grep prompts you for the grep command, use something like: grep match-text ./path/*[^~]
Tyler's user avatar
  • 22.4k
1 vote
Accepted

How do I prevent backups of scripts from being made executable?

The variable backup-directory-alist tells emacs where to save the backups. Adding the following to your init file will set its value only if the executable bit is set. (defun make-executable-backup-...
matteol's user avatar
  • 2,038
1 vote

Prevent creation of backup org file

Customize option make-backup-files to nil. See the Emacs manual, node Backup. You could find this information yourself by asking Emacs: Open the Emacs manual: C-h r Consult the index: i backup TAB. ...
Drew's user avatar
  • 77.9k
1 vote
Accepted

How to set auto-save and backup path as subdirectory sibling of a given open file?

This will configure things to save both backup and auto-save files to an emacs-backups directory relative to the file you are visiting. (let ((dir "emacs-backups")) (setq auto-save-file-name-...
glucas's user avatar
  • 20.6k
1 vote

Change naming scheme for backup files

You can customize themake-backup-filename-function variable to do this, using the existing make-backup-file-name and make-backup-file-name-1 as examples. If you don't need to support msdos etc then ...
icarus's user avatar
  • 1,924
1 vote

Turn off automatic backups for specific files

If you want to avoid backups for a single file, you can use the line # -*- backup-inhibited:1 -*- at the top of the file, where # is the comment style for that file. See https://www.gnu.org/software/...
serv-inc's user avatar
  • 828

Only top scored, non community-wiki answers of a minimum length are eligible