emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: insert-directory


From: Luc Teirlinck
Subject: Re: insert-directory
Date: Thu, 27 May 2004 10:51:39 -0500 (CDT)

Kai Grossjohann wrote:

   Luc Teirlinck <address@hidden> writes:

   > 3.  Making `i' work _absolutely perfectly_ in _every possible aspect_
   >     seems theoretically impossible, because the buffer is not in
   >     dired-mode.

   I wonder if it makes sense to have the locate output look more like
   the find-dired output?  Then the buffer could be in dired mode
   normally.  (One could call file-attributes on each filename returned
   by locate and construct "ls -l" like output from that.)

I am afraid that would force a complete rewrite of locate.el.

In spite of my theoretical concerns above, things seem to work well in
practice.  I am a little bit reluctant to post a new patch each time a
make a further minor change but I added:

(setq selective-display t)
(set (make-local-variable 'page-delimiter) "\n\n")

and after that, the parts inserted by `i' are pretty much in
dired-mode.  The reason why those parts can be while the main listing
is not are the "\\|" in the regular expressions.

That leaves us with the one problem we can not get around:
parts of the dired-code that do:
(if (eq major-mode 'dired-mode)
and the like.

There are several places like that in dired-aux and dired-x, but at
first sight they do not seem applicable.  The one place in dired.el
itself is `dired-sort-other':

  (if (eq major-mode 'dired-mode) (dired-sort-set-modeline))

But (dired-sort-set-modeline) _really_ only makes sense if the buffer is
in dired-mode.

After adding the two lines above, the only dired commands that seem to
produce problems are the updating commands `g' and `l' (on a directory
header line).  `g' in locate-mode will produce problems anyway, unless
you are running as root.  If you are not you get:

fatal error: updatedb: You are not authorized to create a default
slocate database!

Actually, the trouble with `l' (or the remaining problem with `g', if
you are root) are a dired problem.  Dired does not store the switches
used for a subdirectory.  (I believe that, sooner or later, this
should be fixed.)  As a result, not only does `l' on a directory
header line give problems in *Locate* and (after applying the patch
for find-dired I posted) in *Find* buffers, but it gives problems in
ordinary dired buffers as well if `C-u i' was used.  In particular,
`C-u i' does not work in a dired buffer in which auto-revert-mode is
enabled.  The switches get overridden after 0 to 5 seconds.
Auto-reverting does not work in *Locate* or *Find* buffers anyway.

Sincerely,

Luc.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]