unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Allow prefix arg for ido-find-*file* (maybe)
@ 2004-09-14 17:07 Sean O'Rourke
  0 siblings, 0 replies; 5+ messages in thread
From: Sean O'Rourke @ 2004-09-14 17:07 UTC (permalink / raw)


ido mode is currently unusably slow when finding a file in a large
directory.  For example, in a directory with ~3000 files,
`ido-find-file' takes several seconds to come up with a prompt.  When
you know you're in such a directory, it would be nice to bypass ido
entirely and fall back to the original `find-file'.  Since the ido
functions currently don't use a prefix argument, I think that when
called with a prefix argument, the ido functions should fall back to
their non-ido equivalents.

/s

ps -- here's a defadvice to get the effect I want:

    (defadvice ido-find-file (around allow-prefix compile activate)
      (if current-prefix-arg
          (let ((read-file-name-function nil))
            (call-interactively 'find-file))
          ad-do-it))
    
    (defadvice ido-find-file-other-window (around allow-prefix compile activate)
      (if current-prefix-arg
          (let ((read-file-name-function nil))
            (call-interactively 'find-file-other-window))
          ad-do-it))
    
    (defadvice ido-find-alternate-file (around allow-prefix compile activate)
      (if current-prefix-arg
          (let ((read-file-name-function nil))
            (call-interactively 'find-alternate-file))
          ad-do-it))

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

* Re: Allow prefix arg for ido-find-*file* (maybe)
       [not found] <mailman.2739.1095182044.1998.bug-gnu-emacs@gnu.org>
@ 2004-09-25  0:13 ` Kim F. Storm
  2004-09-25  1:54   ` Sean O'Rourke
       [not found]   ` <mailman.3966.1096077688.1998.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Kim F. Storm @ 2004-09-25  0:13 UTC (permalink / raw)
  Cc: bug-gnu-emacs

"Sean O'Rourke" <sorourke@cs.ucsd.edu> writes:

> ido mode is currently unusably slow when finding a file in a large
> directory.  For example, in a directory with ~3000 files,
> `ido-find-file' takes several seconds to come up with a prompt.  When
> you know you're in such a directory, it would be nice to bypass ido
> entirely and fall back to the original `find-file'.  Since the ido
> functions currently don't use a prefix argument, I think that when
> called with a prefix argument, the ido functions should fall back to
> their non-ido equivalents.

I have installed a change to emacs CVS so that ido automatically
avoids doing completion in large directories (see new defcustom
ido-max-directory-size).  To see the completions, use C-a or TAB.

It only works on systems (e.g GNU/Linux) where file-attributes returns
a sensible size for directories.  So it probably fails on Windoze...

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

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

* Re: Allow prefix arg for ido-find-*file* (maybe)
  2004-09-25  0:13 ` Allow prefix arg for ido-find-*file* (maybe) Kim F. Storm
@ 2004-09-25  1:54   ` Sean O'Rourke
       [not found]   ` <mailman.3966.1096077688.1998.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Sean O'Rourke @ 2004-09-25  1:54 UTC (permalink / raw)
  Cc: bug-gnu-emacs

At Sat, 25 Sep 2004 02:13:01 +0200,
no-spam@cua.dk (Kim F. Storm) wrote:
> It only works on systems (e.g GNU/Linux) where file-attributes returns
> a sensible size for directories.  So it probably fails on Windoze...

Thanks for looking into this.  It looks like it does the trick, though
the default threshhold is way too high to have an effect -- something
like 4096 or 8192 might be better.  file-attributes seems sensical on
Darwin as well, though I'd rather specify a (possibly rough) number of
files, and

    (length (directory-files DIR nil nil t))

isn't that slow -- it's all the filtering and fontification done by
ido that slows things down.  FWIW, on Darwin the second element of
file-attributes seems to be the number of files.  Weird.

/s

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

* Re: Allow prefix arg for ido-find-*file* (maybe)
       [not found]   ` <mailman.3966.1096077688.1998.bug-gnu-emacs@gnu.org>
@ 2004-09-26 21:29     ` Kim F. Storm
  2004-09-26 22:02       ` Sean O'Rourke
  0 siblings, 1 reply; 5+ messages in thread
From: Kim F. Storm @ 2004-09-26 21:29 UTC (permalink / raw)
  Cc: bug-gnu-emacs

"Sean O'Rourke" <sorourke@cs.ucsd.edu> writes:

> At Sat, 25 Sep 2004 02:13:01 +0200,
> no-spam@cua.dk (Kim F. Storm) wrote:
>> It only works on systems (e.g GNU/Linux) where file-attributes returns
>> a sensible size for directories.  So it probably fails on Windoze...
>
> Thanks for looking into this.  It looks like it does the trick, though
> the default threshhold is way too high to have an effect -- something
> like 4096 or 8192 might be better.  

I chose the default limit so it doesn't get activated too often.
Specifically, it doesn't get activated in the emacs/lisp directory.

And I don't see any slow-down for the current limit on my laptop.

But it's a defcustom, so change it to suit your own needs.

>                                     file-attributes seems sensical on
> Darwin as well, though I'd rather specify a (possibly rough) number of
> files, and
>
>     (length (directory-files DIR nil nil t))
>
> isn't that slow -- it's all the filtering and fontification done by
> ido that slows things down.  

For a local file system that is true -- but I have some directories
which have +25000 files, and in those your code takes a few seconds
to execute.

But it would make sense to use the above as an alternative or
alternative for e.g. windoze...  I'll think about it!

>                              FWIW, on Darwin the second element of
> file-attributes seems to be the number of files.  Weird.

Could you debug that?

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

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

* Re: Allow prefix arg for ido-find-*file* (maybe)
  2004-09-26 21:29     ` Kim F. Storm
@ 2004-09-26 22:02       ` Sean O'Rourke
  0 siblings, 0 replies; 5+ messages in thread
From: Sean O'Rourke @ 2004-09-26 22:02 UTC (permalink / raw)


At Sun, 26 Sep 2004 23:29:57 +0200,
no-spam@cua.dk (Kim F. Storm) wrote:
> But it's a defcustom, so change it to suit your own needs.

FWIW, I've grown attached to the defadvice for a prefix arg, since
there are situations where I know ahead of time that ido-* will be
less useful than the default.

> >                              FWIW, on Darwin the second element of
> > file-attributes seems to be the number of files.  Weird.
> 
> Could you debug that?

I'm not sure what you mean by "debug" here, since this seems more like
a stealth feature.  For some reason, stat here (OSX 10.3) puts the
number of directory entries in st_nlink rather than the number of
subdirectories, even though the header says

	nlink_t	  st_nlink;		/* number of hard links */

/s

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

end of thread, other threads:[~2004-09-26 22:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2739.1095182044.1998.bug-gnu-emacs@gnu.org>
2004-09-25  0:13 ` Allow prefix arg for ido-find-*file* (maybe) Kim F. Storm
2004-09-25  1:54   ` Sean O'Rourke
     [not found]   ` <mailman.3966.1096077688.1998.bug-gnu-emacs@gnu.org>
2004-09-26 21:29     ` Kim F. Storm
2004-09-26 22:02       ` Sean O'Rourke
2004-09-14 17:07 Sean O'Rourke

Code repositories for project(s) associated with this public inbox

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

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