help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: More convenient editing of recentf files


From: Drew Adams
Subject: RE: More convenient editing of recentf files
Date: Sun, 15 Mar 2009 20:24:47 -0700

> From: B. T. Raven Sent: Sunday, March 15, 2009 6:09 PM
>
> Thanks, Drew. I called the main defun prune-recentf-list and 
> it worked but with deeply nested file hierarchy, it's still
> a lot of typing.

I guess you're saying that with a file that has many ancestor directories, you
must type a lot, for (absolute file-name) completion to distinguish a unique
candidate.

Yes, I can see that. That's where Icicles substring or regexp matching comes
into play. You can match any parts of the absolute file name. Pick one or more
distinctive parts of the name, and match just those parts directly. No need to
type the whole prefix up to the significantly different part.

That part is not available with the vanilla code I sent, even though the actual
code is almost the same. You need Icicles to get the other features.

> For now I'll just use:
> (defalias 'rel 'recentf-edit-list)
> (defalias 'rof 'recentf-open-files)
> (defalias 'rsl 'recentf-save-list)
> so I can avoid the mouse.
> 
> Does the code below require that Icicles be installed?
> It looks like it depends on the existence of icicle-define-command.

The first code I sent (`remove-some-recent-files') does not require Icicles. I
think it might respond to your need. (I guess that's what you called
`prune-recentf-list', above.)

The second code I sent (`icicle-remove-file-from-recentf-list') depends on (a)
Icicles being installed and (b) your being in Icicle minor mode. It uses Icicles
multi-command features.

> I probably will install icicles someday. It looks intriguing
> but I need to keep things as close to the standard Emacs
> install as possible for now.

(FWIW, you can toggle Icicle mode off at any time, to return to vanilla Emacs
behavior.)

Let me be clear. My aim was to:

1. Give you an idea how to code a command that would help you out, using vanilla
Emacs (no Icicles).

2. Explain that nearly the same code will define a multi-command in Icicles,
which can be even more helpful (but which requires Icicles). The code is about
the same, but the effect is more power, because of being able to bring into play
other Icicles features (e.g. regexp matching, candidate cycling).

Had the aim been just to tell you how to get what you need with Icicles, I would
have mentioned foremost that you can remove file names from the recent list on
the fly, when you use command `icicle-recent-file' (File > Icicles > Open Recent
File) to open recent files. No need to invoke a separate command
(`icicle-remove-file-from-recentf-list') just for the removal.

How does that work? `icicle-recent-file' is ostensibly for opening one or more
recent files, not for removing them from `recentf-list'.

But just as you can use `C-RET', `C-mouse-2', etc. with an Icicles multi-command
to act on more than one candidate (see previous mail), so, at least with some
multi-commands, you can use `C-S-RET', `C-S-mouse-2', etc. to act in some other
way on candidates. These are "alternative action" keys, and for
`icicle-recent-file' the alternative action is to remove the chosen file name
from the recent-files list.

So this is a second way to do what you requested using Icicles. If you are
already in the process of opening one or more recent files, you can also remove
one or more others from the recent list at the same time.

HTH.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]