From 786553a25d977a28039b6315a4a4021699d6c7d5 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 22 Jan 2015 23:38:23 +0900 Subject: [PATCH] Fix recentf file saving --- emacs.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/emacs.el b/emacs.el index a4550da..015a388 100644 --- a/emacs.el +++ b/emacs.el @@ -1666,9 +1666,16 @@ found, otherwise returns nil." (add-to-list 'recentf-exclude (regexp-quote (expand-file-name user-emacs-directory))) (define-key ctl-x-map (kbd "C-r") 'recentf-open-files) + (remove-hook 'find-file-hook + 'recentf-track-opened-file) + (defun my-recentf-load-track-save-list () + "Load current recentf list from file, track current visiting file, then save +the list." + (recentf-load-list) + (recentf-track-opened-file) + (recentf-save-list)) (add-hook 'find-file-hook - 'recentf-save-list - t) ; save to file immediately after adding file to recentf list + 'my-recentf-load-track-save-list) (add-hook 'kill-emacs-hook 'recentf-load-list) ;;(run-with-idle-timer 5 t 'recentf-save-list)