dired: Fix dired-du compatibility issue with custom TIME_STYLE

master
Pierre Neidhardt 2018-08-01 12:31:02 +02:00
parent d64d3c3784
commit f43228534d
1 changed files with 17 additions and 0 deletions

View File

@ -65,4 +65,21 @@
(dolist (fun '(dired-omit-mode ambrevar/dired-set-listing-switches))
(add-hook 'dired-mode-hook fun))
(when (require 'dired-du nil t)
(setq dired-du-size-format t)
;; dired-du needs some adjustments with a custom TIME_STYLE.
(when (getenv "TIME_STYLE")
(let* ((yyyy "[0-9][0-9][0-9][0-9]")
(HH:MM "[ 0-2][0-9][:.][0-5][0-9]")
(seconds "[0-6][0-9]\\([.,][0-9]+\\)?")
(iso-mm-dd "[01][0-9]-[0-3][0-9]")
(zone "[-+][0-2][0-9][0-5][0-9]")
(iso-time (concat HH:MM "\\(:" seconds "\\( ?" zone "\\)?\\)?"))
(iso (concat "\\(\\(" yyyy "-\\)?" iso-mm-dd "[ T]" iso-time
"\\|" yyyy "-" iso-mm-dd "\\)")))
(setq directory-listing-before-filename-regexp
(concat "\\([0-9][BkKMGTPEZY]? "
"|" iso "|"
"\\) +")))))
(provide 'init-dired)