Look at the normal-backup-enable-predicate
function, which is the default value for the backup-enable-predicate
variable.
As the sole purpose of the default function is to inhibit backups for files in various temporary directories, you may just want to set a replacement which returns t
unconditionally.
(setq backup-enable-predicate (lambda (name) t))
The usage in files.el suggests to me that you could also just set this variable to nil
. That's not stated in the documentation, so it might not be reliable, but the variable isn't referenced by any other library in Emacs, so it's probably fine (but I'd still recommend using the lambda, because it's more obvious what that's doing).
See also C-hig (elisp) Making Backups
RET
n.b. I'm not actually familiar with small-temporary-file-directory
(see the docstring for that variable), but the temporary-file-directory
value would typically be /tmp/
, so those two cases are usually the same.
If you did want to retain the default behaviour for some temporary directories but not others, you should define a modified copy of the original function: (defun my-backup-enable-predicate ...)
and then (setq backup-enable-predicate 'my-backup-enable-predicate)