summaryrefslogtreecommitdiff
path: root/recentf-conf.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-04-10 13:06:08 +0800
committerJSDurand <mmemmew@gmail.com>2022-04-10 13:06:08 +0800
commitdeac1e938f092cc62058eda83d5722a2d3cf79b2 (patch)
tree5955c7a23dbf9dab67e6312aedcb03bc6980f0b8 /recentf-conf.el
parentb6a0e0eaa69d071317f1d4fff6b0b2340f11c47d (diff)
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.
Diffstat (limited to 'recentf-conf.el')
-rw-r--r--recentf-conf.el11
1 files changed, 10 insertions, 1 deletions
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)))