[Top][All Lists]

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

RE: propose adding Icicles to Emacs

From: Drew Adams
Subject: RE: propose adding Icicles to Emacs
Date: Mon, 25 Jun 2007 14:40:48 -0700

>     > But this suggests there should be a minibuffer command to
>     > say "submit each of current candidates, one by one."
>     What do you mean, "submit"? Submit to what?
> Submit as an argument.  Just as C-RET submits the current minibuffer
> contents as an argument (then reads another), this proposed command
> would submit EACH of the current contents, one by one.

To be clear:

C-RET applies the action function to the current candidate as an argument,
but it does not read another. It does not end completion, so you simply type
(or cycle to) another candidate - there is no read operation.

C-! already applies the action function to EACH of the candidates that
currently match the minibuffer contents, one by one. Is that what you meant?
In the case of `customize-face', that opens a separate Customize buffer for
each chosen face.

If you instead mean to apply some function to a list of ALL of the
candidates, then see my previous message. For that, you would use a function
(a multi-command, in fact) that lets the user choose a list of candidates
and returns that list, and then you would act on the list. In the case of a
command `customize-faces', it would use multicommand `icicle-face-list' to
query the user for the list of faces, and then it would call
`custom-buffer-create' on `custom-sort-items' of the list of faces - exactly
as does `customize-apropos' today.

For examples of commands that use a multicommand that returns a list of
candidates that the user has chosen, see these commands:
icicle-add-buffer-config, icicle-search, icicle-occur,
icicle-search-char-property, icicle-search-file, and icicle-search-keywords.
Each of these uses a function (a multi-command) that asks the user to pick a
list of candidates (of files, buffers, faces, keywords, etc.), and then it
does something with that list.

For example, `icicle-search-keywords' lets the user pick keywords (regexps,
actually), and then it searches for any combination of those keywords. That
is, it creates a choice regexp (\(...\|...\|...\)) from the keywords, and
then it searches for that. The function that queries the user for the list
of keywords is the multi-command `icicle-keyword-list', but the user does
not call this directly, here.

If you were proposing to add a binding during completion that would always
do this kind of thing, then, yes, that could be attempted (I've considered
it, but I haven't done it yet). However, the function invoked on that list
needs to be supplied somehow - it cannot be the same function as C-RET (that
is what C-! does already). In the case of customizing faces, for instance,
that function would need to do what `custom-apropos' does with the list.

The way I would do that is to have another variable, similar to
`icicle-candidate-action-fn' and `icicle-candidate-alternative-action-fn',
that could be bound by the command. I would call it
`icicle-all-candidates-action-fn'. It would perform the action to which it
is bound on the list of chosen candidates.

In the case of `customize-face', for instance, this would then be the

(defun icicle-customize-face (face)
  "Customize face FACE."
    (list (let ((icicle-candidate-action-fn 'customize-face)
                (icicle-all-candidates-action-fn 'customize-faces))
            (read-face-name "Customize face: "))))
  (customize-face face))

Where `customize-faces' would be defined something like this:

(defun customize-faces (faces)
  "Open Customize buffer on all faces in list FACES."
     (custom-sort-items faces t custom-buffer-order-groups)
     "*Customize Apropos*")))

Any way you look at it, I think you need to define the function that acts on
the list of chosen candidates. It cannot be defined automatically from the
`C-RET' action function - at least not in the general case.

reply via email to

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