Subject: bug#72272: closed (Re: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 19 Oct 2024 08:00:02 +0000

Your bug report

#72272: [PATCH] dired-hide-details-mode hides directory's absolute path

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
72272: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72272
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path
From: Eli Zaretskii <[email-masked]>
To: Alvaro Ramirez <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked], [email-masked]
Date: Sat, 19 Oct 2024 10:58:30 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Alvaro Ramirez <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked],
>   [email-masked]
> Date: Sat, 12 Oct 2024 19:27:09 +0100
> 
> Thanks for the comments Eli.
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> From: Alvaro Ramirez <[email-masked]>
> >> Date: Wed, 9 Oct 2024 18:31:35 +0100
> >> Cc: [email-masked], Andrea Corallo <[email-masked]>,
> >>  Visuwesh <[email-masked]>
> >> 
> >> Hi Eli / Stefan
> >> 
> >> With the latest patch disabling the feature by default, is it 
> >> good to apply?
> >
> > It is good, but it no longer applies.  Would you please rebase 
> > it on
> > the latest master branch and resubmit?
> 
> Yup. Rebased. See latest patch attached.

Thanks, I installed this on the master branch.

Please in the future accompany patches with a ChangeLog-style commit
log message, as described in CONTRIBUTE.  (I added it for you this
time.)

I'm now closing this bug.

Subject: [PATCH] dired-hide-details-mode hides directory's absolute path
From: Alvaro Ramirez <[email-masked]>
To: [email-masked]
Date: Wed, 24 Jul 2024 12:17:58 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Hi folks,

Sending an initial patch. Happy to iterate on it, add tests, 
etc. if we
reckon the feature is worth pursuing.

Set `dired-hide-details-hide-absolute-location` to non-nil and 
toggle
`dired-hide-details-mode` to hide the current directory's absolute 
path.

This is my first submission, might need some process guidance.

Alvaro

In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin23.5.0, NS
 appkit-2487.60 Version 14.5 (Build 23F79)) of 2024-07-23 built on 
 jiko
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.5

Configured using:
 'configure --with-ns
 --prefix=/Users/alvaro/stuff/active/code/third_party/emacs/nextstep/Emacs.app/Contents/MacOS
 --enable-locallisppath=/Users/alvaro/stuff/active/code/third_party/emacs/nextstep/Emacs.app/Contents/MacOS'

>From 6f79b6baa00f7087c81b48ef136590634efa059d Mon Sep 17 00:00:00 2001
From: xenodium <[email-masked]>
Date: Tue, 23 Jul 2024 21:55:37 +0100
Subject: [PATCH] Hides current location's path via dired-hide-details-mode

---
 lisp/dired.el | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/lisp/dired.el b/lisp/dired.el
index 0d526dfc376..3d92cee2ee5 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -387,6 +387,12 @@ dired-hide-details-hide-information-lines
   :version "24.4"
   :group 'dired)
 
+(defcustom dired-hide-details-hide-absolute-location t
+  "Non-nil means `dired-hide-details-mode' hides current location's absolute path."
+  :type 'boolean
+  :version "31.1"
+  :group 'dired)
+
 (defcustom dired-always-read-filesystem nil
   "Non-nil means revert buffers visiting files before searching them.
 By default,  commands like `dired-mark-files-containing-regexp' will
@@ -3243,8 +3249,9 @@ dired-hide-details-mode
 When this minor mode is enabled, details such as file ownership and
 permissions are hidden from view.
 
-See options: `dired-hide-details-hide-symlink-targets' and
-`dired-hide-details-hide-information-lines'."
+See options: `dired-hide-details-hide-symlink-targets',
+`dired-hide-details-hide-information-lines' and
+`dired-hide-details-hide-absolute-location'."
   :group 'dired
   (unless (derived-mode-p '(dired-mode wdired-mode))
     (error "Not a Dired buffer"))
@@ -3268,6 +3275,11 @@ dired-hide-details-update-invisibility-spec
 	       'add-to-invisibility-spec
 	     'remove-from-invisibility-spec)
 	   'dired-hide-details-information)
+  (funcall (if (and dired-hide-details-mode
+		    dired-hide-details-hide-absolute-location)
+	       'add-to-invisibility-spec
+	     'remove-from-invisibility-spec)
+	   'dired-hide-details-absolute-location)
   (funcall (if (and dired-hide-details-mode
 		    dired-hide-details-hide-symlink-targets
 		    (not (derived-mode-p 'wdired-mode)))
@@ -3674,7 +3686,14 @@ dired-build-subdir-alist
 				(substring new-dir-name (match-end 0)))
 		      (expand-file-name new-dir-name))))
 	    (delete-region (point) (match-end 1))
-	    (insert new-dir-name))
+            (if-let ((dir-base (file-name-nondirectory new-dir-name))
+                     (dir-path (file-name-directory new-dir-name))
+                     (hide-dir-path (and dired-hide-details-hide-absolute-location
+                                         (not (string-empty-p dir-base)))))
+                (insert (concat
+                         (propertize dir-path 'invisible 'dired-hide-details-absolute-location)
+                         dir-base))
+	      (insert new-dir-name)))
 	  (setq count (1+ count))
 	  ;; Undo any escaping of newlines and \ by dired-insert-directory.
 	  ;; Convert "n" preceded by odd number of \ to newline, and \\ to \.
-- 
2.39.3 (Apple Git-146)