From: B. T. Raven Sent: Sunday, March 15, 2009 11:43 AM
In .emacs I have:
(add-to-list 'same-window-buffer-names "*Buffer List*")
and '(iswitchb-mode t nil (iswitchb)) in custom-set-variables
so I can navigate to buffers quickly with C-x b and kill
selected ones with C-x C-b via D, SPC, and X keys.
Is there a way to do something like this with recentf files?
Now I have to use the mousey checkbox interface:
menubar > Open Recent > Edit list > check ... check ... check
.... move to bottom of list ... check ok
Perhaps someone else will give you an Iswitchb-specific answer for recentf file
deletion. If not, the following might help.
If you use Icicles, you can use `Remove from Recent Files List' in menu Files >
Icicles, or use `M-x icicle-remove-file-from-recentf-list'.
During completion, you can filter candidates with your input (e.g. substring,
regexp, prefix), and cycle among matches. Use `C-RET' or `C-mouse-2' repeatedly
to remove as many individual file names as you like.
Use `C-!' to remove all file names that match the current input pattern - use as
many patterns as you like. Use `C-~' (complement) to match against all
candidates that do *not* match some input pattern. Use `M-SPC' to combine input
patterns (logical AND): progessive completion.
(And yes, you can use Iswitchb with Icicles.)
----
Without Icicles, you could call, within a loop, a command that reads a single
absolute file name using completion (letting the user quit the loop with, e.g.,
`C-g'). A user would then complete file names to remove them from
`recentf-list'.
(defun remove-some-recent-files ()
"Remove some files from the list of recently used files."
(interactive)
(while recentf-list
(call-interactively #'remove-a-recent-file)))
Within the loop, call `completing-read' against `recentf-list'. E.g.:
(defun remove-a-recent-file (file)
"Remove a file from the list of recently used files."
(interactive
(list
(completing-read
"Remove from recent files list (`C-g' when done): "
(mapcar #'list
(progn
(unless (boundp 'recentf-list)(require 'recentf))
(when (fboundp 'recentf-mode) (recentf-mode 99))
(unless (consp recentf-list)
(error "No recently accessed files"))
recentf-list))
nil (and (fboundp 'confirm-nonexistent-file-or-buffer)
(confirm-nonexistent-file-or-buffer)) ; Emacs23.
nil 'file-name-history (car recentf-list))))
(setq recentf-list (delete file recentf-list))
(message "`%s' removed from `recentf-list'" file))
If you know you're going to have `recentf.el' loaded and be in `recentf-mode',
then you can skip the first part of the `progn'. If you know you have Emacs 22+,
you can skip the `mapcar'. If you know you have Emacs 23, you can skip the
`fboundp' for `confirm-...'.