RepublicWorried · 2022-10-26 13:37
(defun ido-recentf-open ()
; "Use `ido-completing-read' to \\[find-file] a recent file"
(interactive)
(if (find-file (ido-completing-read "Find recent file: " recentf-list))
(message "Opening file...")
(message "Aborting")))
the above snippet is in my config to conveniently choose from a pool of recently visited files. I am wondering if there is any advantage in using "change buffer" e.g. ibuffer instead? Or rather, whats the difference ?
mickeyp · 2022-10-26 15:07
`ibuffer` is a list of already-open buffers. Recent files contain a recent history of files that you have visited. They may or may not be open already.
So it wouldn't really make sense to change anything. `find-file` will jump to the file's buffer if it is already open.
RepublicWorried · 2022-10-26 15:12
thank you. I am looking for the most efficient way of switching back and forth between "files" when coding thats why I am asking. Why would I then ever consider using switch buffer over recentf if all I am interested in are files mostly?
mickeyp · 2022-10-26 15:28
Another way is `C-x p b` and `C-x p f` to switch to buffers or files related to the current project of your active buffer. (Which assumes it's a project Emacs knows about!)
But my general view is this: use whatever feels right. There are always optimisations, tweaks, and improvements to be had --- but they may only yield tiny, incremental benefits over what you use now.
RepublicWorried · 2022-10-26 15:42
thanks for your advise. I try to go as much vanilla as possible. What do you use for completion these days good sir?
mickeyp · 2022-10-26 15:44
"It's complicated."
I use IDO for files and buffers; Helm for many specialized things; Selectrum as a general completer (but I'm experimenting with others.)