all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "Mark Elston" <m.elston@advantest-ard.com>, <help-gnu-emacs@gnu.org>
Subject: RE: find certain files
Date: Tue, 12 Jun 2007 15:51:15 -0700	[thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICMEGJDNAA.drew.adams@oracle.com> (raw)
In-Reply-To: <136u2klbdc2ssd0@corp.supernews.com>

> > 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 22.0.50.1 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:
http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Special_Characters_in_Input_
Patterns.

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
globbing.

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	other threads:[~2007-06-12 22:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2048.1181678085.32220.help-gnu-emacs@gnu.org>
2007-06-12 21:05 ` find certain files Mark Elston
2007-06-12 22:51   ` Drew Adams [this message]
     [not found] <mailman.2060.1181681757.32220.help-gnu-emacs@gnu.org>
2007-06-25  8:39 ` Mathias Dahl
2007-06-12 18:19 econfreerider
2007-06-12 19:54 ` Drew Adams
2007-06-12 20:37   ` econfreerider
2007-06-12 20:54     ` Drew Adams
2007-06-12 19:57 ` Eli Zaretskii
2007-06-12 20:24   ` econfreerider
     [not found]   ` <mailman.2056.1181679859.32220.help-gnu-emacs@gnu.org>
2007-06-12 20:38     ` Stefan Monnier
2007-06-12 20:02 ` Dieter Wilhelm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DNEMKBNJBGPAOPIJOOICMEGJDNAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=m.elston@advantest-ard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.