[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: Thu, 21 Jun 2007 13:42:36 -0700

> > In the vanilla Emacs `customize-apropos-faces', you must
> > provide a regexp once and for all, with RET - there is no
> > completion of face names available,
> > and no way to rectify your regexp without starting over.
> >
> > This is a good example of the general advantage of regexp
> > matching on the fly, and the advantage of providing input
> > by completion whenever possible.
> I'm not arguing against the end-result here (an interactive guide to the
> effects of your entered regexp), but it strikes me as intensely confusing
> to use the standard completing read mechanism (or a variant of it) to read
> one thing (a regexp) while providing "completion" on another (face names).
> As a silly example, suppose a face name contained the character $: then
> selecting it from *Completions* (because you realized you wanted just that
> one) would have entirely the wrong effect.
> In general, then, this process probably deserves another name than
> "completing-read".  It's related to re-builder, in that it is interactive
> "explanation" of a regexp; perhaps it could be called "building-read" or
> so?

At least one of us is likely confused about what the other means ;-).

What I was talking about has nothing to do with re-builder. No connection.
This is also not about "an interactive guide to the effects of your entered
regexp". In Icicles, you do not enter a regexp (with RET) at all. You type
some input and then complete it. One of the completion possibilities is to
use regexp matching instead of prefix matching. So, if your input is
`foo.*bar' and you ask for regexp matching, then you can match candidates
such as titifoobar, foo$titibar, and titifoo&*!(address@hidden

If a face name contains `$', then selecting that name from *Completions*
just selects it - nothing new here. I don't understand what you mean by
"would have entirely the wrong effect". The effect is that you get the
candidate you select, always. The only thing new is how what you type is
matched against the domain of possible candidates.

In Icicles, whether you want what you type in the minibuffer to be
considered as (1) a prefix, to be matched using prefix matching (as in
vanilla Emacs), or as (2) a regexp, to be matched using regexp matching, is
under your control as a user. If you want the former, you hit TAB; if you
want the latter, you hit S-TAB.

If you do want regexp matching (which of course includes substring
matching), then, yes, `$' acts as a regexp special character for matching,
naturally. This means that if you want to match a `$' character literally,
then you type `\$' instead of `$' if you want regexp matching.

In addition, you can, at any time during minibuffer input completion, toggle
treatment of regexp special characters (i.e. as special) by hitting `C-`'.
This toggles the behavior of S-TAB, in effect, between regexp matching and
substring matching.

Summary: If you want to match a `$' character, do one of the following:

- Use prefix matching (TAB), not regexp matching (S-TAB).

- Type a regexp that matches a `$' character, and use S-TAB. Both `.' and
`\$', for instance, match a `$' character.

- Turn on automatic quoting of special characters in regexp matching, using
`C-`'. This makes S-TAB perform substring matching, not regexp matching.

[Also, as I mentioned in an earlier exchange in this thread, Icicles treats
`$' a little specially. If it is not in a position where it makes sense as
an end-of-line match, then it is available for environment-variable
substitution. See
Patterns for an explanation how globbing and regexp matching cohabit
peacefully in Icicles.]

reply via email to

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