summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAugusto Stoffel <arstoffel@gmail.com>2023-02-25 12:15:43 +0100
committerEli Zaretskii <eliz@gnu.org>2023-03-02 14:02:24 +0200
commit11c4177430230ef41cb700c48afecf475cf39893 (patch)
tree82dc51aa62a36635bf19f06b194051b695432c75
parent8d5d7509b0a2c248084fa349b0b188d4de4af804 (diff)
downloademacs-11c4177430230ef41cb700c48afecf475cf39893.tar.gz
Add option to keep some columns in dired-hide-details-mode
* lisp/dired.el (dired-hide-details-preserved-columns): New user option. (dired-insert-set-properties): Use it. (Bug#61785)
-rw-r--r--lisp/dired.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 55a5bbd9800..8e3244356fe 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -490,6 +490,11 @@ to nil: a pipe using `zcat' or `gunzip -c' will be used."
(string :tag "Switches"))
:version "29.1")
+(defcustom dired-hide-details-preserved-columns nil
+ "List of columns which are not hidden in `dired-hide-details-mode'."
+ :type '(repeat integer)
+ :version "30.1")
+
;;; Internal variables
@@ -1880,8 +1885,15 @@ other marked file as well. Otherwise, unmark all files."
(put-text-property (line-beginning-position)
(1+ (line-end-position))
'invisible 'dired-hide-details-information))
- (put-text-property (+ (line-beginning-position) 1) (1- (point))
- 'invisible 'dired-hide-details-detail)
+ (save-excursion
+ (let ((end (1- (point)))
+ (opoint (goto-char (1+ (pos-bol))))
+ (i 0))
+ (put-text-property opoint end 'invisible 'dired-hide-details-detail)
+ (while (re-search-forward "[^ ]+" end t)
+ (when (member (cl-incf i) dired-hide-details-preserved-columns)
+ (put-text-property opoint (point) 'invisible nil))
+ (setq opoint (point)))))
(when (and dired-mouse-drag-files (fboundp 'x-begin-drag))
(put-text-property (point)
(save-excursion