1

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?

Rene
  • 89
  • 1
  • 6
  • 2
    What does `C-h v backup-inhibited` say when evaluated in the buffer of one of the files that don't get backed up? What does it say in other buffers? – NickD Jan 14 '19 at 20:15
  • Ghah! Me too! I found that something had set `backup-inhibited` to `t` (thanks @NickD) The only place I can see that being set is in `./elpa/org-plus-contrib-20181230/ox-odt.el`. Maybe that's the culprit? – wef Jan 15 '19 at 01:27
  • ... and I can't seem to set it to nil in `Local Variables` - there must be something setting it to `t` as `org-mode` starts up. Maybe I can set it in a late-executing hook - I'll have time to investigate a bit later. On the other hand, maybe there's a good reason for it to be `t`??? – wef Jan 15 '19 at 01:40
  • Thanks @wef that's exactly it. Why on earth does org-plus-contrib set `backup-inhibited` to `t`? If you happen to find a fix let us know. – Rene Jan 15 '19 at 08:01
  • @Rene - not quite. I concluded that it was `vc-checkin` in my case (please refer to my answer below and see if it's your use-case). – wef Jan 15 '19 at 08:16

2 Answers2

2

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 ~ backup. (I use Version Control Always and SRC - Simple Revision Control

If you really want the ~ backups as well, then M-: (setq-local backup-inhibited nil).

wef
  • 452
  • 2
  • 9
  • Enable the `vc-make-backup-files` user option to get normal backups despite version-control. – phils Mar 07 '23 at 02:40
0

The last time I ran into similar problems was when some of my file or directory names matched a magic variable which is supposed to prevent saving of unwanted things. In my particular case, the project's directory was called something like com.example.githook and the .git? matched completion-ignored-extensions. It's been a while, though, so I'm not 100% it was that variable.

So, while I can't explain why your files are not backed up, maybe this gives you a hint at what to search for: do the filenames of the files which are not backed up look suspicious?