[Top][All Lists]

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

RE: find certain files

From: Drew Adams
Subject: RE: find certain files
Date: Tue, 12 Jun 2007 15:51:15 -0700

> > Use Icicles apropos completion:
> >
> > C-x C-f \.sas$ S-TAB, if the current directory is /projects/a, or
> > C-x C-f /projects/a/.*\.sas$ S-TAB, otherwise.
> I tried this (I have icicles installed) and got the following traceback:
> Debugger entered--Lisp error: (error "Bad format environment-variable
> substitution")
>    read-file-name-internal(".*\\.el$" "~/site-lisp-22/" t)
>    all-completions(".*\\.el$" read-file-name-internal
> "~/site-lisp-22/" nil)
>    icicle-unsorted-file-name-prefix-candidates(".*\\.el$")
>    icicle-file-name-prefix-candidates("~/site-lisp-22/.*\\.el$")
>    icicle-prefix-complete-1()
>    icicle-prefix-complete()
>    icicle-call-then-update-Completions(self-insert-command 1)
>    icicle-self-insert(1)
>    call-interactively(icicle-self-insert)
>    old-read-file-name(#("+  File or directory: " 0 1 nil 1 2 (face
> icicle-completing-prompt-prefix) 2 3 nil 3 22 (face minibuffer-prompt))
> nil "~/" nil nil nil)
>    byte-code(<...> [icicle-prompt dir default-filename require-match
> initial-input predicate old-read-file-name] 7)] 2)
>    read-file-name("File or directory: " nil "~/" nil nil nil)
>    byte-code(<...> [emacs-major-version major-mode default-directory
> icicle-find-file-w-wildcards 21 read-file-name "File or directory: " nil
> dired-mode fboundp diredp-find-a-file (byte-code <...>
> [abbreviate-file-name dired-get-file-for-visit] 2) ((error
> default-directory))] 8)
>    icicle-find-file()
>    call-interactively(icicle-find-file)
> This was while trying to open a number of files in a subdirectory.
> I did C-x C-f /site-lisp-22/.*\.el$
> and, before I got the chance to try the S-tab I got the above traceback.
> It seems to work OK with files in the current directory, though.
> This is NT Emacs with icicles Version 22.

Hi Mark,

The backtrace suggests that you did something like this:

C-x C-f /site-lisp-22/.*\.el$ TAB 1

Try that, and you will get exactly the same error message.

The backtrace suggests that you hit TAB, which is for prefix completion, not
apropos (aka regexp) completion, and then you hit `1' as a response to the
file-name prompt. I can tell this from the call to `icicle-prefix-complete',
not `icicle-apropos-complete', and the call to `icicle-self-insert' for the
character `1' as your response to the prompt from `read-file-name'.

It is not Icicles command `icicle-find-file' (`C-x C-f') that is complaining
here; it is vanilla Emacs `find-file' (called `old-find-file' in the trace).
It complains because it was passed the raw input pattern that you typed, and
it tries to interpret the `$' in that input as part of an environment
variable name (as in, e.g., `$HOME').

TAB in Icicles is the same as it is in vanilla Emacs: it performs only
prefix completion, not regexp completion. It simply passes your input to
vanilla Emacs `find-file'. For Icicles to interpret your input as a regular
expression to match a file name, you must use S-TAB, not TAB.

If you feel I'm wrong that you used TAB here, then let's take this off list
to discuss the problem in more detail.

You might also want to take a look at this page, which explains the
interaction between file-name globbing and Icicles regexp matching:

The main lesson on that page is that file-name globbing (*, ?, $, ., ..) and
completion are independent. This is true in both vanilla Emacs and in
Icicles. For example, in vanilla Emacs, if you use `ici*’ or `ici*.el’ as
input to ‘find-file’ and hit ‘TAB’, there is no completion available. In
Icicles you can use regexp matching for completion, and you can use
file-name globbing for the final input you choose.

Even though they are completely different syntaxes that interpret some of
the same special characters differently, you can combine the two in Icicles,
within some limits. For example, `$' is not a problem, because Icicles
figures out what you want. But if you want to use `*' for file-name
globbing, then you need to forego regexp matching, and vice versa.

So, for example, `C-x C-f *.el RET' and `C-x C-f .*\.el$ S-TAB' both work,
but they do entirely different things. The former opens all Emacs-Lisp
files; the latter proposes those files as completion candidates. And in
Icicles, as in vanilla Emacs, `C-x C-f *.el TAB' will not work - you get the
message "No prefix completion", because completion does not do file-name

Let me know if I'm mistaken about the problem you reported. Thanks for
trying Icicles and for providing this feedback - I'm sure it will help
others too. - Drew

reply via email to

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