unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* finding files not visited
@ 2011-09-14 11:10 Andrea Crotti
  2011-09-14 11:41 ` Filipp Gunbin
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Andrea Crotti @ 2011-09-14 11:10 UTC (permalink / raw)
  To: GNU Emacs List

I'm working on a code-base (python) which is very nested, in a Java-like
style, and there are really thousands of files.

I would like to access easily to files even if they are not visited yet.

My idea is that if I am on path X on disk pressing C-x C-f would show me
first the current files, then writing something which is not found could
look for (with find for example) in the subdirectories to find the file
that I wanted.

Is it possible to achieve something like this?

Thanks,
Andrea



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

* Re: finding files not visited
  2011-09-14 11:10 finding files not visited Andrea Crotti
@ 2011-09-14 11:41 ` Filipp Gunbin
  2011-09-21  8:45   ` Andrea Crotti
  2011-09-14 13:07 ` Peter Münster
  2011-09-14 15:27 ` suvayu ali
  2 siblings, 1 reply; 12+ messages in thread
From: Filipp Gunbin @ 2011-09-14 11:41 UTC (permalink / raw)
  To: help-gnu-emacs

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> I'm working on a code-base (python) which is very nested, in a Java-like
> style, and there are really thousands of files.
>
> I would like to access easily to files even if they are not visited yet.
>
> My idea is that if I am on path X on disk pressing C-x C-f would show me
> first the current files, then writing something which is not found could
> look for (with find for example) in the subdirectories to find the file
> that I wanted.
>
> Is it possible to achieve something like this?
>
> Thanks,
> Andrea

I didn't understand what is your idea/suggestion, but I work with large
amount of Java files this way:

1. Open a dired buffer for each project (Maven module in my case)
2. Set dired switches (C-u s) to contain -R so it outputs all files
recursively
3. Use file name incremental search (C-s) to find what I want. I also
have (setq dired-isearch-filenames t) in .emacs for it to be more
convenient.

Filipp




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

* Re: finding files not visited
  2011-09-14 11:10 finding files not visited Andrea Crotti
  2011-09-14 11:41 ` Filipp Gunbin
@ 2011-09-14 13:07 ` Peter Münster
  2011-09-14 15:27 ` suvayu ali
  2 siblings, 0 replies; 12+ messages in thread
From: Peter Münster @ 2011-09-14 13:07 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, Sep 14 2011, Andrea Crotti wrote:

> I would like to access easily to files even if they are not visited yet.

Perhaps anything can help: http://www.emacswiki.org/emacs/Anything

-- 
           Peter




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

* Re: finding files not visited
  2011-09-14 11:10 finding files not visited Andrea Crotti
  2011-09-14 11:41 ` Filipp Gunbin
  2011-09-14 13:07 ` Peter Münster
@ 2011-09-14 15:27 ` suvayu ali
  2011-09-14 16:34   ` Andrea Crotti
  2 siblings, 1 reply; 12+ messages in thread
From: suvayu ali @ 2011-09-14 15:27 UTC (permalink / raw)
  To: Andrea Crotti; +Cc: GNU Emacs List

Hi Andrea,

On Wed, Sep 14, 2011 at 1:10 PM, Andrea Crotti
<andrea.crotti.0@gmail.com> wrote:
> I'm working on a code-base (python) which is very nested, in a Java-like
> style, and there are really thousands of files.
>
> I would like to access easily to files even if they are not visited yet.
>
> My idea is that if I am on path X on disk pressing C-x C-f would show me
> first the current files, then writing something which is not found could
> look for (with find for example) in the subdirectories to find the file
> that I wanted.
>
> Is it possible to achieve something like this?

Try ido-mode for files. But a word of caution, if any of the
directories have too many (~100s) files or sub-directories and are
remote (as in you are remote editing with tramp) emacs might become
extremely slow trying to find completions.

>
> Thanks,
> Andrea
>

HTH

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: finding files not visited
  2011-09-14 15:27 ` suvayu ali
@ 2011-09-14 16:34   ` Andrea Crotti
  2011-09-14 20:50     ` Jeffrey Spencer
  2011-09-15 14:45     ` Richard Riley
  0 siblings, 2 replies; 12+ messages in thread
From: Andrea Crotti @ 2011-09-14 16:34 UTC (permalink / raw)
  To: GNU Emacs List

On 09/14/2011 04:27 PM, suvayu ali wrote:
> Try ido-mode for files. But a word of caution, if any of the
> directories have too many (~100s) files or sub-directories and are
> remote (as in you are remote editing with tramp) emacs might become
> extremely slow trying to find completions.

I already use ido-mode, but it doesn't recurse in the subdirectories (at 
least not by default).

I don't see any variable to customize for that, am I blind?

I like the dired solution, and for example I can set up some 
dir-local-variable setting the right switches, for example it's a good 
idea to filter hidden directories (like .git or .bzr).

I'll give finally a try also to anything



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

* Re: finding files not visited
  2011-09-14 16:34   ` Andrea Crotti
@ 2011-09-14 20:50     ` Jeffrey Spencer
  2011-09-14 22:15       ` Suvayu Ali
  2011-09-15 14:45     ` Richard Riley
  1 sibling, 1 reply; 12+ messages in thread
From: Jeffrey Spencer @ 2011-09-14 20:50 UTC (permalink / raw)
  To: Andrea Crotti; +Cc: GNU Emacs List

I use ido-mode also and was wondering how to do this. It seems to not 
search through sub-directories. Is it redefining a function or is it 
already implemented and just needs enabled.

Cheers

On 15/09/11 02:34, Andrea Crotti wrote:
> On 09/14/2011 04:27 PM, suvayu ali wrote:
>> Try ido-mode for files. But a word of caution, if any of the
>> directories have too many (~100s) files or sub-directories and are
>> remote (as in you are remote editing with tramp) emacs might become
>> extremely slow trying to find completions.
>
> I already use ido-mode, but it doesn't recurse in the subdirectories 
> (at least not by default).
>
> I don't see any variable to customize for that, am I blind?
>
> I like the dired solution, and for example I can set up some 
> dir-local-variable setting the right switches, for example it's a good 
> idea to filter hidden directories (like .git or .bzr).
>
> I'll give finally a try also to anything
>



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

* Re: finding files not visited
  2011-09-14 20:50     ` Jeffrey Spencer
@ 2011-09-14 22:15       ` Suvayu Ali
  0 siblings, 0 replies; 12+ messages in thread
From: Suvayu Ali @ 2011-09-14 22:15 UTC (permalink / raw)
  To: Jeffrey Spencer; +Cc: GNU Emacs List

Hi Andrea and Jeffrey,

On Thu, 15 Sep 2011 06:50:04 +1000
Jeffrey Spencer <jeffspencerd@gmail.com> wrote:

> On 15/09/11 02:34, Andrea Crotti wrote:
> > On 09/14/2011 04:27 PM, suvayu ali wrote:
> >> Try ido-mode for files. But a word of caution, if any of the
> >> directories have too many (~100s) files or sub-directories and are
> >> remote (as in you are remote editing with tramp) emacs might become
> >> extremely slow trying to find completions.
> >
> > I already use ido-mode, but it doesn't recurse in the
> > subdirectories (at least not by default).
> >
> > I don't see any variable to customize for that, am I blind?
> >
> > I like the dired solution, and for example I can set up some 
> > dir-local-variable setting the right switches, for example it's a
> > good idea to filter hidden directories (like .git or .bzr).
> >
> > I'll give finally a try also to anything
> >
> 
> I use ido-mode also and was wondering how to do this. It seems to not 
> search through sub-directories. Is it redefining a function or is it 
> already implemented and just needs enabled.
> 

Sorry I wasn't explicit, ido-mode completes on the full path rather
than the filename. So if you have 4 files like these:

/path/dir/file1
/path/dir/file2
/path/dir/sub-dir1/file3
/path/dir/sub-dir2/file4

To complete for file3 and file4 you would need to type up to 's' of the
subdirectories sub-dir1 and sub-dir2. As you type up to sub-dir1, only
file3 will be offered as a completion candidate.

That said, I have a hunch you might be able to write some custom
function, to do that with uniquify and ido. However this is just a
conjecture, I haven't tried it.

From a quick search it seemed the following link might help too:
<http://www.emacswiki.org/emacs/InteractivelyDoThings#toc12>

> Cheers
> 

Hope this was helpful.

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: finding files not visited
  2011-09-14 16:34   ` Andrea Crotti
  2011-09-14 20:50     ` Jeffrey Spencer
@ 2011-09-15 14:45     ` Richard Riley
  2011-09-15 15:33       ` Jeffrey Spencer
  1 sibling, 1 reply; 12+ messages in thread
From: Richard Riley @ 2011-09-15 14:45 UTC (permalink / raw)
  To: help-gnu-emacs

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> On 09/14/2011 04:27 PM, suvayu ali wrote:
>> Try ido-mode for files. But a word of caution, if any of the
>> directories have too many (~100s) files or sub-directories and are
>> remote (as in you are remote editing with tramp) emacs might become
>> extremely slow trying to find completions.
>
> I already use ido-mode, but it doesn't recurse in the subdirectories (at least
> not by default).
>
> I don't see any variable to customize for that, am I blind?
>
> I like the dired solution, and for example I can set up some dir-local-variable
> setting the right switches, for example it's a good idea to filter hidden
> directories (like .git or .bzr).
>
> I'll give finally a try also to anything
>

I got this off planetemacsen I think it was. It triggers the "find"
manually.

;; disable auto searching for files unless called explicitly
   (setq ido-auto-merge-delay-time 99999)
   (define-key ido-file-dir-completion-map (kbd "C-c C-s") 
      (lambda() 
        (interactive)
        (ido-initiate-auto-merge (current-buffer)))) 

regards

r.




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

* Re: finding files not visited
  2011-09-15 14:45     ` Richard Riley
@ 2011-09-15 15:33       ` Jeffrey Spencer
  0 siblings, 0 replies; 12+ messages in thread
From: Jeffrey Spencer @ 2011-09-15 15:33 UTC (permalink / raw)
  To: help-gnu-emacs

Andrea,

King of confused on what this does. Basically ido acts as normal but 
when you call the function below it sets it to use the find command to 
recurse through subdirectories. Mine is set to 0.7 which means it should 
be activated anyway but doesn't seem to work like that. It seems to only 
recurse up through the directory structure if it isn't found from what I 
am seeing.

Also when I try adding that I get an error saying the completion map is 
void. Is this something you set up a key mapping for in your .emacs.

Cheers,
Jeff

On 16/09/11 00:45, Richard Riley wrote:
> Andrea Crotti<andrea.crotti.0@gmail.com>  writes:
>
>> On 09/14/2011 04:27 PM, suvayu ali wrote:
>>> Try ido-mode for files. But a word of caution, if any of the
>>> directories have too many (~100s) files or sub-directories and are
>>> remote (as in you are remote editing with tramp) emacs might become
>>> extremely slow trying to find completions.
>> I already use ido-mode, but it doesn't recurse in the subdirectories (at least
>> not by default).
>>
>> I don't see any variable to customize for that, am I blind?
>>
>> I like the dired solution, and for example I can set up some dir-local-variable
>> setting the right switches, for example it's a good idea to filter hidden
>> directories (like .git or .bzr).
>>
>> I'll give finally a try also to anything
>>
> I got this off planetemacsen I think it was. It triggers the "find"
> manually.
>
> ;; disable auto searching for files unless called explicitly
>     (setq ido-auto-merge-delay-time 99999)
>     (define-key ido-file-dir-completion-map (kbd "C-c C-s")
>        (lambda()
>          (interactive)
>          (ido-initiate-auto-merge (current-buffer))))
>
> regards
>
> r.
>
>



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

* Re: finding files not visited
  2011-09-14 11:41 ` Filipp Gunbin
@ 2011-09-21  8:45   ` Andrea Crotti
  2011-09-21 10:20     ` Filipp Gunbin
  2011-09-21 10:53     ` XeCycle
  0 siblings, 2 replies; 12+ messages in thread
From: Andrea Crotti @ 2011-09-21  8:45 UTC (permalink / raw)
  To: GNU Emacs List; +Cc: Filipp Gunbin

On 09/14/2011 12:41 PM, Filipp Gunbin wrote:
> I didn't understand what is your idea/suggestion, but I work with 
> large amount of Java files this way: 1. Open a dired buffer for each 
> project (Maven module in my case) 2. Set dired switches (C-u s) to 
> contain -R so it outputs all files recursively 3. Use file name 
> incremental search (C-s) to find what I want. I also have (setq 
> dired-isearch-filenames t) in .emacs for it to be more convenient. Filipp 

I'm happily using this solution actually :)

The only problem is that I would like to enable it globally, but only 
when the actual number of subdirectories is not huge, otherwise it takes 
forever...

I can't find, however, a variable to set up to give a limit of maximum 
sub-directories to open...
Or how can I achieve that?



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

* Re: finding files not visited
  2011-09-21  8:45   ` Andrea Crotti
@ 2011-09-21 10:20     ` Filipp Gunbin
  2011-09-21 10:53     ` XeCycle
  1 sibling, 0 replies; 12+ messages in thread
From: Filipp Gunbin @ 2011-09-21 10:20 UTC (permalink / raw)
  To: Andrea Crotti; +Cc: GNU Emacs List

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> On 09/14/2011 12:41 PM, Filipp Gunbin wrote:
>> I didn't understand what is your idea/suggestion, but I work with
>> large amount of Java files this way: 1. Open a dired buffer for each
>> project (Maven module in my case) 2. Set dired switches (C-u s) to
>> contain -R so it outputs all files recursively 3. Use file name
>> incremental search (C-s) to find what I want. I also have (setq
>> dired-isearch-filenames t) in .emacs for it to be more
>> convenient. Filipp 
>
> I'm happily using this solution actually :)

I'm glad it's OK for you.

>
> The only problem is that I would like to enable it globally, but only
> when the actual number of subdirectories is not huge, otherwise it
> takes forever...

For me, setting "-I .svn -I .git" etc. usually leaves not much of them.

Is it really a problem considering that each directory needs to be
opened only once in a single Emacs session (and particular subdirs can
be rescanned individually by "l" in Dired)?

>
> I can't find, however, a variable to set up to give a limit of maximum
> sub-directories to open...
> Or how can I achieve that?

If you do this then you won't know for sure that a given file exists or
doesn't exist in a particular directory tree when you use C-s, so I
think it's a bad idea.

Filipp



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

* Re: finding files not visited
  2011-09-21  8:45   ` Andrea Crotti
  2011-09-21 10:20     ` Filipp Gunbin
@ 2011-09-21 10:53     ` XeCycle
  1 sibling, 0 replies; 12+ messages in thread
From: XeCycle @ 2011-09-21 10:53 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> On 09/14/2011 12:41 PM, Filipp Gunbin wrote:
>> I didn't understand what is your idea/suggestion, but I work
>> with large amount of Java files this way: 1. Open a dired
>> buffer for each project (Maven module in my case) 2. Set dired
>> switches (C-u s) to contain -R so it outputs all files
>> recursively 3. Use file name incremental search (C-s) to find
>> what I want. I also have (setq dired-isearch-filenames t) in
>> .emacs for it to be more convenient. Filipp 
>
> I'm happily using this solution actually :)
>
> The only problem is that I would like to enable it globally, but
> only when the actual number of subdirectories is not huge,
> otherwise it takes forever...
>
> I can't find, however, a variable to set up to give a limit of
> maximum sub-directories to open...
> Or how can I achieve that?

Indeed I think it would bother you more if you enabled it globally.  It
may seem better to bind a key to include `-R' in the ls switches, if you
find adding it manually painful.

Perhaps you can write your own function to toggle the existence of `-R'
in `dired-ls-switches', and if it don't work immediately, try
`revert-buffer'.

-- 
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

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

end of thread, other threads:[~2011-09-21 10:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-14 11:10 finding files not visited Andrea Crotti
2011-09-14 11:41 ` Filipp Gunbin
2011-09-21  8:45   ` Andrea Crotti
2011-09-21 10:20     ` Filipp Gunbin
2011-09-21 10:53     ` XeCycle
2011-09-14 13:07 ` Peter Münster
2011-09-14 15:27 ` suvayu ali
2011-09-14 16:34   ` Andrea Crotti
2011-09-14 20:50     ` Jeffrey Spencer
2011-09-14 22:15       ` Suvayu Ali
2011-09-15 14:45     ` Richard Riley
2011-09-15 15:33       ` Jeffrey Spencer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).