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-list
which is populated by calling recentf-load-list
. Opening files will then append the new filepath to this variable but not to the file. Calling recentf-save-list
will 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-list
before saving is not an option either because this will override the unique files from the recentf-list
.
The aforementioned package works around this limitation by creating a dummy file on top of recentf-list
effectively seperating this variable into 'old and new'. When calling recentf-save-list
a new recentf-list
is created by the following steps:
recentf-list
with the values from recentf-file
recentf-list
recentf-file
with the values from `recentf-list
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.