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

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

Re: ;;; anything.el --- open anything


From: Mathias Dahl
Subject: Re: ;;; anything.el --- open anything
Date: Wed, 11 Jul 2007 18:31:54 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (windows-nt)

"address@hidden" <address@hidden> writes:

>> Maybe buffers isn't the best example, a better one could be
>> friends, or colleagues. Say I want to send a chat message to my
>> friend. Using `anything' I type in his name and get a match, then I
>> get to choose whether I want to start to chat with him or send him
>> an e-mail.

> I added experimental support for multiple actions. Action attribute
> can also be a list (see the doc) and using TAB any action can be
> selected from this list instead of executing the default action. See
> source Buffers as an example. The newest version is on emacs wiki.

Hi, it's me again... :)

This seems to work well. However, I have some thoughts about it. Let's
take the example with contacts again, because it is familiar to me:
Say I want to contact a friend, let's call him Tom. I start `anything'
and type away and Tom's name shows up in the list. I type TAB and see
the two actions `Chat' and `Send e-mail'. This is exactly what I
wanted. But, what if Tom isn't online and available for chat? Well,
it's not a big problem, but maybe I approached this scenario in the
wrong way. Maybe another approach would be better?

For example, one could define a type for each source and then have
type handlers instead of hard coding a list of actions. Each handler
could then be called with two arguments, ITEM and ACTION. ITEM is the
item selected by the user. ACTION would be one of `query' and
`execute'. 

When a handler is called with `query' it will need to return either
`t' or `nil'. `t' means that the handler will be able to take care of
this particular item, in my scenario it will see if Tom is online and
if he is, return `t', otherwise `nil'. Only if after the query the
handler returns `t' will that action be displayed in the action
list. When the user selects a certain action, the handler will be
called with `execute' instead.

I should point out that the above is mostly loose ideas that I got, I
am very happy with how `anything' currently works and use the iswitchb
integration right now. Very useful! Having file name history and
bookmarks as fallback when switching buffers is really neat.

/Mathias


reply via email to

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