GNU bug report logs - #72272
[PATCH] dired-hide-details-mode hides directory's absolute path

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Alvaro Ramirez <alvaro@HIDDEN>; Keywords: patch; dated Wed, 24 Jul 2024 11:19:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 24 Jul 2024 11:18:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 24 07:18:20 2024
Received: from localhost ([127.0.0.1]:33212 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sWa0i-0003vQ-Cd
	for submit <at> debbugs.gnu.org; Wed, 24 Jul 2024 07:18:20 -0400
Received: from lists.gnu.org ([209.51.188.17]:40138)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <alvaro@HIDDEN>) id 1sWa0c-0003vB-Na
 for submit <at> debbugs.gnu.org; Wed, 24 Jul 2024 07:18:18 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <alvaro@HIDDEN>)
 id 1sWa0W-0004oY-K9
 for bug-gnu-emacs@HIDDEN; Wed, 24 Jul 2024 07:18:08 -0400
Received: from out-173.mta0.migadu.com ([91.218.175.173])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <alvaro@HIDDEN>)
 id 1sWa0U-0004Eb-0k
 for bug-gnu-emacs@HIDDEN; Wed, 24 Jul 2024 07:18:08 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xenodium.com;
 s=default; t=1721819880;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=flWMXstwBMlrnVtBBArpJVt92wGI4FCa1gFWbkb926o=;
 b=KJQjf0lHCHqOWcvWx0LSEVcyBpj4Kh6G4tNOuP1ROkLIcNct9tuWf1wGX5ncTcbQQCywbd
 cQmOn3EHNz5dq1Ab7DS9Ea6RVPwK4usUjWDC6H+77ApwBpnVIEWn5QjXRS9k4WfaCl1u6T
 TQ6e8+N0tX2d3v8ep/U/TcwIJ+rR23Q=
From: Alvaro Ramirez <alvaro@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] dired-hide-details-mode hides directory's absolute path
Date: Wed, 24 Jul 2024 12:17:58 +0100
Message-ID: <m27cdbca3d.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=91.218.175.173; envelope-from=alvaro@HIDDEN;
 helo=out-173.mta0.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain; format=flowed

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'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment; filename=0001-dired-hide-details.patch

From 6f79b6baa00f7087c81b48ef136590634efa059d Mon Sep 17 00:00:00 2001
From: xenodium <me+gh@HIDDEN>
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)


--=-=-=--




Acknowledgement sent to Alvaro Ramirez <alvaro@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#72272; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 24 Jul 2024 11:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.