ls-lisp: Fix file size format

* lisp/ls-lisp.el (ls-lisp-filesize-d-fmt, ls-lisp-filesize-f-fmt)
(ls-lisp-filesize-b-fmt): Add space in front (Bug#27693).
* test/lisp/dired-tests.el (dired-test-bug27693): Add test.
This commit is contained in:
Tino Calancha 2017-07-16 00:30:56 +09:00
parent b30ee0c922
commit 66683f46b8
2 changed files with 15 additions and 3 deletions

View file

@ -245,11 +245,11 @@ to fail to line up, e.g. if month names are not all of the same length."
"Format to display integer GIDs.")
(defvar ls-lisp-gid-s-fmt " %s"
"Format to display user group names.")
(defvar ls-lisp-filesize-d-fmt "%d"
(defvar ls-lisp-filesize-d-fmt " %d"
"Format to display integer file sizes.")
(defvar ls-lisp-filesize-f-fmt "%.0f"
(defvar ls-lisp-filesize-f-fmt " %.0f"
"Format to display float file sizes.")
(defvar ls-lisp-filesize-b-fmt "%.0f"
(defvar ls-lisp-filesize-b-fmt " %.0f"
"Format to display file sizes in blocks (for the -s switch).")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -84,5 +84,17 @@
(advice-remove 'dired-query "advice-dired-query")
(advice-remove 'completing-read "advice-completing-read"))))
(ert-deftest dired-test-bug27693 ()
"Test for http://debbugs.gnu.org/27693 ."
(require 'ls-lisp)
(let ((size "")
ls-lisp-use-insert-directory-program)
(dired (list (expand-file-name "lisp" source-directory) "simple.el" "subr.el"))
(setq size (number-to-string
(file-attribute-size
(file-attributes (dired-get-filename)))))
(search-backward-regexp size nil t)
(should (looking-back "[[:space:]]" (1- (point))))))
(provide 'dired-tests)
;; dired-tests.el ends here