unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path
@ 2024-07-24 11:17 Alvaro Ramirez
  2024-08-04  8:06 ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Alvaro Ramirez @ 2024-07-24 11:17 UTC (permalink / raw)
  To: 72272

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

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'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-dired-hide-details.patch --]
[-- Type: text/patch, Size: 2882 bytes --]

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


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2024-10-19  8:54 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-24 11:17 bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Alvaro Ramirez
2024-08-04  8:06 ` Eli Zaretskii
2024-08-05  9:45   ` Andrea Corallo
     [not found]     ` <d75b2eb4e45413d468c15f4d6e8c3d0ce568d28ddbf7a828a4f917f29e54cbcb@mu.id>
2024-08-05 14:34       ` Alvaro Ramirez
2024-08-17  8:53         ` Eli Zaretskii
2024-08-17  9:27           ` Alvaro Ramirez
2024-10-01 20:31             ` Alvaro Ramirez
2024-10-01 21:17         ` Stefan Kangas
2024-10-02 10:55           ` Alvaro Ramirez
2024-10-02 21:32             ` Stefan Kangas
2024-10-03  8:19               ` Alvaro Ramirez
2024-10-03  8:23                 ` Alvaro Ramirez
2024-10-03 14:57               ` Visuwesh
2024-10-03 17:37                 ` Alvaro Ramirez
2024-10-09 17:31                   ` Alvaro Ramirez
2024-10-12 11:33                     ` Eli Zaretskii
2024-10-12 18:27                       ` Alvaro Ramirez
2024-10-19  7:58                         ` Eli Zaretskii
2024-10-19  8:54                           ` Alvaro Ramirez

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).