From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alvaro Ramirez Newsgroups: gmane.emacs.bugs Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Date: Wed, 24 Jul 2024 12:17:58 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33282"; mail-complaints-to="usenet@ciao.gmane.io" To: 72272@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 24 13:19:26 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sWa1l-0008VQ-Og for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Jul 2024 13:19:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sWa1K-0004sc-CC; Wed, 24 Jul 2024 07:18:58 -0400 Original-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 ) id 1sWa1I-0004sR-Mp for bug-gnu-emacs@gnu.org; Wed, 24 Jul 2024 07:18:56 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sWa1I-0004fs-EW for bug-gnu-emacs@gnu.org; Wed, 24 Jul 2024 07:18:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sWa1N-0003wv-UI for bug-gnu-emacs@gnu.org; Wed, 24 Jul 2024 07:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alvaro Ramirez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Jul 2024 11:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.172181990015096 (code B ref -1); Wed, 24 Jul 2024 11:19:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Jul 2024 11:18:20 +0000 Original-Received: from localhost ([127.0.0.1]:33212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sWa0i-0003vQ-Cd for submit@debbugs.gnu.org; Wed, 24 Jul 2024 07:18:20 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:40138) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sWa0c-0003vB-Na for submit@debbugs.gnu.org; Wed, 24 Jul 2024 07:18:18 -0400 Original-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 ) id 1sWa0W-0004oY-K9 for bug-gnu-emacs@gnu.org; Wed, 24 Jul 2024 07:18:08 -0400 Original-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 ) id 1sWa0U-0004Eb-0k for bug-gnu-emacs@gnu.org; Wed, 24 Jul 2024 07:18:08 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com 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= X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=91.218.175.173; envelope-from=alvaro@xenodium.com; 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:289210 Archived-At: --=-=-= 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 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) --=-=-=--