The list of recent files in spacemacs is kept in ~/.emacs.d/.cache/recentf
. Its just a plain text file, but it contains elisp and can be parsed as a lisp file. You could use the shell to parse out the most recent 10 files or whatever you want and print them on the command line, or you could try to use emacs --batch
to run some lisp functions and get what you want. I tried this:
emacs --batch --eval="(progn (require 'recentf) (require 'seq) (recentf-load-list) (dolist (element (seq-take recentf-list 5)) (message element)))"
which seems to work, the only caveat is that I haven't tried it against Spacemacs and where it keeps its recentf list. I think with emacs --batch
you don't load any of the spacemacs config by default, so recentf
may look in the default location of ~/.emacs.d/recentf
. Also, it prints out other messages to stdout as it loads.
it would probably be much cleaner with emacs --batch
if you wrote a little elisp script to do everything you want and run that instead.