GNU bug report logs - #4792
23.1; dired-insert-directory: doesn't indent header lines if no files

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Fri, 23 Oct 2009 18:25:06 UTC

Severity: minor

Full log


View this message in rfc822 format

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: bug#4792: 23.1; dired-insert-directory: doesn't indent header lines if no files
Date: Fri, 23 Oct 2009 11:19:49 -0700
emacs -q
C-x d some-directory-that-does-not-exist
 
The listing looks like this:
 
  c:/Emacs-23.1/lisp:
  wildcard some-directory-that-does-not-exist
(No match)
total used in directory 0 available 26402560
 
The last two lines should be indented, but they are not.
 
They need to be indented, in particular, so that any (custom)
font-lock highlighting that might be done can act appropriately. They
should also be indented for consistency with the display of a
non-empty listing.
 
This regression was introduced in Emacs 22 - the lines are indented
correctly in Emacs 20 and 21.
 
The cause is this change in `dired-insert-directory':
(indent-rigidly opoint (point) 2)
 
Originally, that was (indent-rigidly (point-min) (point-max) 2),
though the indentation was done elsewhere at that time.
 
The problem is that when there are no files in the listing, point does
not get moved, so opoint is 1, and so is (point) - so nothing is
indented.
 
Either `point-min' and `point-max' should be used, as before (unless
that causes some other problem), or the code should check whether any
file lines were actually inserted and DTRT. Or perhaps the
`save-excursion' could be removed around the code that inserts this
header info, so that (point) would be at (point-max). (opoint = 1 is
not the problem.)
 
Note: I'm on Windows, so the code uses ls-lisp.el. E.g. it uses the
version of `insert-directory' provided by ls-lisp.el. Dunno if that
makes a difference.
 

In GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600)
 of 2009-07-29 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4)'
 





This bug report was last modified 15 years and 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.