From deac1e938f092cc62058eda83d5722a2d3cf79b2 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sun, 10 Apr 2022 13:06:08 +0800 Subject: recentf-conf: don't check if a remote file exists * recentf-conf.el (file-exists-or-remote-p): If a file name specifies a remote file, treat it as an existing file. (choose-recent-file): Don't check if a remote file exists. Otherwise it will take a sizeable amout of time whenever I want to open a recent file, which is kind of unacceptable to me. --- recentf-conf.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'recentf-conf.el') diff --git a/recentf-conf.el b/recentf-conf.el index 3097b66..f9e2c84 100644 --- a/recentf-conf.el +++ b/recentf-conf.el @@ -6,11 +6,20 @@ (recentf-mode 1) +(defun file-exists-or-remote-p (filename) + "Return t if file FILENAME exists or is a remote file. +If this file is remote, as determined by `file-remote-p', then +this returns t. + +Otherwise, this returns the result of `file-exists-p'." + (cond ((file-remote-p filename) t) ((file-exists-p filename)))) + ;;;###autoload (defun choose-recent-file () "Choose a recently visited file to visit. This uses `completing-read' to choose a file from `recentf-list'." (interactive) (let ((choice (completing-read "Choose a recently visited file: " - recentf-list 'file-exists-p t))) + recentf-list + #'file-exists-or-remote-p t))) (find-file choice))) -- cgit v1.2.3-18-g5258