Subject: bug#46153: recentf should keep files in most recently used order

From: reporter <[email-masked]>
Date: Thu, 28 Jan 2021 12:37:05 +0000

recentf is very useful for revisiting files, I use it a lot with
completion to reopen files. Completion which puts the most recent
file first.

However, it has a slight problem: it shows the recently opened
files, instead of the recently *used* files.

For example, if I open files a, b, c, d, e in this order and use
them, but in the end I use only files a and b for the last part
of my task and want to revisit this files later then recentf
provides this list (most recent first):

e
d
c
b
a

But I used a and b last a lot, so it's more likely I want to open
those again, so recentf should give me, for example:

b
a
d
e
c

So it should track buffer switches as well and update the recentf
list by moving the file corresponding to the current buffer to
the beginnining of the list (maybe updating the list from an idle
timer if it's costly, there is no need for immediate updates for a
long recentf list, I have 2000 files in it).

This is much more useful than simply tracking file
openings. Other tools also put most recently used files
first. Emacs should do the same.