]> git.eshelyaron.com Git - emacs.git/commitdiff
Add option to keep some columns in dired-hide-details-mode
authorAugusto Stoffel <arstoffel@gmail.com>
Sat, 25 Feb 2023 11:15:43 +0000 (12:15 +0100)
committerEli Zaretskii <eliz@gnu.org>
Thu, 2 Mar 2023 12:02:24 +0000 (14:02 +0200)
* lisp/dired.el (dired-hide-details-preserved-columns): New user
option.
(dired-insert-set-properties): Use it.  (Bug#61785)

lisp/dired.el

index 55a5bbd9800cb6776699ebe7da037e3992943b8e..8e3244356fe36761618977d985382c925b5a8dff 100644 (file)
@@ -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")
+
 \f
 ;;; 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