0

I know Spacemacs keeps track of my recently-edited files. But I can't find a function that will allow me to see these from the command line.

Ideally I'd like to find a way to run Rofi and see a list of recent files, and open them in emacs.

I know there's a helm function for this, I just think it'd be cool to do with Rofi.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.