all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* A quick way of opening any file with given extension within a directory hierarchy?
@ 2007-06-05 16:39 Enselic
  2007-06-05 17:22 ` A quick way of opening any file with given extension within adirectory hierarchy? Drew Adams
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Enselic @ 2007-06-05 16:39 UTC (permalink / raw)
  To: help-gnu-emacs

Hello

I am wondering if this functionality has been written by someone.

1. I call func-i-look-for.

2. The mini buffer switches to "What file do you want?: "

3. When I start typing, there is a buffer that shows all files within
a given directory hierarchy whose filenames start with what I have
written.

4. I can cycle between available completions with C-n C-p (without
messing up what I have written in the minibuffer) and <return> takes
me to chosen buffer.

Let's clarify with an example. I have the following source tree:

root/file.cpp
root/gtk/gtk.cpp
root/msw/file2.cpp

And call (after requred setup is made) func-i-look-for, then type "fi"

I would now have file.cpp and file2.cpp listed in the buffer, and C-n
<return> would get me to file2.cpp.

Does anyone know if there is elisp code that does this somewhere?

Thank you,
- Martin Nordholts

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: A quick way of opening any file with given extension within adirectory hierarchy?
  2007-06-05 16:39 A quick way of opening any file with given extension within a directory hierarchy? Enselic
@ 2007-06-05 17:22 ` Drew Adams
       [not found] ` <mailman.1584.1181064234.32220.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Drew Adams @ 2007-06-05 17:22 UTC (permalink / raw)
  To: Enselic, help-gnu-emacs

> I am wondering if this functionality has been written by someone.
> 1. I call func-i-look-for.
> 2. The mini buffer switches to "What file do you want?: "
> 3. When I start typing, there is a buffer that shows all files within
>    a given directory hierarchy whose filenames start with what I have
>    written.
> 4. I can cycle between available completions with C-n C-p (without
>    messing up what I have written in the minibuffer) and <return> takes
>    me to chosen buffer.
>
> Let's clarify with an example. I have the following source tree:
>
> root/file.cpp
> root/gtk/gtk.cpp
> root/msw/file2.cpp
>
> And call (after requred setup is made) func-i-look-for, then type "fi"
> I would now have file.cpp and file2.cpp listed in the buffer, and C-n
> <return> would get me to file2.cpp.
> Does anyone know if there is elisp code that does this somewhere?

Icicles does what you want. Specifically, command `icicle-locate-file'.

Your input matches any part of the complete file name, however, including
the directory part, so if you didn't want that, you would either:

1) Type a regexp such as "/fi" (or, to be rigorous, "/fi[^/]*$", because
that prohibits matches against subdirectory names that start with "fi")

or

2) Define your own command, based on `icicle-locate-file', which would take
care of that.

http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_File-Name_Input

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A quick way of opening any file with given extension within adirectory hierarchy?
       [not found] ` <mailman.1584.1181064234.32220.help-gnu-emacs@gnu.org>
@ 2007-06-05 19:14   ` Peter Tury
  2007-06-05 20:07     ` Eli Zaretskii
                       ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Peter Tury @ 2007-06-05 19:14 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 416 bytes --]


Drew Adams írta:

> Icicles does what you want. Specifically, command `icicle-locate-file'.

Does it use Emacs' locate? Does it work e.g. on MS Windows also? I
recently tried locate (and ~dired-find-...) but none of them worked:
they missed some external programs (locate & find).

I used a not-latest EmacsW32. Maybe newer versions (of patched
EmacsW32' install) contains these (from MinGW)?

\bye
P

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A quick way of opening any file with given extension within adirectory hierarchy?
  2007-06-05 19:14   ` Peter Tury
@ 2007-06-05 20:07     ` Eli Zaretskii
  2007-06-05 20:30     ` Lennart Borgman (gmail)
  2007-06-05 20:43     ` A quick way of opening any file with given extension withinadirectory hierarchy? Drew Adams
  2 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2007-06-05 20:07 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Peter Tury <tury.peter@gmail.com>
> Date: Tue, 05 Jun 2007 19:14:00 -0000
> 
> Does it use Emacs' locate? Does it work e.g. on MS Windows also? I
> recently tried locate (and ~dired-find-...) but none of them worked:
> they missed some external programs (locate & find).

At least for `find', you can use find-lisp.el, which emulates `find'
in Emacs Lisp.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A quick way of opening any file with given extension within adirectory hierarchy?
  2007-06-05 19:14   ` Peter Tury
  2007-06-05 20:07     ` Eli Zaretskii
@ 2007-06-05 20:30     ` Lennart Borgman (gmail)
  2007-06-05 20:43     ` A quick way of opening any file with given extension withinadirectory hierarchy? Drew Adams
  2 siblings, 0 replies; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2007-06-05 20:30 UTC (permalink / raw)
  To: Peter Tury; +Cc: help-gnu-emacs

Peter Tury wrote:
> Drew Adams írta:
> 
>> Icicles does what you want. Specifically, command `icicle-locate-file'.
> 
> Does it use Emacs' locate? Does it work e.g. on MS Windows also? I
> recently tried locate (and ~dired-find-...) but none of them worked:
> they missed some external programs (locate & find).
> 
> I used a not-latest EmacsW32. Maybe newer versions (of patched
> EmacsW32' install) contains these (from MinGW)?


Yes, the installer for EmacsW32 or Emacs+EmacsW32 contains these 
programs. (But they are from gnuwin32.)

Can you look in EmacsW32/gnuwin32/bin to see if they are there? Maybe 
there is some setting that should be preconfigured in EmacsW32.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: A quick way of opening any file with given extension withinadirectory hierarchy?
  2007-06-05 19:14   ` Peter Tury
  2007-06-05 20:07     ` Eli Zaretskii
  2007-06-05 20:30     ` Lennart Borgman (gmail)
@ 2007-06-05 20:43     ` Drew Adams
  2 siblings, 0 replies; 11+ messages in thread
From: Drew Adams @ 2007-06-05 20:43 UTC (permalink / raw)
  To: Peter Tury, help-gnu-emacs

> > Icicles does what you want. Specifically, command `icicle-locate-file'.
>
> Does it use Emacs' locate? Does it work e.g. on MS Windows also? I
> recently tried locate (and ~dired-find-...) but none of them worked:
> they missed some external programs (locate & find).

No, it does not. It matches absolute file names, on the fly. You do not need
an OS `locate' program to use it - you can use it on any platform and you
need not update a database of locations. See the doc:
http://www.emacswiki.org/cgi-bin/wiki/LocateFilesAnywhere.

An Icicles user did write an Emacs command that takes advantage of the OS
`locate' command, if you have such a command and prefer it:
http://www.emacswiki.org/cgi-bin/wiki/IciclesUserDefinedCommands.

> I used a not-latest EmacsW32. Maybe newer versions (of patched
> EmacsW32' install) contains these (from MinGW)?

Emacs 22 contains a `locate' command, which is a wrapper for the GNU/Linux
or UNIX `locate' command. I haven't used it.

BTW, besides Icicles and the Emacs `locate' command, there are other ways to
do what was requested - see
http://www.emacswiki.org/cgi-bin/wiki/LocateFilesAnywhere.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A quick way of opening any file with given extension within a directory hierarchy?
  2007-06-05 16:39 A quick way of opening any file with given extension within a directory hierarchy? Enselic
  2007-06-05 17:22 ` A quick way of opening any file with given extension within adirectory hierarchy? Drew Adams
       [not found] ` <mailman.1584.1181064234.32220.help-gnu-emacs@gnu.org>
@ 2007-06-05 21:00 ` Kim F. Storm
  2007-06-05 21:17   ` Dieter Wilhelm
  2007-06-14 18:31 ` Enselic
  3 siblings, 1 reply; 11+ messages in thread
From: Kim F. Storm @ 2007-06-05 21:00 UTC (permalink / raw)
  To: Enselic; +Cc: help-gnu-emacs

Enselic <enselic@gmail.com> writes:

> Let's clarify with an example. I have the following source tree:
>
> root/file.cpp
> root/gtk/gtk.cpp
> root/msw/file2.cpp
>
> And call (after requred setup is made) func-i-look-for, then type "fi"
>
> I would now have file.cpp and file2.cpp listed in the buffer, and C-n
> <return> would get me to file2.cpp.
>
> Does anyone know if there is elisp code that does this somewhere?

Try ido mode.

Not exactly the interface you asked for, but you can do (in root/):

    C-x C-f M-f fi RET

and then select the file you want with <- and ->  (or C-s / C-r)  RET

-- 
Kim F. Storm  http://www.cua.dk

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A quick way of opening any file with given extension within a directory hierarchy?
  2007-06-05 21:00 ` A quick way of opening any file with given extension within a directory hierarchy? Kim F. Storm
@ 2007-06-05 21:17   ` Dieter Wilhelm
  2007-06-06  8:20     ` Kim F. Storm
  0 siblings, 1 reply; 11+ messages in thread
From: Dieter Wilhelm @ 2007-06-05 21:17 UTC (permalink / raw)
  To: Kim F. Storm; +Cc: help-gnu-emacs, Enselic

no-spam@cua.dk (Kim F. Storm) writes:

> Enselic <enselic@gmail.com> writes:
>
>> Let's clarify with an example. I have the following source tree:
>>
>> root/file.cpp
>> root/gtk/gtk.cpp
>> root/msw/file2.cpp
>>
>> And call (after requred setup is made) func-i-look-for, then type "fi"
>>
>> I would now have file.cpp and file2.cpp listed in the buffer, and C-n
>> <return> would get me to file2.cpp.
>>
>> Does anyone know if there is elisp code that does this somewhere?
>
> Try ido mode.
>
> Not exactly the interface you asked for, but you can do (in root/):
>
>     C-x C-f M-f fi RET
>
> and then select the file you want with <- and ->  (or C-s / C-r)  RET

I also wanted to suggest your ido-mode but Enselic wants to get the
relevant files from a whole directory hierarchy (please have a look
above) and not only from the *current* directory.

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A quick way of opening any file with given extension within a directory hierarchy?
  2007-06-05 21:17   ` Dieter Wilhelm
@ 2007-06-06  8:20     ` Kim F. Storm
  2007-06-07  1:40       ` Dieter Wilhelm
  0 siblings, 1 reply; 11+ messages in thread
From: Kim F. Storm @ 2007-06-06  8:20 UTC (permalink / raw)
  To: Dieter Wilhelm; +Cc: help-gnu-emacs, Enselic

Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:

>>     C-x C-f M-f fi RET
               ^^^  
>
> I also wanted to suggest your ido-mode but Enselic wants to get the
> relevant files from a whole directory hierarchy (please have a look
> above) and not only from the *current* directory.

M-f starts a wide search.

-- 
Kim F. Storm  http://www.cua.dk

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A quick way of opening any file with given extension within a directory hierarchy?
  2007-06-06  8:20     ` Kim F. Storm
@ 2007-06-07  1:40       ` Dieter Wilhelm
  0 siblings, 0 replies; 11+ messages in thread
From: Dieter Wilhelm @ 2007-06-07  1:40 UTC (permalink / raw)
  To: Kim F. Storm; +Cc: help-gnu-emacs, Enselic

no-spam@cua.dk (Kim F. Storm) writes:

> Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
>
>>>     C-x C-f M-f fi RET
>                ^^^  
>>
>> I also wanted to suggest your ido-mode but Enselic wants to get the
>> relevant files from a whole directory hierarchy (please have a look
>> above) and not only from the *current* directory.
>
> M-f starts a wide search.

Well, it seems the oversight is on my side 8-\, thanks a lot for
pointing this out, ido-mode is even better than I thought!

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A quick way of opening any file with given extension within a directory hierarchy?
  2007-06-05 16:39 A quick way of opening any file with given extension within a directory hierarchy? Enselic
                   ` (2 preceding siblings ...)
  2007-06-05 21:00 ` A quick way of opening any file with given extension within a directory hierarchy? Kim F. Storm
@ 2007-06-14 18:31 ` Enselic
  3 siblings, 0 replies; 11+ messages in thread
From: Enselic @ 2007-06-14 18:31 UTC (permalink / raw)
  To: help-gnu-emacs

On 5 Juni, 18:39, Enselic <ense...@gmail.com> wrote:
> Hello
>
> I am wondering if this functionality has been written by someone.
>
> 1. I call func-i-look-for.
>
> 2. The mini buffer switches to "What file do you want?: "
>
> 3. When I start typing, there is a buffer that shows all files within
> a given directory hierarchy whose filenames start with what I have
> written.
>
> 4. I can cycle between available completions with C-n C-p (without
> messing up what I have written in the minibuffer) and <return> takes
> me to chosen buffer.
>
> Let's clarify with an example. I have the following source tree:
>
> root/file.cpp
> root/gtk/gtk.cpp
> root/msw/file2.cpp
>
> And call (after requred setup is made) func-i-look-for, then type "fi"
>
> I would now have file.cpp and file2.cpp listed in the buffer, and C-n
> <return> would get me to file2.cpp.
>
> Does anyone know if there is elisp code that does this somewhere?
>
> Thank you,
> - MartinNordholts

It works pretty well to just find-file the files needed, then use
excellent buffer selection facility that ido-mode provides.

Thanks for all replies

- Martin

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-06-14 18:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-05 16:39 A quick way of opening any file with given extension within a directory hierarchy? Enselic
2007-06-05 17:22 ` A quick way of opening any file with given extension within adirectory hierarchy? Drew Adams
     [not found] ` <mailman.1584.1181064234.32220.help-gnu-emacs@gnu.org>
2007-06-05 19:14   ` Peter Tury
2007-06-05 20:07     ` Eli Zaretskii
2007-06-05 20:30     ` Lennart Borgman (gmail)
2007-06-05 20:43     ` A quick way of opening any file with given extension withinadirectory hierarchy? Drew Adams
2007-06-05 21:00 ` A quick way of opening any file with given extension within a directory hierarchy? Kim F. Storm
2007-06-05 21:17   ` Dieter Wilhelm
2007-06-06  8:20     ` Kim F. Storm
2007-06-07  1:40       ` Dieter Wilhelm
2007-06-14 18:31 ` Enselic

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.