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

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

RE: shell command completion gone


From: Drew Adams
Subject: RE: shell command completion gone
Date: Fri, 7 Jan 2011 08:14:32 -0800

> when i do M-!, type a few characters and then press tab it used to
> complete. suddenly it doesn't anymore. the only thing i can think of
> having done is that i reinstalled icicles from the site (not my arch
> distribution), but i don't see what that would have to do with it,
> because it doesn't use icicles afaik.
> 
> if i go into a shell, everything completes just fine.
> what does completion depend upon for the shell command?

Yes, it is because by default Icicles provides a different kind of completion
for shell commands.  Admittedly, this has confused more than one person.

You can customize option `icicle-redefine-standard-commands-flag' to `nil' to
restore the vanilla Emacs behavior here, if that's what you prefer.


For info about this completion:
http://www.emacswiki.org/emacs/Icicles_-_Shell-Command_Enhancements

There are 3 possible sources of completion candidates here:

1. Programs on your $PATH (if `icicle-guess-commands-in-path' is non-nil), as
proxy candidates.  (nil is the default value.)

2. Programs deemed appropriate for the target file types, as proxy candidates.
E.g., in Dired, `gunzip -qc * | tar xvf -' might be a candidate command for
target file `foo.tgz'.

3. Programs anywhere - file names.

To make #1 and #2 available, you must turn on proxy candidates (if off).  Use
`C-M-_' during completion to do that (once).  (You can customize option
`icicle-add-proxy-candidates-flag' to turn it on by default.)

Wrt #3: Icicles completion here is file-name completion, to let you complete
against command files anywhere, not just those on your $PATH.  It is this that
is particularly confusing at first (unexpected).

The idea is that not every program/command you might want to use is on your PATH
or preconfigured by a file-type association.  The former is especially true on
Windows, I think - PATH is not used as much on Windows, especially by users who
do not program on Windows (which means most Windows users).

For #2, there are in turn two sources of "appropriate" programs:

2a. Whatever `dired-guess-default' guesses for the target files.  This is
determined by variable `dired-guess-shell-alist-default' and user option
`dired-guess-shell-alist-user'.  This is available only if you load
`dired-x.el'.

2b. Whatever `mailcap-file-default-commands' returns for the target files (based
on MIME types of the target files).  This is only for Emacs 23 and later.

Note that #2 is true in Dired for `!' and outside Dired for `M-!' (provided you
load `dired-x.el').  These candidates are available whenever a shell command is
read in Icicles.

File-name completion is very different from command completion, so in order to
allow completion of arbitrary program files I opted for file-name completion and
then brought in proxy candidates for the known commands (those on $PATH and the
others mentioned above).

When you complete, the proxy candidates are sorted first, and they are
highlighted specially in *Completions* for easy recognition.

If `icicle-guess-commands-in-path' is nil (the default), then the only proxy
candidates are those from #2: programs that are known to be appropriate
candidates for the file type in question.  This takes effect in contexts such as
Dired where the files that are the targets of the command you will choose are
already known.  E.g., for a PDF file in Dired, `!' will include commands such as
`gv -safer', `xpdf', and `pdftotext ? -'.

Sorry for any confusion.  HTH.
  




reply via email to

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