I have quite usual recentf config.
(use-package recentf
:config
(setq
recentf-save-file "~/.cache/emacs/recentf"
recentf-max-saved-items 100000
recentf-max-menu-items 5000
)
(recentf-mode 1)
The problem is that I run multiple emacs instances. Unfortunately, it overwrites recentf file when the instances are closed.
instance 1 loads recentf version 1
instance 2 loads recentf version 1
... some times passed instance 1 and instance 2 do some work ...
instance 1 get closed and saves recentf version 3
instance 2 get closed and saves recentf version 4
Problem is that when instance 2 closes it does not read recentf of version 3. As a result files added by version 3 are lost. You can imagine it gets worst with more than one instance. How can I make recentf work correctly with multiple instaces.
In case anybody still encounters this issue:
Try the sync-recentf package. I have not used it but it looks like what you want.
Every Emacs instance maintains the variable
recentf-listwhich is populated by callingrecentf-load-list. Opening files will then append the new filepath to this variable but not to the file. Callingrecentf-save-listwill then cause this variable to be written to the recentf-file you specified. Note that this writing out is not appending to the file but rather replacing its content.Simply calling
recentf-load-listbefore saving is not an option either because this will override the unique files from therecentf-list.The aforementioned package works around this limitation by creating a dummy file on top of
recentf-listeffectively seperating this variable into 'old and new'. When callingrecentf-save-lista newrecentf-listis created by the following steps:recentf-listwith the values fromrecentf-filerecentf-listrecentf-filewith the values from `recentf-list