unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6810: 23.2; dired-omit-mode makes dired slow
@ 2010-08-06 15:19 Leo
  2010-12-04 17:34 ` Leo
  0 siblings, 1 reply; 5+ messages in thread
From: Leo @ 2010-08-06 15:19 UTC (permalink / raw)
  To: 6810

When dired-omit-mode is on, operations on marked files become much
slower. To see this, following these steps:

1. Emacs -q

2. eval:
  (require 'dired-x)
  (add-hook 'dired-mode-hook 'dired-omit-mode)

3. C-x d and enter emacs/lisp (or any dir that has a few dozen files)

4. Mark all files by typing: * / t

5. Change mode to 444 by typing: M 444 RET


For every marked file, a message is displayed something like:
   Redisplaying...xyz.el
   Omitting...
   (Nothing to omit)

Can this inefficiency be rid of? Thank you.

Leo





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

* bug#6810: 23.2; dired-omit-mode makes dired slow
  2010-08-06 15:19 bug#6810: 23.2; dired-omit-mode makes dired slow Leo
@ 2010-12-04 17:34 ` Leo
  2010-12-04 22:19   ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Leo @ 2010-12-04 17:34 UTC (permalink / raw)
  To: 6810

On 2010-08-06 16:19 +0100, Leo wrote:
> When dired-omit-mode is on, operations on marked files become much
> slower. To see this, following these steps:
>
> 1. Emacs -q
>
> 2. eval:
>   (require 'dired-x)
>   (add-hook 'dired-mode-hook 'dired-omit-mode)
>
> 3. C-x d and enter emacs/lisp (or any dir that has a few dozen files)
>
> 4. Mark all files by typing: * / t
>
> 5. Change mode to 444 by typing: M 444 RET
>
>
> For every marked file, a message is displayed something like:
>    Redisplaying...xyz.el
>    Omitting...
>    (Nothing to omit)
>
> Can this inefficiency be rid of? Thank you.
>
> Leo

`dired-do-redisplay' iterates over the marked files calling
dired-update-file-line which triggers dired-after-readin-hook (see line
1132 in dired-aux). So that hook is being run for as many times as the
number of files marked.

Any objection to something like this:

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 62d6928..90fd1e69 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1017,10 +1017,13 @@
     ;; message much faster than making dired-map-over-marks show progress
     (dired-uncache
      (if (consp dired-directory) (car dired-directory) dired-directory))
-    (dired-map-over-marks (let ((fname (dired-get-filename)))
+    (dired-map-over-marks (let ((fname (dired-get-filename))
+                                ;; disable readin hook until later
+                                (dired-after-readin-hook nil))
 			    (message "Redisplaying... %s" fname)
 			    (dired-update-file-line fname))
 			  arg)
+    (run-hooks 'dired-after-readin-hook)
     (dired-move-to-filename)
     (message "Redisplaying...done")))
 
Leo





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

* bug#6810: 23.2; dired-omit-mode makes dired slow
  2010-12-04 17:34 ` Leo
@ 2010-12-04 22:19   ` Chong Yidong
  2010-12-05  5:20     ` Leo
  0 siblings, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2010-12-04 22:19 UTC (permalink / raw)
  To: Leo; +Cc: 6810

Leo <sdl.web@gmail.com> writes:

> `dired-do-redisplay' iterates over the marked files calling
> dired-update-file-line which triggers dired-after-readin-hook (see line
> 1132 in dired-aux). So that hook is being run for as many times as the
> number of files marked.
>
> Any objection to something like this:

Shouldn't this handle dired-before-readin hook too?





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

* bug#6810: 23.2; dired-omit-mode makes dired slow
  2010-12-04 22:19   ` Chong Yidong
@ 2010-12-05  5:20     ` Leo
  2010-12-06 19:55       ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Leo @ 2010-12-05  5:20 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 6810

On 2010-12-04 22:19 +0000, Chong Yidong wrote:
> Shouldn't this handle dired-before-readin hook too?

I think at the time of running dired-map-over-marks, dired already
passed before-readin stage. But I am not entirely sure.

Best,
Leo





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

* bug#6810: 23.2; dired-omit-mode makes dired slow
  2010-12-05  5:20     ` Leo
@ 2010-12-06 19:55       ` Chong Yidong
  0 siblings, 0 replies; 5+ messages in thread
From: Chong Yidong @ 2010-12-06 19:55 UTC (permalink / raw)
  To: Leo; +Cc: 6810

Leo <sdl.web@gmail.com> writes:

> On 2010-12-04 22:19 +0000, Chong Yidong wrote:
>> Shouldn't this handle dired-before-readin hook too?
>
> I think at the time of running dired-map-over-marks, dired already
> passed before-readin stage.

So it is.

I've committed your fix, thanks.






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

end of thread, other threads:[~2010-12-06 19:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06 15:19 bug#6810: 23.2; dired-omit-mode makes dired slow Leo
2010-12-04 17:34 ` Leo
2010-12-04 22:19   ` Chong Yidong
2010-12-05  5:20     ` Leo
2010-12-06 19:55       ` Chong Yidong

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