summaryrefslogtreecommitdiff
path: root/lisp/ls-lisp.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ls-lisp.el')
-rw-r--r--lisp/ls-lisp.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el
index 70ee4394b88..82a78545d62 100644
--- a/lisp/ls-lisp.el
+++ b/lisp/ls-lisp.el
@@ -404,6 +404,13 @@ not contain `d', so that a full listing is expected."
;; the wildcard; let's say something similar.
(insert "(No match)\n"))
(insert (format "total %.0f\n" (fceiling (/ sum 1024.0))))))
+ ;; dired-insert-directory expects to find point after the
+ ;; text. But if the listing is empty, as e.g. in empty
+ ;; directories with -a removed from switches, point will be
+ ;; before the inserted text, and dired-insert-directory will
+ ;; not indent the listing correctly. Going to the end of the
+ ;; buffer fixes that.
+ (unless files (goto-char (point-max)))
(if (memq ?R switches)
;; List the contents of all directories recursively.
;; cadr of each element of `file-alist' is t for