recentf can't save the file opened by ssh
nahso opened this issue · 2 comments
Hello,
I already have the ssh
line commented in the init-misc.el, but the file opened with ssh didn't show in the counsel-recentf
even though I execute recentf-save-list
manually.
The /ssh:192.168.56.105:/home/admin/scripts/test.sh
which is the file of current buffer doesn't display:
Here is the recentf-mode section of my init-misc.el
(setq recentf-keep '(file-remote-p file-readable-p))
(setq recentf-max-saved-items 2048
recentf-exclude '("/tmp/"
;; "/ssh:"
"/sudo:"
"recentf$"
"company-statistics-cache\\.el$"
;; ctags
"/TAGS$"
;; global
"/GTAGS$"
"/GRAGS$"
"/GPATH$"
;; binary
"\\.mkv$"
"\\.mp[34]$"
"\\.avi$"
"\\.wav$"
"\\.docx?$"
"\\.xlsx?$"
;; sub-titles
"\\.sub$"
"\\.srt$"
"\\.ass$"
;; "/home/[a-z]\+/\\.[a-df-z]" ; configuration file should not be excluded
))
Thanks!
I guess it's because (recentf-mode 1)
, it will do the clean up on history (removing non-existing file, etc). See recentf-auto-cleanup
. When your ssh server is temporary offline during emacs startup, the clean up function think the file is deleted and will clean up if from the history
It's my setup in recentf-keep
, the default setup uses a more delicate algorithm, I restore to default setup,
8eadfe3 recentf-mode can remember remote files (Chen Bin)
If default setup still not works, you need set recentf-keep
with your own function.
Thank you! After doing some tests, it seems that the ssh files will be removed regardless of whether the ssh server is online or offline.
Therefore I write my own recentf-keep
function:
(defun my-ssh-p (name)
(equal (string-match "^/ssh:" name) 0))
It works!