summaryrefslogtreecommitdiff
path: root/lisp/ls-lisp.el
diff options
context:
space:
mode:
authorIngo Lohmar <i.lohmar@gmail.com>2013-04-27 19:55:29 +0300
committerEli Zaretskii <eliz@gnu.org>2013-04-27 19:55:29 +0300
commita81ee1eb7b6160fe188328e14a4e1239596c6af8 (patch)
tree37597ef181cfeaca62c587a396e7f0b1b1b1d75d /lisp/ls-lisp.el
parentb8dd59f747ffd09a7fa4df2e36924f435ee61a90 (diff)
downloademacs-a81ee1eb7b6160fe188328e14a4e1239596c6af8.tar.gz
Fix Dired when ls-lisp is used and the -a switch is not used.
lisp/ls-lisp.el (ls-lisp-insert-directory): If no files are displayed, move point to after the totals line. See http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00677.html for the details.
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..60d6b7b7ba5 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 exprects to find point after the
+ ;; text. But if the listinmg 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