From: Eshel Yaron Date: Sat, 9 Dec 2023 20:47:07 +0000 (+0100) Subject: Sort 'M-x recentf' completion candidates by recency. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4e94a8308efd64789ddbfcc3e5573e5b2da8f5bb;p=emacs.git Sort 'M-x recentf' completion candidates by recency. * lisp/recentf.el (recentf-open): Let bind 'completions-sort' to nil. * etc/NEWS: Announce it. --- diff --git a/etc/NEWS b/etc/NEWS index d24d5d6404a..66bf70f604b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1043,6 +1043,12 @@ Similarly to buffer restoration by Desktop, 'recentf-mode' checking of the accessibility of remote files can now time out if 'remote-file-name-access-timeout' is set to a positive number. +--- +*** 'M-x recentf' completion candidates now sorted by recency. +Emacs now sorts file names in 'M-x recentf' completion by recency, +with the file you've accessed most recently first. + + ** Notifications +++ diff --git a/lisp/recentf.el b/lisp/recentf.el index 94ae871763b..4a523d97f92 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el @@ -489,10 +489,11 @@ Return non-nil if F1 is less than F2." "Prompt for FILE in `recentf-list' and visit it. Enable `recentf-mode' if it isn't already." (interactive - (list - (progn (unless recentf-mode (recentf-mode 1)) - (completing-read (format-prompt "Open recent file" nil) - recentf-list nil t)))) + (let ((completions-sort nil)) + (list + (progn (unless recentf-mode (recentf-mode 1)) + (completing-read (format-prompt "Open recent file" nil) + recentf-list nil t))))) (when file (funcall recentf-menu-action file)))