emacs-devel
[Top][All Lists]
Advanced

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

RE: should `minibuffer-complete' use `abbreviate-file-name'?


From: Drew Adams
Subject: RE: should `minibuffer-complete' use `abbreviate-file-name'?
Date: Fri, 12 Oct 2007 13:34:05 -0700

> >> For file-name completion, apply `abbreviate-file-name' to the
> >> user's input. This would let a user take advantage of a customized
> >> `directory-abbrev-alist' during completion.
> >>
> >> Would there be any downside to that?
> >>
> >> I don't think Emacs should alter the names that the user enters.
>
> > `directory-abbrev-alist' is nil by default. Users customize it.
> > It lets them substitute their own abbreviations for directories.
>
> > Why shouldn't completion respect the user's preference for such
> > abbreviations (e.g. symlinks)?
>
> I must say I do not understand what you're asking for.  Can you spell out
> a concrete example?

`directory-abbrev-alist' substitutes matches of its regexps against
directory names with their corresponding directory-name "abbreviations".

The doc shows only examples where the resulting directory names are shorter,
but the reverse relation can be useful as well: expand instead of contract.
The point is to substitute one directory name for another that is more
convenient in some way. The symlink case is only one use case, IIUC.

Here is the original feature request I received, describing a use case. The
user requests that the cars of `directory-abbrev-alist' entries be completed
to the cdrs.

 I've been using Icicles about over 1 year (but still i'm
 a sort of newbie). recently, i found i can use
 'directory-abbrev-alist' not to type very long path that
 is hard to remember in 'find-file'. But I also found that
 Icicles' completion mechanism (including default Emacs' one)
 does not handle this abbrev consistently. for example, when
 i set my directory-abbrev-alist up like
   (("^/exe" . "/very-long-path-here/exe"))
 and, when i enter in minibuffer after 'find-file', "/exe",
 and TAB no expansion occurred. How can i utilize
 abbreviation to long path in Icicle ways?

IOW, `find-file /exe RET' correctly expands the abbreviation. But the same
is not true of `find-file /exe TAB'. The user requests that the latter
feature be added.

To implement this, i just call `abbreviate-file-name' on the user's current
file-name input. Then, in the example above, both `C-x C-f /exe TAB' and
`C-x C-f /whatever/you/might/have//exe TAB' complete to
`/very-long-path-here/exe'.

Seems useful to me. Again, does anyone see a downside to such behavior? The
abbreviation list is under user control (customization), so I don't see the
point of Richard's complaint that Emacs completion would then be altering
what the user entered. That's the whole point of completion, no?






reply via email to

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