ls-lisp: Fix file size format
authorTino Calancha <tino.calancha@gmail.com>
Sat, 15 Jul 2017 15:30:56 +0000 (00:30 +0900)
committerTino Calancha <tino.calancha@gmail.com>
Sat, 15 Jul 2017 15:30:56 +0000 (00:30 +0900)
* 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.

lisp/ls-lisp.el
test/lisp/dired-tests.el

index 7ae234344156834de6023fd7a3807585ae973fab..b368efbbc95b27fcb01dbe1c821a6bb80b93af57 100644 (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).")
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
index 1b814baac58716aeb21b2a39bee23745876766c8..208e1c25091b8e91db697d42d8727b15a8d5d792 100644 (file)
       (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