Questions tagged [backup]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
2 answers
292 views

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

I was updating my emacs backup approach using ideas from answers to this question, but I'm left unsure by one aspect, namely: the fact that several of them arrange to have backups placed in a single ...
0 votes
2 answers
42 views

Disable lsp-mode for certain buffers matching a specific pattern

What's the preferred way to not enter lsp-mode for certain buffers such as Emacs' backup files named for instance, app.c.~304fb1fe3650a354c4da16352f6c7be8bffd88cb~. I still want such files to open in ...
0 votes
0 answers
15 views

File permissions of backup files

Emacs (26.1) is putting highly restrictive permissions on backup files. This is causing a problem where multiple people are editing the same files. Here's an example: I created a file called test....
12 votes
2 answers
1k views

Turn off automatic backups for specific files

For a long time I've had Emacs put backups for all files into a single folder: (setq backup-directory-alist '(("." . "~/.emacs.d/backups"))) I hardly ever visit the backups directory, but recently I ...
22 votes
3 answers
12k views

Put all backups into one backup folder

How can I set up Emacs so that all backups are placed into one backup folder? e.g. /MyEmacsBackups
0 votes
1 answer
115 views

How can I restore an org file from a backup?

I recently made the mistake of accidently deleting a portion of my home folder. I lost some org-documents for notes and things that I'd like to recover. Luckily, my .emacs.d directory and the backups ...
1 vote
1 answer
287 views

How to disable the generation of auto-save files (e.g. #file.org#, .#file.org# and file.org~)?

I'm new to Emacs and org-mode. Whenever I make changes to any org file it creates auto-save files. For example if the file I'm editing is tasks.org, it creates these files : #tasks.org#, .#tasks.org# ...
0 votes
1 answer
43 views

Mac restart loses buffer state silently

I installed 28.2 on Monterey via Homebrew (as a cask). I have desktop-save-mode set; auto-save-* options are all default. Recently, I restarted the computer for updates; apparently I had somehow not ...
1 vote
1 answer
394 views

Modifying local Google Drive files from Emacs

Recently I've moved from MS Windows to Linux Mint. While on windows, I used to have a code of backup in my init.el file, so that all emacs backups were saved into my local folder DRIVE, that was ...
2 votes
1 answer
59 views

Create versioned backup file on every save into date hierachy

New to Emacs and Lisp. I'm trying to replicate BBEdit's automatic backups, that is: create a subfolder for each day (2022-11-02) include the date and time in the backup's filename (2022-11-02 21-45-...
0 votes
0 answers
12 views

Still getting autosave files in the same directory as my buffer [duplicate]

I have the following in my init file: (setq backup-directory-alist `((".*" . ,temporary-file-directory))) (setq auto-save-file-name-transforms `((".*" ,temporary-file-...
9 votes
3 answers
1k views

Automatic deletion of backup files

When editing files, some foo.bar~ backups appear (files ending with a tilde ~). How can I control their creations, and is it possible to ask for a recursive bulk deletion of all files from a ...
4 votes
1 answer
1k views

How to stop auto backup in some directory in Emacs

In general I want Emacs to save a backup file for me, except in some special directories. I tried to define a Directory Local Variables, and add: ((nil . ((make-backup-files . nil)))) But it seem ...
0 votes
0 answers
116 views

Disable emacs from backingup file in a specified directory

Is it possible to stop emacs from backing up file in a directory? I have a directory that I use for documenting changes I made to the computer. The files in it are small but I need to make 1 everyday ...
0 votes
0 answers
114 views

İs there a way to revert to last hard save?

If I understand correctly M-x revert-buffer reverts to the last auto saved buffer, as explained here. I just lost a big file (it was garbled for some reason). I opened the auto back up file but it was ...
0 votes
1 answer
118 views

How to recover from a backup file

I can recover a file from an auto-save via M-x recover-this-file. So far so good. But how can I recover a file from it's last backup (if, of course, I have switched backups on)?
0 votes
1 answer
33 views

How to prevent backup for files larger than 3MB?

One of the emacs's nice features is Backup. But is there any way to prevent backup for files larger than 3MB? Thanks!
0 votes
0 answers
120 views

How can I make Emacs back up files right after they are saved?

I have followed this answer's solution. My goal is to back up files right after I save them. When I create a new file it is successfully backed up to the given path, but when I close and re-open Emacs ...
1 vote
1 answer
166 views

Creating backup and auto-save files that are not hidden

I use the following code for backup and auto-save files: (setq delete-old-versions -1) (setq version-control t) (setq vc-make-backup-files t) (setq backup-directory-alist `(("." . "h:/...
4 votes
2 answers
2k views

recover backup files

Is there a command for recover the current file from the backup ? I have a file ~/temp.txt and some backup files !home!djangoliv!temp.txt.~1~ ... !home!djangoliv!temp.txt.~5~, !home!djangoliv!temp....
3 votes
0 answers
299 views

How to disable tramp autosave and backups, but keep other backups/autosave?

I'd like to disable autosaves and backups when using tramp, because I neither want to save stuff from remote machines nor stuff belonging to root in my backup/autosave directory. How to do that? I ...
1 vote
1 answer
170 views

How does emacs write files?

When Emacs saves a file (save-buffer, write-file etc.), does it overwrite files directly or does it create a temporary file first? More specifically, if I edit /path-to/file.txt, will Emacs directly ...
3 votes
1 answer
680 views

How can I back up my init file with Git?

The docs say to keep the .emacs file in the HOME directory. I'd like to share the file between multiple computers using a git repo. What is the best way to structure the repo without including ...
4 votes
1 answer
803 views

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

I want the backup files to be created in sub-directories of the files being edited, and I have created a function returns that directory. (defun tempfilepath () (interactive) (concat (file-name-...
2 votes
1 answer
1k views

change auto-save directory

I defined these lines in my .emacs initialization file to change the location for backup and auto-save files. (defvar BACKDIR (expand-file-name "~/emacs_backup/")) (setq backup-directory-alist `((".*"...
3 votes
3 answers
754 views

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

M-x grep can be used to find strings in files. But I'm not interested in backup files (those whose name ends with a ~). How should I ignore those files when using the grep command?
1 vote
2 answers
161 views

I can't backup some orgmode files

I'm in a strange situation. Emacs automatically backup all of my files except for some of my orgmode files. And I can't understand why. Do you have any idea how I can investigate and fix this?
0 votes
1 answer
52 views

I restored my MacOS machine from a backup. How to fix errors while trying to read/write non existing files in the /var/folders/ directory?

I restored my machine from a backup where I hadn't backed up system directories. Now my restored emacs (spacemacs) insist on trying to read and write from this directory and I keep on getting errors ...
1 vote
0 answers
31 views

automatically backup before revert

I would like to backup buffers before they are (auto) reverted. This is nontrivial because the file a buffer is visiting isn't current, and the backup system normally works by duplicating the file ...
3 votes
1 answer
108 views

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

If I edit an executable script, say foo.sh, then upon saving emacs makes the backup file foo.sh~. That's all well and good, but if the original file has the executable bit set, then so does the backup....
0 votes
1 answer
156 views

Set variable not been read from .emacs

I've set some variables (kept-new-versions, for one) to a higher number (10, it was 2) since I don't mind having a handful of backup files in my dir. I did it using C-h v and customizing the variable....
1 vote
1 answer
283 views

Prevent creation of backup org file

Whenever I create an Org file, a ~ backup file is created. How can I prevent this behaviour?
1 vote
1 answer
195 views

Disable auto-backup only for certain files

As of How to stop auto backup in some directory in Emacs, it's possible to configure emacs to backup conditionally. Is there an option to set inside the file, in the first line, to disable backup for ...
1 vote
2 answers
545 views

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

I am aware of How to place all auto-save files in a directory, but I cannot figure it out from Emacs manual how to save all auto-save versions and all backup copies of a given file in a subdirectory ...
1 vote
2 answers
781 views

Change naming scheme for backup files

I'm putting all my backups in a directory: (defvar saves-dir (expand-file-name "~/.saves/")) (setq backup-directory-alist `((".*" . ,saves-dir))) This creates annoying filenames with ! in them, such ...
4 votes
0 answers
221 views

Why is renaming (rather than copying) the default way to create backup files?

The documentation on backup file creation, Copying vs. Renaming, makes it sound like copying is the more sensible choice. file owner and group remain unchanged hard links remain associated with the ...
2 votes
1 answer
563 views

Spacemacs/org-mode with nvAlt: disabling numbered backups

I'm fairly new to spacemacs/emacs, so apologies if this is a trivial question. I'm using org-mode for my notes, stored within nvAlt. This works wonderfully in terms of searching/syncing, however ...
2 votes
0 answers
52 views

Keeping multiple back-ups

The below settings in my .emacs make emacs (24.3) save multiple back-ups. (setq delete-old-versions t kept-new-versions 6 kept-old-versions 2 version-control t) However, I have ...
0 votes
1 answer
90 views

How to save a file in place even with backups?

In order to prevent NFS caching from leading to stale files, I need to preserve the inode of a file when Emacs saves it. Normally, it does so anyway, but apparently not if backup files come into play....
6 votes
1 answer
474 views

version control using the usual backup system of Emacs

This question is inspired by https://emacs.stackexchange.com/a/7831/ and the below settings borrowed from that answer : (setq backup-directory-alist '(("." . "~/emacs-backups")) version-control ...
4 votes
2 answers
635 views

Backup saved buffers to Dropbox (or other specific directory)

Is it possible to customize Emacs so that whenever I save a file, Emacs also copies it to a specific folder? This directory could be, for instance, D:\my_backups or C:\Users\username\Dropbox\...