From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path 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 To: 72272@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.172181990015096 (code B ref -1); Wed, 24 Jul 2024 11:19:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Jul 2024 11:18:20 +0000 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 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 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 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= From: Alvaro Ramirez Date: Wed, 24 Jul 2024 12:17:58 +0100 Message-ID: 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@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-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 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) --=-=-=-- From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2024 08:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alvaro Ramirez , Stefan Monnier , Andrea Corallo Cc: 72272@debbugs.gnu.org Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.172275880421594 (code B ref 72272); Sun, 04 Aug 2024 08:07:02 +0000 Received: (at 72272) by debbugs.gnu.org; 4 Aug 2024 08:06:44 +0000 Received: from localhost ([127.0.0.1]:55409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saWGJ-0005cB-PJ for submit@debbugs.gnu.org; Sun, 04 Aug 2024 04:06:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saWGH-0005bh-5B for 72272@debbugs.gnu.org; Sun, 04 Aug 2024 04:06:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1saWFq-0005dm-Cv; Sun, 04 Aug 2024 04:06:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=iv0/XYjejufGWDV5Hy4juJJslcYsfDnw0uJmCHXv94g=; b=EhAI+zH3Sg2s oJZkeob5SFWAl+NTz0XPQhxPC6o6WeexpZhI4WQsO0zqp3o2Et1zCFwn4INFO2QvPquCIxwVS4uwj eGlF5nMbY66YiEb1tfcQn0kA8SX0JS4XQ0Po66UJY9LJCj5+11BA9aV3Bv9o5RvCkkR7FX7acaVTu 8rI8Uz/FdSh+ULgyj2gQH+XR8/q+iv0s9P04EbHhg+ddePAV8OcGWmt98uEOFwzDd6HRDwv4yrWAS rmM8jC+rDh1Ph7V42IwNNNpEWGKb+pZuwYxYjLK9iRuxHs7ZmUVrIX5++V8oPszcD1toeuuidf1+Y 2pHHbDNj2hKetSDmZ+AK+w==; Date: Sun, 04 Aug 2024 11:06:09 +0300 Message-Id: <86plqosoem.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Alvaro Ramirez on Wed, 24 Jul 2024 12:17:58 +0100) References: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Alvaro Ramirez > Date: Wed, 24 Jul 2024 12:17:58 +0100 > > 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. Thanks. Stefan and Andrea, any comments? I have a few minor ones: > From: xenodium > Date: Tue, 23 Jul 2024 21:55:37 +0100 > Subject: [PATCH] Hides current location's path via dired-hide-details-mode ^^^^ Please don't use "path" for anything except PATH-style directory lists. The GNU Coding Standards frown on such usage. > +(defcustom dired-hide-details-hide-absolute-location t > + "Non-nil means `dired-hide-details-mode' hides current location's absolute path." Same here. > + (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 And here. Also, this change needs a NEWS entry. From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Aug 2024 09:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: Alvaro Ramirez , 72272@debbugs.gnu.org, Stefan Monnier Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.172285129219440 (code B ref 72272); Mon, 05 Aug 2024 09:49:02 +0000 Received: (at 72272) by debbugs.gnu.org; 5 Aug 2024 09:48:12 +0000 Received: from localhost ([127.0.0.1]:57922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sauK3-00053Q-NS for submit@debbugs.gnu.org; Mon, 05 Aug 2024 05:48:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sauK1-000530-Cq for 72272@debbugs.gnu.org; Mon, 05 Aug 2024 05:48:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sauHS-0006p3-Aq; Mon, 05 Aug 2024 05:45:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=b0t55ScXW/ZqhxDz89qYKQ5x37O9jGuLrQ/d/bI9gXo=; b=B8FNz2iO+zkpyiUpchO/ UPeRXIlJzHuhbnXCqcP+nJ59MpkysfnVyAQguTaxG2f3gdHQnU3WF+ot8a7mIJ5A7W6m2TmVv+qk5 UiISjI56k7PDjgVUCfSwYduBDj+L+342N8U3AOJX5GUVU/UiY3FBMJ4fLc60XResU8JwDOzb9AYXs x/lRgp3PwuKJXb5AycwttsFu8uR+pnFpvLu+z1bKIN/iX0bjMS0M3mT7+dXrwSwjmMJiTQcI7sbbk mXcdKcQzygtC9oVKxlvvHGf14xl1hyhKB3XUHDTQdFpSs9Hz/ExuNFPqodLr0ygy9VRDiaKR6mrTE tqpc1X34gRBqIQ==; Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1sauHR-00033K-6i; Mon, 05 Aug 2024 05:45:30 -0400 From: Andrea Corallo In-Reply-To: <86plqosoem.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 04 Aug 2024 11:06:09 +0300") References: <86plqosoem.fsf@gnu.org> Date: Mon, 05 Aug 2024 05:45:29 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Alvaro Ramirez >> Date: Wed, 24 Jul 2024 12:17:58 +0100 >> >> 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. > > Thanks. > > Stefan and Andrea, any comments? > > I have a few minor ones: > >> From: xenodium >> Date: Tue, 23 Jul 2024 21:55:37 +0100 >> Subject: [PATCH] Hides current location's path via dired-hide-details-mode > ^^^^ > Please don't use "path" for anything except PATH-style directory > lists. The GNU Coding Standards frown on such usage. > >> +(defcustom dired-hide-details-hide-absolute-location t >> + "Non-nil means `dired-hide-details-mode' hides current location's absolute path." > > Same here. > >> + (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 > > And here. > > Also, this change needs a NEWS entry. No further comments other than: > @@ -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) don't we favor #' in place of ' when quoting functions? Thanks Andrea From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Alvaro Ramirez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Aug 2024 14:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Andrea Corallo Cc: eliz@gnu.org, 72272@debbugs.gnu.org Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.172286849123162 (code B ref 72272); Mon, 05 Aug 2024 14:35:02 +0000 Received: (at 72272) by debbugs.gnu.org; 5 Aug 2024 14:34:51 +0000 Received: from localhost ([127.0.0.1]:59267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saynS-00061W-8L for submit@debbugs.gnu.org; Mon, 05 Aug 2024 10:34:50 -0400 Received: from out-170.mta0.migadu.com ([91.218.175.170]:31944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saynP-000614-Qk for 72272@debbugs.gnu.org; Mon, 05 Aug 2024 10:34:48 -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=1722868458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=r2QEscvf7rQFn7h3YEqavvOy6fYtx1RDkrklcVL8B20=; b=rrnJJ+nITj9hcJC+h7jKJt5qcMx25IAcZwaNTz1d9KHI5wMwiSGIMe3Cg2ol8Al5HUzqhS rhHnAOjzZmuRC5gCtbcZDrgCxE8ITZuLM6f4nnmLYaVrt5nicAmNgyfQzkcBttxpY+Lgvv wG2VWX86r9OMjW5XHNHo+WHKSQLye6g= From: Alvaro Ramirez In-Reply-To: (Alvaro Ramirez's message of "Mon, 05 Aug 2024 14:41:27 +0100") References: <86plqosoem.fsf@gnu.org> Date: Mon, 05 Aug 2024 15:34:17 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; format=flowed +cc 72272@debbugs.gnu.org Thank you for the comments Andrea and Eli. Andrea Corallo writes: > Eli Zaretskii writes: > >> >> Thanks. >> >> Stefan and Andrea, any comments? >> >> I have a few minor ones: >> >>> From: xenodium >>> Date: Tue, 23 Jul 2024 21:55:37 +0100 >>> Subject: [PATCH] Hides current location's path via >>> dired-hide-details-mode >> ^^^^ >> Please don't use "path" for anything except PATH-style >> directory >> lists. The GNU Coding Standards frown on such usage. >> Ah got it. TIL the naming convention used for functions like of file-name-as-directory. >>> +(defcustom dired-hide-details-hide-absolute-location t >>> + "Non-nil means `dired-hide-details-mode' hides current >>> location's absolute path." >> >> Same here. Done >> >>> + (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 >> >> And here. Done >> >> Also, this change needs a NEWS entry. Added > > No further comments other than: > >> @@ -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) > > don't we favor #' in place of ' when quoting functions? Added I also modified the patch a little to cater for `dired-maybe-insert-subdir` (see https://lists.gnu.org/archive/html/emacs-devel/2024-08/msg00033.html) and to include a couple of tests. May be worth noting, the following dired.el comment seemed outdated https://github.com/emacs-mirror/emacs/blob/c7d9cd722e5a7042a52c92f8497f903bfe9870b8/lisp/dired.el#L1805 ;; Note that dired-build-subdir-alist will replace the name ;; by its expansion, so it does not matter whether what we insert ;; here is fully expanded, but it should be absolute. The mentioned replacement doesn't take place when using `dired-maybe-insert-subdir`, so I tweaked the comment. Setting invisible property is now needed in two places (to handle current location and now subdirs). Please take a look at the latest patch. Happy to go with a different direction if preferred. --=-=-= Content-Type: text/x-patch; size=7.83KiB Content-Disposition: attachment; filename=0001-Hides-directory-absolute-location-via-dired-hide-det.patch >From 6702ccac4b818f77cb3d7afe4d002127ac2a77c6 Mon Sep 17 00:00:00 2001 From: xenodium Date: Tue, 23 Jul 2024 21:55:37 +0100 Subject: [PATCH] Hides directory absolute location via dired-hide-details-mode --- etc/NEWS | 6 +++++ lisp/dired.el | 47 ++++++++++++++++++++++++++++++++-------- test/lisp/dired-tests.el | 44 +++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 9 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index b89a80aa14d..51a4a658467 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -210,6 +210,12 @@ The host name for Kubernetes connections can be of kind used. This overrides the setiing in 'tramp-kubernetes-namespace', if any. +** Dired + ++++ +*** New option 'dired-hide-details-hide-absolute-location', enabled by default. +If non-nil, 'dired-hide-details-mode' also hides directories' absolute locations. + * New Modes and Packages in Emacs 31.1 diff --git a/lisp/dired.el b/lisp/dired.el index 0d526dfc376..18cde9f6e6a 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 directory absolute location." + :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 @@ -1802,12 +1808,20 @@ dired-insert-directory (when (and (or hdr wildcard) (not (and (looking-at "^ \\(.*\\):$") (file-name-absolute-p (match-string 1))))) - ;; Note that dired-build-subdir-alist will replace the name - ;; by its expansion, so it does not matter whether what we insert - ;; here is fully expanded, but it should be absolute. - (insert " " (or (car-safe dir-wildcard) - (directory-file-name (file-name-directory dir))) - ":\n") + (let* ((dir-indent " ") + (dir-name (or (car-safe dir-wildcard) + (directory-file-name (file-name-directory dir)))) + (dir-name-point (+ (point) (length dir-indent))) + (hideable-location (and dired-hide-details-hide-absolute-location + (not (string-empty-p (file-name-nondirectory dir-name)))))) + ;; Inserted directory name must be absolute, but keep in mind it + ;; may be replaced in some instances (e.g. dired-build-subdir-alist). + (insert dir-indent dir-name ":\n") + (when hideable-location + (put-text-property dir-name-point + (+ dir-name-point + (length (file-name-directory dir-name))) + 'invisible 'dired-hide-details-absolute-location))) (setq content-point (point))) (when wildcard ;; Insert "wildcard" line where "total" line would be for a full dir. @@ -3243,8 +3257,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 +3283,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 +3694,16 @@ 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)) + (let ((new-dir-name-pos (point)) + (hideable-location (and dired-hide-details-hide-absolute-location + (not (string-empty-p + (file-name-nondirectory new-dir-name)))))) + (insert new-dir-name) + (when hideable-location + (put-text-property new-dir-name-pos + (+ new-dir-name-pos + (length (file-name-directory new-dir-name))) + 'invisible 'dired-hide-details-absolute-location)))) (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 \. diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 3b1f80d3d3d..be0a8a36d84 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -524,6 +524,50 @@ dired-test-directory-files-and-attributes (when (file-directory-p testdir) (delete-directory testdir t))))) +(ert-deftest dired-test-hide-absolute-location-enabled () + "Test for https://debbugs.gnu.org/72272 ." + (let* ((dired-hide-details-hide-absolute-location t) + (dir-name (expand-file-name "lisp" source-directory)) + (buffer (prog1 (dired (list dir-name "dired.el" "play")) + (dired-insert-subdir (file-name-concat default-directory "play"))))) + (unwind-protect + (progn + (goto-char (point-min)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "lisp" (file-name-nondirectory + (directory-file-name (dired-get-subdir))))) + (should (equal 'dired-hide-details-absolute-location + (get-text-property (match-beginning 1) 'invisible))) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "play" (file-name-nondirectory + (directory-file-name (dired-get-subdir))))) + (should (equal 'dired-hide-details-absolute-location + (get-text-property (match-beginning 1) 'invisible)))) + (kill-buffer buffer)))) + +(ert-deftest dired-test-hide-absolute-location-disabled () + "Test for https://debbugs.gnu.org/72272 ." + (let* ((dired-hide-details-hide-absolute-location nil) + (dir-name (expand-file-name "lisp" source-directory)) + (buffer (prog1 (dired (list dir-name "dired.el" "play")) + (dired-insert-subdir (file-name-concat default-directory "play"))))) + (unwind-protect + (progn + (goto-char (point-min)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "lisp" (file-name-nondirectory + (directory-file-name (dired-get-subdir))))) + (should-not (get-text-property (match-beginning 1) 'invisible)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "play" (file-name-nondirectory + (directory-file-name (dired-get-subdir))))) + (should-not (get-text-property (match-beginning 1) 'invisible))) + (kill-buffer buffer)))) + ;; `dired-insert-directory' output tests. (let* ((data-dir "insert-directory") (test-dir (file-name-as-directory -- 2.39.3 (Apple Git-146) --=-=-=-- From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Aug 2024 08:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alvaro Ramirez Cc: 72272@debbugs.gnu.org, acorallo@gnu.org Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.17238848665986 (code B ref 72272); Sat, 17 Aug 2024 08:55:01 +0000 Received: (at 72272) by debbugs.gnu.org; 17 Aug 2024 08:54:26 +0000 Received: from localhost ([127.0.0.1]:53466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfFCc-0001YU-7f for submit@debbugs.gnu.org; Sat, 17 Aug 2024 04:54:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfFCZ-0001YC-Kf for 72272@debbugs.gnu.org; Sat, 17 Aug 2024 04:54:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sfFBr-00085U-GP; Sat, 17 Aug 2024 04:53:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Y/7FRRMRPYUtId9AGlqSqC0ZPmmJfXlzlHRuzkuGEtE=; b=eqpBCXIAiunc msodc1MYe8DvVk1fS3Eic2GN6rTxj3TMQIXyd4/3p+p/XE0Fvm+mNYOPPVgdw6BiDNzlbr9rGLsJC MXh0v8Yh0XJVnenaoxJmbD6w0JFJqosPAa6csc8szz31IYZYv4Ebos+NkCocxgwCcYVfCbCAQepsk 2nVo5rHfw3I95txsNwPrh0gyahcQo1V1fY36O/0Mp8OZ1hZU5MrxEky0nwkG7fIxabSoZ55pTqg3Q 8vxYZKSRO0psnXbr/kW/hOSky8O/KC24rMN56oyUwhB8JpKGGZozkEzaCGQVV8k5z4UeM9j0fJ8j9 IrrfYqZPH/zsRsSs2/6kHw==; Date: Sat, 17 Aug 2024 11:53:36 +0300 Message-Id: <868qwv4jjj.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Alvaro Ramirez on Mon, 05 Aug 2024 15:34:17 +0100) References: <86plqosoem.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Alvaro Ramirez > Cc: eliz@gnu.org, 72272@debbugs.gnu.org > Date: Mon, 05 Aug 2024 15:34:17 +0100 > > I also modified the patch a little to cater for > `dired-maybe-insert-subdir` (see > https://lists.gnu.org/archive/html/emacs-devel/2024-08/msg00033.html) > and to include a couple of tests. > > May be worth noting, the following dired.el comment seemed > outdated > https://github.com/emacs-mirror/emacs/blob/c7d9cd722e5a7042a52c92f8497f903bfe9870b8/lisp/dired.el#L1805 > > ;; Note that dired-build-subdir-alist will replace the name > ;; by its expansion, so it does not matter whether what we insert > ;; here is fully expanded, but it should be absolute. > > The mentioned replacement doesn't take place when using > `dired-maybe-insert-subdir`, so I tweaked the comment. Setting > invisible property is now needed in two places (to handle current > location and now subdirs). > > Please take a look at the latest patch. Happy to go with a > different direction if preferred. Thanks, this LGTM. However, AFAIU your copyright-assignment paperwork is not yet completed, so we should wait for that, and then we can install. From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Alvaro Ramirez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Aug 2024 09:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 72272@debbugs.gnu.org, copyright-clerk@fsf.org, acorallo@gnu.org Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.17238869209780 (code B ref 72272); Sat, 17 Aug 2024 09:29:01 +0000 Received: (at 72272) by debbugs.gnu.org; 17 Aug 2024 09:28:40 +0000 Received: from localhost ([127.0.0.1]:53500 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfFjj-0002Xg-Jm for submit@debbugs.gnu.org; Sat, 17 Aug 2024 05:28:39 -0400 Received: from out-170.mta0.migadu.com ([91.218.175.170]:59968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfFjh-0002XO-D7 for 72272@debbugs.gnu.org; Sat, 17 Aug 2024 05:28:38 -0400 Content-Type: text/plain; charset=utf-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xenodium.com; s=default; t=1723886841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CmZjhp80UX/zDS7nZAfIRaCmy/nvwAHtQj0uYF2aufw=; b=yp1tcipDQmH04FrDyoFSl2pO2QVL4IpgdpKtNsXsq+Lt2OsyoK4RG6t2O/1c5tMPcDWesr yg3gf13rHjOaxgugm9tB2CGNUicUbPtk3ropeMPb0GeXoWeT2YennnbEAstxlFpnd8FUDM skP5yvtgPQD6/DkWe2gSWA2Aa2VA/WQ= Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Alvaro Ramirez Mime-Version: 1.0 (1.0) Date: Sat, 17 Aug 2024 10:27:08 +0100 Message-Id: <87BEF3AD-A1A3-45A6-8A3E-DEDEAA5583EB@xenodium.com> References: <868qwv4jjj.fsf@gnu.org> In-Reply-To: <868qwv4jjj.fsf@gnu.org> X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On 17 Aug 2024, at 09:53, Eli Zaretskii wrote: >=20 > =EF=BB=BF >>=20 >> From: Alvaro Ramirez >> Cc: eliz@gnu.org, 72272@debbugs.gnu.org >> Date: Mon, 05 Aug 2024 15:34:17 +0100 >>=20 >> I also modified the patch a little to cater for >> `dired-maybe-insert-subdir` (see >> https://lists.gnu.org/archive/html/emacs-devel/2024-08/msg00033.html) >> and to include a couple of tests. >>=20 >> May be worth noting, the following dired.el comment seemed >> outdated >> https://github.com/emacs-mirror/emacs/blob/c7d9cd722e5a7042a52c92f8497f90= 3bfe9870b8/lisp/dired.el#L1805 >>=20 >> ;; Note that dired-build-subdir-alist will replace the name >> ;; by its expansion, so it does not matter whether what we insert >> ;; here is fully expanded, but it should be absolute. >>=20 >> The mentioned replacement doesn't take place when using >> `dired-maybe-insert-subdir`, so I tweaked the comment. Setting >> invisible property is now needed in two places (to handle current >> location and now subdirs). >>=20 >> Please take a look at the latest patch. Happy to go with a >> different direction if preferred. >=20 > Thanks, this LGTM. Thanks Eli! > However, AFAIU your copyright-assignment paperwork > is not yet completed, so we should wait for that, and then we can > install. +copyright-clerk@fsf.org Sounds good. It=E2=80=99s submitted. Waiting for response.=20= From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Alvaro Ramirez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Oct 2024 20:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 72272@debbugs.gnu.org, copyright-clerk@fsf.org, acorallo@gnu.org Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.17278147315139 (code B ref 72272); Tue, 01 Oct 2024 20:33:01 +0000 Received: (at 72272) by debbugs.gnu.org; 1 Oct 2024 20:32:11 +0000 Received: from localhost ([127.0.0.1]:53499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svjXX-0001Kn-2G for submit@debbugs.gnu.org; Tue, 01 Oct 2024 16:32:11 -0400 Received: from out-175.mta0.migadu.com ([91.218.175.175]:13218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svjXV-0001KS-L3 for 72272@debbugs.gnu.org; Tue, 01 Oct 2024 16:32:10 -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=1727814693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=erTHgZduFvR+B0d9XczcG+BSf6hEmlGtattl/K/popE=; b=Ju61MM/TOlblxw1GnJNeAQetWLmIk8PJ8snpac0IBJqhOQujTre8Jodpb6L5V1W1xqWWBo nIo5Su0nceAyclDR4iDt3/uLTMRBg/koFdjHKnRlO23Qk2CBh42ufLq0UXjq6n+kkerTe2 7bxcyrQdnsYpc+56xTElBoudBvH9j78= From: Alvaro Ramirez In-Reply-To: <87BEF3AD-A1A3-45A6-8A3E-DEDEAA5583EB@xenodium.com> (Alvaro Ramirez's message of "Sat, 17 Aug 2024 10:27:08 +0100") References: <868qwv4jjj.fsf@gnu.org> <87BEF3AD-A1A3-45A6-8A3E-DEDEAA5583EB@xenodium.com> Date: Tue, 01 Oct 2024 21:31:29 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Eli >> On 17 Aug 2024, at 09:53, Eli Zaretskii wrote: >> >> Thanks, this LGTM. However, AFAIU your copyright-assignment >> paperwork >> is not yet completed, My copyright-assignment is now approved as of today. > > so we should wait for that, and then we can >> install. Is it Ok to install patch? From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Oct 2024 21:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alvaro Ramirez , Andrea Corallo Cc: eliz@gnu.org, 72272@debbugs.gnu.org Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.172781752912364 (code B ref 72272); Tue, 01 Oct 2024 21:19:01 +0000 Received: (at 72272) by debbugs.gnu.org; 1 Oct 2024 21:18:49 +0000 Received: from localhost ([127.0.0.1]:53738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svkGf-0003DL-0F for submit@debbugs.gnu.org; Tue, 01 Oct 2024 17:18:49 -0400 Received: from mail-wm1-f45.google.com ([209.85.128.45]:44291) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svkGc-0003DD-W9 for 72272@debbugs.gnu.org; Tue, 01 Oct 2024 17:18:47 -0400 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-42cba6cdf32so53161165e9.1 for <72272@debbugs.gnu.org>; Tue, 01 Oct 2024 14:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727817461; x=1728422261; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=PVU8SAWy+W5TNwdk7jZyg4mpc65H52SS9Ue+aVYd8Mk=; b=nVNX5ZNVRtNIkztI/5dl66B0+x5hcOKfn7103GwDRZv6dbLIrmc9xCy0oQERSLO6jM Mm1bMcqLzrD8BmDSVYWGfXBXd1E1hlRtzn1NMy1pWsExciuJpuU9lOO66bXWA1tcblxf 7QEraQ61bKKDP+yG6eRJZ3is4ywWcGSEP2TLUszHuyiFHvReNciBxWkO7gReESOoALEj Y5unQDLDBNC1Cyaok/QcH+SJBHWGfp9Jjz98uhzy+cxsPkY5X/E0dbXz/AG8tT9Zac57 s+lHitWI9J15kNMfaNE+RWiBrkKstSHtTmViIZyfup/YCGz5f1sFZTnE11a7r4wY9Bgj GjIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727817461; x=1728422261; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PVU8SAWy+W5TNwdk7jZyg4mpc65H52SS9Ue+aVYd8Mk=; b=TQZv5oojvGNrN5lunR9u9n/fuyNhgkalI/JDe9/C+L7rkelf/akF94u5U+gurbrarl UfynMb/MRkMaN+nap9VhHygrHIf15edoAaKLWw+D2jg0peq2k1QVAiOA7Q6kiWYB6nk0 +E6SYgmnGr+ygbNumT2Ti6/SvrS9+OuAoZGtNphCrfCxdJx1q2OM/mYc+gfxe+56eyt1 y/f6FfkF+0dcsgD+jAapwaIWecPp0Ws6CxI4VF1SG16DsUY+ujNYNiK4DvagqG8Mj/oH UWLymTsBMx+j+12guIKTiLCVeZtQE1hskrL7llA/jBHnTUYuV/1PMtk83IQYgK0eIfXF 4BUA== X-Forwarded-Encrypted: i=1; AJvYcCXFRtFdihqWZc+LtqBVGKvcBZ4yLidYAHh+yEPWXnNePWvMsIo89dG52g4v1VfsDxoPwJN+0g==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyMA79KITAuHYPNAJx9KZULj3GXH31ofk0d6wFHHpvgcoWUjCJ9 iJ06/dacils0kaOTE3e6qDt8cy6Ob57hytaANfjbDRG0LOwxpPZFIPH7A/HPxiVUDdEP9lU4XLQ YGjPu/vq92hfHX7dhIAigZQLShhE= X-Google-Smtp-Source: AGHT+IFbAw7dU7KvTNMd4Cs30wCZkuBJKK7V4/9sLWlZL1XlH0STowHq0cw4S9nrqwgn5Ulyg3AtZKI5gg3w7nQK1xU= X-Received: by 2002:a05:6000:2ac:b0:37c:cf72:f248 with SMTP id ffacd0b85a97d-37cfba183b0mr766617f8f.50.1727817461097; Tue, 01 Oct 2024 14:17:41 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 1 Oct 2024 21:17:40 +0000 From: Stefan Kangas In-Reply-To: References: <86plqosoem.fsf@gnu.org> MIME-Version: 1.0 Date: Tue, 1 Oct 2024 21:17:40 +0000 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alvaro Ramirez writes: > +** Dired > + > ++++ > +*** New option 'dired-hide-details-hide-absolute-location', enabled by default. > +If non-nil, 'dired-hide-details-mode' also hides directories' absolute locations. I don't understand what this does, based on this description. Could this please be expanded to explain this in more concrete terms? It also seems like this is not wrapped to 72 characters, so please amend that as well. I think the header could be shortened by removing the "enabled by default" part. However, if we are talking about hiding the directory in the first line, i.e. here: /home/nisse: then I think this should better be _off_ by default. From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Alvaro Ramirez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Oct 2024 10:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: 72272@debbugs.gnu.org, eliz@gnu.org, Andrea Corallo Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.17278665211101 (code B ref 72272); Wed, 02 Oct 2024 10:56:01 +0000 Received: (at 72272) by debbugs.gnu.org; 2 Oct 2024 10:55:21 +0000 Received: from localhost ([127.0.0.1]:56739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svx0r-0000He-5W for submit@debbugs.gnu.org; Wed, 02 Oct 2024 06:55:21 -0400 Received: from out-182.mta0.migadu.com ([91.218.175.182]:14011) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svx0p-0000HK-0F for 72272@debbugs.gnu.org; Wed, 02 Oct 2024 06:55:19 -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=1727866512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hlQJXhlXdop22CNvcHB3SDBING/W5Rujdh8Uuk/M76U=; b=MdgkLDIgJd5BqEZoxPPTfebmXfYaeUpnibpnZrYdW3H7Ru15UdJXS97kOQqgs02LovGEHT J56x4+vpUYkDdye/rvHKnHRapG6lenebZvQNliCrYCPgR+GYHQkrzi9zD69cAxW0HygnSW nXMQW0qo1ziH90cQC0QdXAGvg2uU22U= From: Alvaro Ramirez In-Reply-To: (Stefan Kangas's message of "Tue, 1 Oct 2024 21:17:40 +0000") References: <86plqosoem.fsf@gnu.org> Date: Wed, 02 Oct 2024 11:55:09 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; format=flowed Thanks for the comments Stefan! Stefan Kangas writes: > Alvaro Ramirez writes: > >> +** Dired >> + >> ++++ >> +*** New option 'dired-hide-details-hide-absolute-location', >> enabled by default. >> +If non-nil, 'dired-hide-details-mode' also hides directories' >> absolute locations. > > I don't understand what this does, based on this description. > Could > this please be expanded to explain this in more concrete terms? Updated in patch. Hope that's clearer. > > It also seems like this is not wrapped to 72 characters, so > please amend > that as well. I think the header could be shortened by removing > the > "enabled by default" part. Ah, thanks for spotting. Updated patch. > > However, if we are talking about hiding the directory in the > first line, > i.e. here: > > /home/nisse: Included a with/without sample in the NEWS for clarity. > > then I think this should better be _off_ by default. Any chance we can consider on by default? If folks aren't enabling dired-hide-details-mode, then this feature is technically already off by default. I'm thinking for those who do use dired-hide-details-mode, there's possibly a likelihood they may want to hide this detail also. --=-=-= Content-Type: text/x-patch; charset=utf-8; size=8.14KiB Content-Disposition: attachment; filename=0001-Hide-default-directory-absolute-location-via-dired-h.patch Content-Transfer-Encoding: quoted-printable >From 54b865a182e7df2862d2e691b4d15a02dd1a4c48 Mon Sep 17 00:00:00 2001 From: =C3=81lvaro Ram=C3=ADrez Date: Wed, 2 Oct 2024 11:36:57 +0100 Subject: [PATCH] Hide default-directory absolute location via dired-hide-details-mode --- etc/NEWS | 14 ++++++++++++ lisp/dired.el | 47 ++++++++++++++++++++++++++++++++-------- test/lisp/dired-tests.el | 44 +++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 9 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index abe316547aa..c78c0922bbf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -426,6 +426,20 @@ fontifying them, which can be slow for remote director= ies. Setting 'dired-check-symlinks' to nil disables these checks. Defaults to t, can be set as a connection-local variable. =20 ++++ +*** New user option 'dired-hide-details-hide-absolute-location' +When dired's 'dired-hide-details-mode' is enabled, also hide the +'default-directory' absolute location, typically displayed as the first +line in a dired buffer. Enabled by default. + +With dired-hide-details-hide-absolute-location: + + project: (100 GiB available) + +Without dired-hide-details-hide-absolute-location: + + /absolute/path/to/my/important/project: (100 GiB available) + ** Grep =20 +++ diff --git a/lisp/dired.el b/lisp/dired.el index 2bf5a221f4e..c5a62c1a68d 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -387,6 +387,12 @@ dired-hide-details-hide-information-lines :version "24.4" :group 'dired) =20 +(defcustom dired-hide-details-hide-absolute-location t + "Non-nil means `dired-hide-details-mode' hides directory absolute locati= on." + :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 @@ -1816,12 +1822,20 @@ dired-insert-directory (when (and (or hdr wildcard) (not (and (looking-at "^ \\(.*\\):$") (file-name-absolute-p (match-string 1))))) - ;; Note that dired-build-subdir-alist will replace the name - ;; by its expansion, so it does not matter whether what we insert - ;; here is fully expanded, but it should be absolute. - (insert " " (or (car-safe dir-wildcard) - (directory-file-name (file-name-directory dir= ))) - ":\n") + (let* ((dir-indent " ") + (dir-name (or (car-safe dir-wildcard) + (directory-file-name (file-name-directory= dir)))) + (dir-name-point (+ (point) (length dir-indent))) + (hideable-location (and dired-hide-details-hide-absolut= e-location + (not (string-empty-p (file-name= -nondirectory dir-name)))))) + ;; Inserted directory name must be absolute, but keep in mind it + ;; may be replaced in some instances (e.g. dired-build-subdi= r-alist). + (insert dir-indent dir-name ":\n") + (when hideable-location + (put-text-property dir-name-point + (+ dir-name-point + (length (file-name-directory dir-nam= e))) + 'invisible 'dired-hide-details-absolute= -location))) (setq content-point (point))) (when wildcard ;; Insert "wildcard" line where "total" line would be for a full dir. @@ -3257,8 +3271,9 @@ dired-hide-details-mode When this minor mode is enabled, details such as file ownership and permissions are hidden from view. =20 -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")) @@ -3282,6 +3297,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))) @@ -3688,7 +3708,16 @@ 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)) + (let ((new-dir-name-pos (point)) + (hideable-location (and dired-hide-details-hide-absolute= -location + (not (string-empty-p + (file-name-nondirectory ne= w-dir-name)))))) + (insert new-dir-name) + (when hideable-location + (put-text-property new-dir-name-pos + (+ new-dir-name-pos + (length (file-name-directory new-dir= -name))) + 'invisible 'dired-hide-details-absolute-location)))) (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 \. diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 3b1f80d3d3d..be0a8a36d84 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -524,7 +524,50 @@ dired-test-directory-files-and-attributes (when (file-directory-p testdir) (delete-directory testdir t))))) =20 +(ert-deftest dired-test-hide-absolute-location-enabled () + "Test for https://debbugs.gnu.org/72272 ." + (let* ((dired-hide-details-hide-absolute-location t) + (dir-name (expand-file-name "lisp" source-directory)) + (buffer (prog1 (dired (list dir-name "dired.el" "play")) + (dired-insert-subdir (file-name-concat default-director= y "play"))))) + (unwind-protect + (progn + (goto-char (point-min)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "lisp" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should (equal 'dired-hide-details-absolute-location + (get-text-property (match-beginning 1) 'invisible= ))) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "play" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should (equal 'dired-hide-details-absolute-location + (get-text-property (match-beginning 1) 'invisible= )))) + (kill-buffer buffer)))) + +(ert-deftest dired-test-hide-absolute-location-disabled () + "Test for https://debbugs.gnu.org/72272 ." + (let* ((dired-hide-details-hide-absolute-location nil) + (dir-name (expand-file-name "lisp" source-directory)) + (buffer (prog1 (dired (list dir-name "dired.el" "play")) + (dired-insert-subdir (file-name-concat default-director= y "play"))))) + (unwind-protect + (progn + (goto-char (point-min)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "lisp" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should-not (get-text-property (match-beginning 1) 'invisible)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "play" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should-not (get-text-property (match-beginning 1) 'invisible))) + (kill-buffer buffer)))) + ;; `dired-insert-directory' output tests. (let* ((data-dir "insert-directory") (test-dir (file-name-as-directory -- 2.39.5 (Apple Git-154) --=-=-=-- From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Oct 2024 21:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alvaro Ramirez Cc: 72272@debbugs.gnu.org, eliz@gnu.org, Andrea Corallo Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.172790481410237 (code B ref 72272); Wed, 02 Oct 2024 21:34:01 +0000 Received: (at 72272) by debbugs.gnu.org; 2 Oct 2024 21:33:34 +0000 Received: from localhost ([127.0.0.1]:59408 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sw6yT-0002f2-JM for submit@debbugs.gnu.org; Wed, 02 Oct 2024 17:33:33 -0400 Received: from mail-ed1-f54.google.com ([209.85.208.54]:52260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sw6yR-0002ep-Hx for 72272@debbugs.gnu.org; Wed, 02 Oct 2024 17:33:32 -0400 Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-5c42f406fa5so111349a12.0 for <72272@debbugs.gnu.org>; Wed, 02 Oct 2024 14:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727904745; x=1728509545; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=qZYegWpjtBk+2pMre4sFQTIGhK2jRCapiBcY1r9Ktus=; b=N7F00DMhrFG4GkDR2QUMo/sPnHaKE4KqdFZXzr/AtzczjC8BYAcuymRLqlAcTkjt8k c+tB4p2y4pCYhH4+y5fEOJv2fNlRm29fN8IYEdisqBOyJUbfeN7ko/kzuFHbrMl2XoyW wCrhYqnvNxJbV1aDN+qGViiTAtg6u9oTl4lytfKDozvDRoffXPVbVDnME3yx627DTGGR UFVfc4V754Ubfu0Hsz/PWCnYQJUg4X7byALci7eW5lmTotFIt6l5qoWDhyMXRWQFtvwo 35ltzUnXMWyDiV68iNSDbOOtJ21MYssRkh9/vCEqD8OUmCx2oLlWt3M695vigH1FFTxv VmOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727904745; x=1728509545; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qZYegWpjtBk+2pMre4sFQTIGhK2jRCapiBcY1r9Ktus=; b=LfsN2ERgVRXVl5DeyUMSCwTd1onmOUyMhZuqSDxGkhbHXSc10c0sJI7CpeorjcSJW7 aM0LVNSWJ5bfrk9R8eMtynIZhPxTLNKTXusVe+ECzvMOt2j+NSosuxNHlpaMOhvMCAs0 yGgYLZxcecAWowP/SUIxpUnBay4yepPCnDGjq8Ib67fct+d7c6nbkkBP8uAg0bqtvH0u 9cyzAtV0w9rDNU/ie0w1CxXo5Px4Tnnz1xeArf+0J19QkZZFlyPhYRtFLOzYC9H0YgXB y5E+fjcy+Ckg1011aIoULekxUu0kqFtJc/uMCSoaBRS4pS6JXwqePMt/fDI1Xl+YmLCx SmRg== X-Forwarded-Encrypted: i=1; AJvYcCX7t5yDweHDmjVreCiZeKUmctqd/NyGjSKVsvWoVX7NpZPlLdLQWHjDrNJvkmxAFKeC9f1fJw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwXgKjuXDLJBnKGjsnzL/TJl2dWI/A9rnIznc7+p7E6q9003Y6I TonbpCGpazw4pYxrKmgKoocTJoYFZFi7s7dmzx8qSZYJ00B2kxev4L23d8ttJ8Lufo/qIYiytpT wQGQdSW2C9BZrfyGtB73GjndhMqA= X-Google-Smtp-Source: AGHT+IHWNZTfFr8jb4da12YNF6Is9z78SBrIqnyRSLts1cN6E47Swy5b32Y2TqAhU3yxS9/zPkxBvzu99nvD2SljSeo= X-Received: by 2002:a05:6402:5194:b0:5c8:c039:b418 with SMTP id 4fb4d7f45d1cf-5c8c039b467mr1261846a12.25.1727904744676; Wed, 02 Oct 2024 14:32:24 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 2 Oct 2024 21:32:24 +0000 From: Stefan Kangas In-Reply-To: References: <86plqosoem.fsf@gnu.org> MIME-Version: 1.0 Date: Wed, 2 Oct 2024 21:32:24 +0000 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alvaro Ramirez writes: > Included a with/without sample in the NEWS for clarity. Thanks. > Any chance we can consider on by default? If folks aren't enabling > dired-hide-details-mode, then this feature is technically already > off by default. I'm thinking for those who do use > dired-hide-details-mode, there's possibly a likelihood they may > want to hide this detail also. I always use `dired-hide-details-mode', and I definitely would _not_ want this feature on. It doesn't help and makes Dired much less useful for me. That's only one data point, of course. But given that we're usually pretty conservative with changing the defaults, I recommend adding this as an optional feature at first. If it picks up in popularity, we could always reconsider later. From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Alvaro Ramirez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Oct 2024 08:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: 72272@debbugs.gnu.org, eliz@gnu.org, Andrea Corallo Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.172794368018075 (code B ref 72272); Thu, 03 Oct 2024 08:22:02 +0000 Received: (at 72272) by debbugs.gnu.org; 3 Oct 2024 08:21:20 +0000 Received: from localhost ([127.0.0.1]:59960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swH5H-0004hM-Dl for submit@debbugs.gnu.org; Thu, 03 Oct 2024 04:21:20 -0400 Received: from out-184.mta1.migadu.com ([95.215.58.184]:24634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swH3f-0004W6-Vi for 72272@debbugs.gnu.org; Thu, 03 Oct 2024 04:21:13 -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=1727943555; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wE3VIxvDkctrjq7ye8jzmlNAlySzbewlZCZOAHq/coU=; b=O16FgkKiu4qKlsqLFU5T2PlVPeMuRE7IUYLXI3zQeMoB9HXm1Cr9A8t84NEcgYFa+HcsYo YvMWQK5Di/Mc2jMRrPji64ivHdumyPPAlnFRzbZvAn3mx0kjEb7rrvo0xGySOdBiCmzHMC aRvqfmbzIGCWWCJyDEapAVvAor4/ETM= From: Alvaro Ramirez In-Reply-To: (Stefan Kangas's message of "Wed, 2 Oct 2024 21:32:24 +0000") References: <86plqosoem.fsf@gnu.org> Date: Thu, 03 Oct 2024 09:19:12 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; format=flowed Stefan Kangas writes: > Alvaro Ramirez writes: > >> Included a with/without sample in the NEWS for clarity. > > Thanks. > >> Any chance we can consider on by default? If folks aren't >> enabling >> dired-hide-details-mode, then this feature is technically >> already >> off by default. I'm thinking for those who do use >> dired-hide-details-mode, there's possibly a likelihood they may >> want to hide this detail also. > > I always use `dired-hide-details-mode', and I definitely would > _not_ > want this feature on. It doesn't help and makes Dired much less > useful > for me. That's only one data point, of course. Ah interesting. Strangely, I haven't really missed always knowing the full path. If I need it, I can quickly toggle via "(" binding. Then again, I'm also only one data point. Maybe give the setting a try? Might grow on you ;) In any case, off by default it is. Updated the patch. > > But given that we're usually pretty conservative with changing > the > defaults, I recommend adding this as an optional feature at > first. YuYup. The feature remains optional (it's got its own boolean setting). Off by default now. > If it picks up in popularity, we could always reconsider later. Sounds good. Is there an emacs-devel/maintainers preferred method to determine settings popularity? Out --=-=-= Content-Type: text/x-patch; charset=utf-8; size=8.12KiB Content-Disposition: attachment; filename=0001-Hide-default-directory-absolute-location-via-dired-h.patch Content-Transfer-Encoding: quoted-printable >From 24137250336e9f9c3af9c496436e1c8a69361076 Mon Sep 17 00:00:00 2001 From: =C3=81lvaro Ram=C3=ADrez Date: Wed, 2 Oct 2024 11:36:57 +0100 Subject: [PATCH] Hide default-directory absolute location via dired-hide-details-mode --- etc/NEWS | 14 ++++++++++++ lisp/dired.el | 47 ++++++++++++++++++++++++++++++++-------- test/lisp/dired-tests.el | 44 +++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 9 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index abe316547aa..52dd73abe02 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -426,6 +426,20 @@ fontifying them, which can be slow for remote director= ies. Setting 'dired-check-symlinks' to nil disables these checks. Defaults to t, can be set as a connection-local variable. =20 ++++ +*** New user option 'dired-hide-details-hide-absolute-location' +When dired's 'dired-hide-details-mode' is enabled, also hide the +'default-directory' absolute location, typically displayed as the first +line in a dired buffer. + +With dired-hide-details-hide-absolute-location: + + project: (100 GiB available) + +Without dired-hide-details-hide-absolute-location: + + /absolute/path/to/my/important/project: (100 GiB available) + ** Grep =20 +++ diff --git a/lisp/dired.el b/lisp/dired.el index 2bf5a221f4e..a2b1c065d0b 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -387,6 +387,12 @@ dired-hide-details-hide-information-lines :version "24.4" :group 'dired) =20 +(defcustom dired-hide-details-hide-absolute-location nil + "Non-nil means `dired-hide-details-mode' hides directory absolute locati= on." + :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 @@ -1816,12 +1822,20 @@ dired-insert-directory (when (and (or hdr wildcard) (not (and (looking-at "^ \\(.*\\):$") (file-name-absolute-p (match-string 1))))) - ;; Note that dired-build-subdir-alist will replace the name - ;; by its expansion, so it does not matter whether what we insert - ;; here is fully expanded, but it should be absolute. - (insert " " (or (car-safe dir-wildcard) - (directory-file-name (file-name-directory dir= ))) - ":\n") + (let* ((dir-indent " ") + (dir-name (or (car-safe dir-wildcard) + (directory-file-name (file-name-directory= dir)))) + (dir-name-point (+ (point) (length dir-indent))) + (hideable-location (and dired-hide-details-hide-absolut= e-location + (not (string-empty-p (file-name= -nondirectory dir-name)))))) + ;; Inserted directory name must be absolute, but keep in mind it + ;; may be replaced in some instances (e.g. dired-build-subdi= r-alist). + (insert dir-indent dir-name ":\n") + (when hideable-location + (put-text-property dir-name-point + (+ dir-name-point + (length (file-name-directory dir-nam= e))) + 'invisible 'dired-hide-details-absolute= -location))) (setq content-point (point))) (when wildcard ;; Insert "wildcard" line where "total" line would be for a full dir. @@ -3257,8 +3271,9 @@ dired-hide-details-mode When this minor mode is enabled, details such as file ownership and permissions are hidden from view. =20 -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")) @@ -3282,6 +3297,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))) @@ -3688,7 +3708,16 @@ 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)) + (let ((new-dir-name-pos (point)) + (hideable-location (and dired-hide-details-hide-absolute= -location + (not (string-empty-p + (file-name-nondirectory ne= w-dir-name)))))) + (insert new-dir-name) + (when hideable-location + (put-text-property new-dir-name-pos + (+ new-dir-name-pos + (length (file-name-directory new-dir= -name))) + 'invisible 'dired-hide-details-absolute-location)))) (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 \. diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 3b1f80d3d3d..be0a8a36d84 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -524,7 +524,50 @@ dired-test-directory-files-and-attributes (when (file-directory-p testdir) (delete-directory testdir t))))) =20 +(ert-deftest dired-test-hide-absolute-location-enabled () + "Test for https://debbugs.gnu.org/72272 ." + (let* ((dired-hide-details-hide-absolute-location t) + (dir-name (expand-file-name "lisp" source-directory)) + (buffer (prog1 (dired (list dir-name "dired.el" "play")) + (dired-insert-subdir (file-name-concat default-director= y "play"))))) + (unwind-protect + (progn + (goto-char (point-min)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "lisp" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should (equal 'dired-hide-details-absolute-location + (get-text-property (match-beginning 1) 'invisible= ))) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "play" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should (equal 'dired-hide-details-absolute-location + (get-text-property (match-beginning 1) 'invisible= )))) + (kill-buffer buffer)))) + +(ert-deftest dired-test-hide-absolute-location-disabled () + "Test for https://debbugs.gnu.org/72272 ." + (let* ((dired-hide-details-hide-absolute-location nil) + (dir-name (expand-file-name "lisp" source-directory)) + (buffer (prog1 (dired (list dir-name "dired.el" "play")) + (dired-insert-subdir (file-name-concat default-director= y "play"))))) + (unwind-protect + (progn + (goto-char (point-min)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "lisp" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should-not (get-text-property (match-beginning 1) 'invisible)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "play" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should-not (get-text-property (match-beginning 1) 'invisible))) + (kill-buffer buffer)))) + ;; `dired-insert-directory' output tests. (let* ((data-dir "insert-directory") (test-dir (file-name-as-directory -- 2.39.5 (Apple Git-154) --=-=-=-- From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Alvaro Ramirez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Oct 2024 08:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: 72272@debbugs.gnu.org, eliz@gnu.org, Andrea Corallo Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.172794388318400 (code B ref 72272); Thu, 03 Oct 2024 08:25:01 +0000 Received: (at 72272) by debbugs.gnu.org; 3 Oct 2024 08:24:43 +0000 Received: from localhost ([127.0.0.1]:59966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swH8W-0004mV-GM for submit@debbugs.gnu.org; Thu, 03 Oct 2024 04:24:43 -0400 Received: from out-175.mta0.migadu.com ([91.218.175.175]:22914) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swH7s-0004lJ-10 for 72272@debbugs.gnu.org; Thu, 03 Oct 2024 04:24:33 -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=1727943791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=e8IIUtt1/TM6odbzuTBsO1sOh3MbRKFnDQB/w/fK4sA=; b=Bqi/9q7xLcwGMl+edhRTS/VCGilBWkzi3rA2SIgHnt64ZILreBCvt5Z4I0hKD1kp/BZLDk tNknwSibWxcXtCbZN32LCq18T+dqo6xxQSAbzKNOfI4OzkVFBt4vBXKI4GPoklj1DFCKMY Z0Vq7ShERpd2ipSGheoU2GeVQWDMXes= From: Alvaro Ramirez In-Reply-To: (Alvaro Ramirez's message of "Thu, 03 Oct 2024 09:19:12 +0100") References: <86plqosoem.fsf@gnu.org> Date: Thu, 03 Oct 2024 09:23:09 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alvaro Ramirez writes: > YuYup > Out Sorry. Typos :/ From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Oct 2024 14:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: Andrea Corallo , Alvaro Ramirez , 72272@debbugs.gnu.org, eliz@gnu.org Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.17279675042076 (code B ref 72272); Thu, 03 Oct 2024 14:59:01 +0000 Received: (at 72272) by debbugs.gnu.org; 3 Oct 2024 14:58:24 +0000 Received: from localhost ([127.0.0.1]:33714 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swNHb-0000XP-VE for submit@debbugs.gnu.org; Thu, 03 Oct 2024 10:58:24 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:57436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swNHZ-0000X8-N7 for 72272@debbugs.gnu.org; Thu, 03 Oct 2024 10:58:22 -0400 Received: by mail-pl1-f194.google.com with SMTP id d9443c01a7336-207115e3056so9290375ad.2 for <72272@debbugs.gnu.org>; Thu, 03 Oct 2024 07:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727967434; x=1728572234; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E9OD4NHluv1JVTID5rFfWgRXcF7JAsop3kMRVROX7Vk=; b=TWjgvjqEC57uxMbSEj7QDf1v9kA6iddruL9JTxfNa+qo+9P1Mba6iOVKN7AUsxAqZd iIqKg03qWI3COVNl4d2K/yBQADUImKbrKg9cgq/B9Xe7GpANJjCxAr/5bV4Sr2YtP1KX Hs9ZXKH2KYB4xdjKAnir3qHRSmhVKBuX2/qdtR2UgNXqboW5rfgjmDzyYnGnH3XvQydQ dYrfFIdS5+DjfH8Bw6cquemELtQU1VYz1hrXKFoeFsCiSP1THNkYYhg5C2j6QgQRtMKD 2ZNQD3S10IluQm9A+6Ctw6MlI9SYxn4+q5joCJDVyCyf6dvnFuAMN7NZ8e2TUXXfmARY s5iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727967434; x=1728572234; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=E9OD4NHluv1JVTID5rFfWgRXcF7JAsop3kMRVROX7Vk=; b=QYtmoQHPp2PrjLm6XnUlrWNgtuVXAGyv4tYLD6Kruc6v24C6l+k34BLb7ct6TbK6pS vuI2N+q5sypi4/UrXAiXq99YObWH+7+7n9vn96gNjiLX4GB8YXZSBGpB8jre/hq2v1Qr FnFq3Y/kD7NS2IhCuOfeWhVpyKGAWk0gXxphO2FB7SeD2LeL8NBcszIalTf1IZ6JTMoy zLvdSuWb01gjV3W7JN5xJEtOEgxwkZ5bTSjVFP7bf5aMKmPheTOBLJvgw1G/RsndwWma a4rWvrWZLXVxRwOM4YQO/xyRsD/1HOx0G7QY7LgaKqXbWTrelTwiBZArAYy2EHGiBdyr x4yA== X-Forwarded-Encrypted: i=1; AJvYcCUSRDhSEOmnXOo4q3NHECR61DgH7+NxbUA++MdEbT7fioOk32IzXIle1XxqRYtq6HsUO8Tfgg==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yx63TTSJ+/UL6c/JtaOVqLxbjupdhelxkWZuxrctFqjtyhG9Cih MnAijX7riTL13YYzZ1Ytoz2eULrZMzYXni9VAyXCt/Puy1GOnM1HsIGkX7Qg X-Google-Smtp-Source: AGHT+IHunbN+C6LqRlTHMWIdQksZFY6CjXv7DkgEs8YrVKqLBnxjXSVVXBgMDOvPYrbVH94yzmEt8Q== X-Received: by 2002:a17:902:c40a:b0:1fb:68a2:a948 with SMTP id d9443c01a7336-20bc59e5d6cmr106354975ad.15.1727967434099; Thu, 03 Oct 2024 07:57:14 -0700 (PDT) Received: from localhost ([1.7.159.70]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20beead2938sm10111995ad.11.2024.10.03.07.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 07:57:13 -0700 (PDT) From: Visuwesh In-Reply-To: (Stefan Kangas's message of "Wed, 2 Oct 2024 21:32:24 +0000") References: <86plqosoem.fsf@gnu.org> Date: Thu, 03 Oct 2024 20:27:10 +0530 Message-ID: <87h69tcjzt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 3.6 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: =?UTF-8?Q?[=E0=AE=AA=E0=AF=81=E0=AE=A4=E0=AE=A9=E0=AF=8D_?= =?UTF-8?Q?=E0=AE=85=E0=AE=95=E0=AF=8D=E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D?= 02, 2024] Stefan Kangas wrote: > Alvaro Ramirez writes: > >> Included a with/without sample in the NEWS for clarity. > > Thanks. > >> Any chance we can consider on by default? If folks aren't enabling >> dired-hide-details-mode, [...] Content analysis details: (3.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [209.85.214.194 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [209.85.214.194 listed in sa-accredit.habeas.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.214.194 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (visuweshm[at]gmail.com) 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.214.194 listed in wl.mailspike.net] 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [1.7.159.70 listed in zen.spamhaus.org] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.6 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: =?UTF-8?Q?[=E0=AE=AA=E0=AF=81=E0=AE=A4=E0=AE=A9=E0=AF=8D_?= =?UTF-8?Q?=E0=AE=85=E0=AE=95=E0=AF=8D=E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D?= 02, 2024] Stefan Kangas wrote: > Alvaro Ramirez writes: > >> Included a with/without sample in the NEWS for clarity. > > Thanks. > >> Any chance we can consider on by default? If folks aren't enabling >> dired-hide-details-mode, [...] Content analysis details: (2.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.214.194 listed in wl.mailspike.net] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [209.85.214.194 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [209.85.214.194 listed in bl.score.senderscore.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.214.194 listed in list.dnswl.org] 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [1.7.159.70 listed in zen.spamhaus.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (visuweshm[at]gmail.com) 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager [=E0=AE=AA=E0=AF=81=E0=AE=A4=E0=AE=A9=E0=AF=8D =E0=AE=85=E0=AE=95=E0=AF=8D= =E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D 02, 2024] Stefan Kangas wrote: > Alvaro Ramirez writes: > >> Included a with/without sample in the NEWS for clarity. > > Thanks. > >> Any chance we can consider on by default? If folks aren't enabling >> dired-hide-details-mode, then this feature is technically already >> off by default. I'm thinking for those who do use >> dired-hide-details-mode, there's possibly a likelihood they may >> want to hide this detail also. > > I always use `dired-hide-details-mode', and I definitely would _not_ > want this feature on. It doesn't help and makes Dired much less useful > for me. That's only one data point, of course. If the full filename is hidden, then one cannot easily go to the parent directory by clicking on the filename component. This is a rather useful feature when one is already using the mouse. To add on to your data point, I have many similarly named directories in different parents. Just looking at the uniquifier inside the <> of the buffer's name does not help since I cannot immediately recognise the parent directory from it. > But given that we're usually pretty conservative with changing the > defaults, I recommend adding this as an optional feature at first. > If it picks up in popularity, we could always reconsider later. From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Alvaro Ramirez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Oct 2024 17:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Visuwesh Cc: Andrea Corallo , eliz@gnu.org, 72272@debbugs.gnu.org, Stefan Kangas Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.17279775435283 (code B ref 72272); Thu, 03 Oct 2024 17:46:01 +0000 Received: (at 72272) by debbugs.gnu.org; 3 Oct 2024 17:45:43 +0000 Received: from localhost ([127.0.0.1]:33839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swPtX-0001N8-27 for submit@debbugs.gnu.org; Thu, 03 Oct 2024 13:45:43 -0400 Received: from out-176.mta1.migadu.com ([95.215.58.176]:25916) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swPtU-0001Ms-V4 for 72272@debbugs.gnu.org; Thu, 03 Oct 2024 13:45:41 -0400 Content-Type: text/plain; charset=utf-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xenodium.com; s=default; t=1727977502; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mv7gkK5iWeMeZ2aiMICe22ulOP7ftkJSSSA8BWwDdck=; b=YTKo67SR0YXxI97GWuyvoGtmy5JdoRa9x3xkwbMdLMI0uBOt7kGMqxxJxSzUAMphO99Dex vr12LwD+xcGy8ONtC/3p561/w35dmzhhE6qMDT2kJ4vZbls7eiyKDhKr+sLrPoxUDrqob3 d08BMESYWLuc3uVNm2oklDaBxOjYHzg= Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Alvaro Ramirez Mime-Version: 1.0 (1.0) Date: Thu, 3 Oct 2024 18:37:14 +0100 Message-Id: <975D6937-9E65-4E53-92E5-D9785D0A1932@xenodium.com> References: <87h69tcjzt.fsf@gmail.com> In-Reply-To: <87h69tcjzt.fsf@gmail.com> X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > On 3 Oct 2024, at 15:57, Visuwesh wrote: >=20 > =EF=BB=BF[=E0=AE=AA=E0=AF=81=E0=AE=A4=E0=AE=A9=E0=AF=8D =E0=AE=85=E0=AE=95= =E0=AF=8D=E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D 02, 2024] Stefan Kang= as wrote: >=20 >> Alvaro Ramirez writes: >>=20 >>> Included a with/without sample in the NEWS for clarity. >>=20 >> Thanks. >>=20 >>> Any chance we can consider on by default? If folks aren't enabling >>> dired-hide-details-mode, then this feature is technically already >>> off by default. I'm thinking for those who do use >>> dired-hide-details-mode, there's possibly a likelihood they may >>> want to hide this detail also. >>=20 >> I always use `dired-hide-details-mode', and I definitely would _not_ >> want this feature on. It doesn't help and makes Dired much less useful >> for me. That's only one data point, of course. >=20 > If the full filename is hidden, then one cannot easily go to the parent > directory by clicking on the filename component. This is a rather > useful feature when one is already using the mouse. Neat. TIL about this mouse flow. Thanks! I typically C-x C-f to visit parent= s. > To add on to your data point, I have many similarly named directories in > different parents. Just looking at the uniquifier inside the <> of the > buffer's name does not help since I cannot immediately recognise the > parent directory from it. Your use cases are safe. The feature is setting-guarded, and now off by defa= ult. In the event you do enable it, toggling dired-hide-details-mode via =E2= =80=9C(=E2=80=9C binding can quickly expose the current location=E2=80=99s a= bsolute path. >> But given that we're usually pretty conservative with changing the >> defaults, I recommend adding this as an optional feature at first. >> If it picks up in popularity, we could always reconsider later. From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Alvaro Ramirez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Oct 2024 17:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas , eliz@gnu.org Cc: Andrea Corallo , 72272@debbugs.gnu.org, Visuwesh Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.172849512816443 (code B ref 72272); Wed, 09 Oct 2024 17:33:01 +0000 Received: (at 72272) by debbugs.gnu.org; 9 Oct 2024 17:32:08 +0000 Received: from localhost ([127.0.0.1]:57531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1syaXf-0004H8-Lx for submit@debbugs.gnu.org; Wed, 09 Oct 2024 13:32:08 -0400 Received: from out-178.mta0.migadu.com ([91.218.175.178]:14327) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1syaXd-0004GX-9h for 72272@debbugs.gnu.org; Wed, 09 Oct 2024 13:32:06 -0400 Content-Type: text/plain; charset=utf-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xenodium.com; s=default; t=1728495108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q27YYBv5vfjVKnjZd9gCg9bjzKALMfe10GIXCE/ohMM=; b=vwHNRAAQbU4uNxnvMKvKVLlzAGHGvSaKHdtk5YQaMytlBjE6QjwGEf0n9pG6nfpGjFDwI9 1ZrphqnmOS9YQjCMJAwn2auBpMEvXvWdlnIlc5hztxkiedRIPm3XHTALkCNhRU2aKmrgfz VgboNyYcEyk8GPS1Oz0PeuIHyUJyFHA= Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Alvaro Ramirez Mime-Version: 1.0 (1.0) Date: Wed, 9 Oct 2024 18:31:35 +0100 Message-Id: References: <975D6937-9E65-4E53-92E5-D9785D0A1932@xenodium.com> In-Reply-To: <975D6937-9E65-4E53-92E5-D9785D0A1932@xenodium.com> X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Eli / Stefan With the latest patch disabling the feature by default, is it good to apply?= Cheers, Alvaro=20 >=20 > On 3 Oct 2024, at 18:37, Alvaro Ramirez wrote: >=20 > =EF=BB=BF >>> On 3 Oct 2024, at 15:57, Visuwesh wrote: >>>=20 >>> =EF=BB=BF[=E0=AE=AA=E0=AF=81=E0=AE=A4=E0=AE=A9=E0=AF=8D =E0=AE=85=E0=AE=95= =E0=AF=8D=E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D 02, 2024] Stefan Kang= as wrote: >>>=20 >>> Alvaro Ramirez writes: >>>=20 >>>> Included a with/without sample in the NEWS for clarity. >>>=20 >>> Thanks. >>>=20 >>>> Any chance we can consider on by default? If folks aren't enabling >>>> dired-hide-details-mode, then this feature is technically already >>>> off by default. I'm thinking for those who do use >>>> dired-hide-details-mode, there's possibly a likelihood they may >>>> want to hide this detail also. >>>=20 >>> I always use `dired-hide-details-mode', and I definitely would _not_ >>> want this feature on. It doesn't help and makes Dired much less useful >>> for me. That's only one data point, of course. >>=20 >> If the full filename is hidden, then one cannot easily go to the parent >> directory by clicking on the filename component. This is a rather >> useful feature when one is already using the mouse. >=20 > Neat. TIL about this mouse flow. Thanks! I typically C-x C-f to visit pare= nts. >=20 >> To add on to your data point, I have many similarly named directories in >> different parents. Just looking at the uniquifier inside the <> of the >> buffer's name does not help since I cannot immediately recognise the >> parent directory from it. >=20 > Your use cases are safe. The feature is setting-guarded, and now off by de= fault. In the event you do enable it, toggling dired-hide-details-mode via =E2= =80=9C(=E2=80=9C binding can quickly expose the current location=E2=80=99s a= bsolute path. >=20 >>> But given that we're usually pretty conservative with changing the >>> defaults, I recommend adding this as an optional feature at first. >>> If it picks up in popularity, we could always reconsider later. From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Oct 2024 11:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alvaro Ramirez Cc: acorallo@gnu.org, 72272@debbugs.gnu.org, stefankangas@gmail.com, visuweshm@gmail.com Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.172873285629902 (code B ref 72272); Sat, 12 Oct 2024 11:35:02 +0000 Received: (at 72272) by debbugs.gnu.org; 12 Oct 2024 11:34:16 +0000 Received: from localhost ([127.0.0.1]:39249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szaO0-0007m9-5G for submit@debbugs.gnu.org; Sat, 12 Oct 2024 07:34:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szaNx-0007li-96 for 72272@debbugs.gnu.org; Sat, 12 Oct 2024 07:34:13 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1szaNd-0006Rs-Hj; Sat, 12 Oct 2024 07:33:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Y5n3E3zeYYi3hrPX0cXD3yJ7wmK78Ocjsqr7YRDCFng=; b=AZio7BBj2eK1 EwTdJx7/rdk2pyp2t5GHdDYJrab18MCHdrsYKQ6j+uSV1LRBa+mjcAgyW3+ffBN7gszCX+1J9sJUm Pq7Q1jlWv1IEEquhO3U+YD5Y9kXocw+0BTui8Q2RLR+zkMU04vCrI5D7aNGl92sVB2VNuAIjYC6iD 37sWCqvTZMADZfs3V4e5ZCzoerwa4/crpyqreQW5Iwkf4fsBOfq3bfAKaTEi1GK33UadhDRcoW0uo FtI7Bji1213uVxi8byb+Rxg5iNY4w/rTi00sqYLjtEyLiW+6LcMh+TcDrAU+blO/neYJWv0QTGq09 d3+q7e8QPKso7iLZKud4iA==; Date: Sat, 12 Oct 2024 14:33:50 +0300 Message-Id: <86zfn9wo69.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Alvaro Ramirez on Wed, 9 Oct 2024 18:31:35 +0100) References: <975D6937-9E65-4E53-92E5-D9785D0A1932@xenodium.com> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Alvaro Ramirez > Date: Wed, 9 Oct 2024 18:31:35 +0100 > Cc: 72272@debbugs.gnu.org, Andrea Corallo , > Visuwesh > > 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? Also, please fix the following minor nits while you are at it: > ++++ > +*** New user option 'dired-hide-details-hide-absolute-location' The heading lines in NEWS should end in a period. Also, since this new variable is not documented in the manual, the entry should be marked as "---", not "+++". > + (let* ((dir-indent " ") > + (dir-name (or (car-safe dir-wildcard) > + (directory-file-name (file-name-directory dir)))) > + (dir-name-point (+ (point) (length dir-indent))) > + (hideable-location (and dired-hide-details-hide-absolute-location > + (not (string-empty-p (file-name-nondirectory dir-name)))))) > + ;; Inserted directory name must be absolute, but keep in mind it > + ;; may be replaced in some instances (e.g. dired-build-subdir-alist). > + (insert dir-indent dir-name ":\n") > + (when hideable-location > + (put-text-property dir-name-point > + (+ dir-name-point > + (length (file-name-directory dir-name))) > + 'invisible 'dired-hide-details-absolute-location))) Here (and elsewhere in the patch) please break too-long lines into two. Thanks. From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Alvaro Ramirez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Oct 2024 19:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: acorallo@gnu.org, 72272@debbugs.gnu.org, stefankangas@gmail.com, visuweshm@gmail.com Received: via spool by 72272-submit@debbugs.gnu.org id=B72272.172876021217136 (code B ref 72272); Sat, 12 Oct 2024 19:11:01 +0000 Received: (at 72272) by debbugs.gnu.org; 12 Oct 2024 19:10:12 +0000 Received: from localhost ([127.0.0.1]:58126 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szhVC-0004SH-ML for submit@debbugs.gnu.org; Sat, 12 Oct 2024 15:10:12 -0400 Received: from out-188.mta0.migadu.com ([91.218.175.188]:29933) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szhNA-0003z0-UY for 72272@debbugs.gnu.org; Sat, 12 Oct 2024 15:01:54 -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=1728757631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=maGtZcJJ8nSQRoJTofd9iLQIF+Byz7OAmN+441gkj08=; b=a+1X9azLijgmCz5uGohvp+7EogBisjLs5WQEwIYTbRRxqK7K3mHj25mwT4RZCn3p3y4bTw MP6stiAhNPgOvVJaG3aAikEsyWZQFZfZwayu7xGqTHxs4LT9UOtUqBLGCce7GnaJAf+Nn3 S2e/ORCsVoBHp+8cD3ZQHn8kc3XOL2s= From: Alvaro Ramirez In-Reply-To: <86zfn9wo69.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 12 Oct 2024 14:33:50 +0300") References: <975D6937-9E65-4E53-92E5-D9785D0A1932@xenodium.com> <86zfn9wo69.fsf@gnu.org> Date: Sat, 12 Oct 2024 19:27:09 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; format=flowed Thanks for the comments Eli. Eli Zaretskii writes: >> From: Alvaro Ramirez >> Date: Wed, 9 Oct 2024 18:31:35 +0100 >> Cc: 72272@debbugs.gnu.org, Andrea Corallo , >> Visuwesh >> >> 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. > > Also, please fix the following minor nits while you are at it: > >> ++++ >> +*** New user option >> 'dired-hide-details-hide-absolute-location' > > The heading lines in NEWS should end in a period. > > Also, since this new variable is not documented in the manual, > the > entry should be marked as "---", not "+++". Thanks. Did not know this. >> + (let* ((dir-indent " ") >> + (dir-name (or (car-safe dir-wildcard) >> + (directory-file-name >> (file-name-directory dir)))) >> + (dir-name-point (+ (point) (length >> dir-indent))) >> + (hideable-location (and >> dired-hide-details-hide-absolute-location >> + (not >> (string-empty-p (file-name-nondirectory dir-name)))))) >> + ;; Inserted directory name must be absolute, but >> keep in mind it >> + ;; may be replaced in some instances >> (e.g. dired-build-subdir-alist). >> + (insert dir-indent dir-name ":\n") >> + (when hideable-location >> + (put-text-property dir-name-point >> + (+ dir-name-point >> + (length >> (file-name-directory dir-name))) >> + 'invisible >> 'dired-hide-details-absolute-location))) > > Here (and elsewhere in the patch) please break too-long lines > into > two. Used 80 character limit. Happy to use a different limit if needed. > > Thanks. --=-=-= Content-Type: text/x-patch; charset=utf-8; size=8.25KiB Content-Disposition: attachment; filename=0001-Hide-default-directory-absolute-location-via-dired-h.patch Content-Transfer-Encoding: quoted-printable >From 0ed4df0ae090a96bc40f19a15e4d62be58900d3b Mon Sep 17 00:00:00 2001 From: =C3=81lvaro Ram=C3=ADrez Date: Wed, 2 Oct 2024 11:36:57 +0100 Subject: [PATCH] Hide default-directory absolute location via dired-hide-details-mode --- etc/NEWS | 14 +++++++++++ lisp/dired.el | 54 +++++++++++++++++++++++++++++++++------- test/lisp/dired-tests.el | 46 ++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 9 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index daaae54d7d3..3ae46b45e7e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -490,6 +490,20 @@ fontifying them, which can be slow for remote director= ies. Setting 'dired-check-symlinks' to nil disables these checks. Defaults to t, can be set as a connection-local variable. =20 +--- +*** New user option 'dired-hide-details-hide-absolute-location'. +When dired's 'dired-hide-details-mode' is enabled, also hide the +'default-directory' absolute location, typically displayed as the first +line in a dired buffer. + +With dired-hide-details-hide-absolute-location: + + project: (100 GiB available) + +Without dired-hide-details-hide-absolute-location: + + /absolute/path/to/my/important/project: (100 GiB available) + ** Grep =20 +++ diff --git a/lisp/dired.el b/lisp/dired.el index 2bf5a221f4e..625de019d3b 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -387,6 +387,12 @@ dired-hide-details-hide-information-lines :version "24.4" :group 'dired) =20 +(defcustom dired-hide-details-hide-absolute-location nil + "Non-nil means `dired-hide-details-mode' hides directory absolute locati= on." + :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 @@ -1816,12 +1822,25 @@ dired-insert-directory (when (and (or hdr wildcard) (not (and (looking-at "^ \\(.*\\):$") (file-name-absolute-p (match-string 1))))) - ;; Note that dired-build-subdir-alist will replace the name - ;; by its expansion, so it does not matter whether what we insert - ;; here is fully expanded, but it should be absolute. - (insert " " (or (car-safe dir-wildcard) - (directory-file-name (file-name-directory dir= ))) - ":\n") + (let* ((dir-indent " ") + (dir-name (or (car-safe dir-wildcard) + (directory-file-name + (file-name-directory dir)))) + (dir-name-point (+ (point) (length dir-indent))) + (hideable-location + (and dired-hide-details-hide-absolute-location + (not (string-empty-p (file-name-nondirectory + dir-name)))))) + ;; Inserted directory name must be absolute, but keep in + ;; mind it may be replaced in some instances like in + ;; `dired-build-subdir-alist'. + (insert dir-indent dir-name ":\n") + (when hideable-location + (put-text-property + dir-name-point + (+ dir-name-point + (length (file-name-directory dir-name))) + 'invisible 'dired-hide-details-absolute-location))) (setq content-point (point))) (when wildcard ;; Insert "wildcard" line where "total" line would be for a full dir. @@ -3257,8 +3276,9 @@ dired-hide-details-mode When this minor mode is enabled, details such as file ownership and permissions are hidden from view. =20 -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")) @@ -3282,6 +3302,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))) @@ -3688,7 +3713,18 @@ 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)) + (let ((new-dir-name-pos (point)) + (hideable-location + (and dired-hide-details-hide-absolute-location + (not (string-empty-p + (file-name-nondirectory new-dir-name)))))) + (insert new-dir-name) + (when hideable-location + (put-text-property + new-dir-name-pos + (+ new-dir-name-pos + (length (file-name-directory new-dir-name))) + 'invisible 'dired-hide-details-absolute-location)))) (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 \. diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 3b1f80d3d3d..5a9ba14b402 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -524,6 +524,52 @@ dired-test-directory-files-and-attributes (when (file-directory-p testdir) (delete-directory testdir t))))) =20 +(ert-deftest dired-test-hide-absolute-location-enabled () + "Test for https://debbugs.gnu.org/72272 ." + (let* ((dired-hide-details-hide-absolute-location t) + (dir-name (expand-file-name "lisp" source-directory)) + (buffer (prog1 (dired (list dir-name "dired.el" "play")) + (dired-insert-subdir (file-name-concat default-directory + "play"))))) + (unwind-protect + (progn + (goto-char (point-min)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "lisp" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should (equal 'dired-hide-details-absolute-location + (get-text-property (match-beginning 1) 'invisible= ))) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "play" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should (equal 'dired-hide-details-absolute-location + (get-text-property (match-beginning 1) 'invisible= )))) + (kill-buffer buffer)))) + +(ert-deftest dired-test-hide-absolute-location-disabled () + "Test for https://debbugs.gnu.org/72272 ." + (let* ((dired-hide-details-hide-absolute-location nil) + (dir-name (expand-file-name "lisp" source-directory)) + (buffer (prog1 (dired (list dir-name "dired.el" "play")) + (dired-insert-subdir (file-name-concat default-directory + "play"))))) + (unwind-protect + (progn + (goto-char (point-min)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "lisp" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should-not (get-text-property (match-beginning 1) 'invisible)) + (re-search-forward dired-subdir-regexp) + (goto-char (match-beginning 1)) + (should (equal "play" (file-name-nondirectory + (directory-file-name (dired-get-subdir)))= )) + (should-not (get-text-property (match-beginning 1) 'invisible))) + (kill-buffer buffer)))) + ;; `dired-insert-directory' output tests. (let* ((data-dir "insert-directory") (test-dir (file-name-as-directory -- 2.39.5 (Apple Git-154) --=-=-=-- From unknown Thu Jun 19 16:24:26 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Alvaro Ramirez Subject: bug#72272: closed (Re: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path) Message-ID: References: <86v7xole1l.fsf@gnu.org> X-Gnu-PR-Message: they-closed 72272 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 72272@debbugs.gnu.org Date: Sat, 19 Oct 2024 08:00:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1729324802-4622-1" This is a multi-part message in MIME format... ------------=_1729324802-4622-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 72272@debbugs.gnu.org. --=20 72272: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D72272 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1729324802-4622-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 72272-done) by debbugs.gnu.org; 19 Oct 2024 07:59:08 +0000 Received: from localhost ([127.0.0.1]:41239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t24Md-0001Ax-KQ for submit@debbugs.gnu.org; Sat, 19 Oct 2024 03:59:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36248) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t24Mb-0001AR-Nv for 72272-done@debbugs.gnu.org; Sat, 19 Oct 2024 03:59:06 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t24M8-0008G1-MF; Sat, 19 Oct 2024 03:58:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=pKYB8w3CJglUVbP27dncRdeHgyJCMukFpGkNX0YNCAk=; b=E1WFTqSs4IEJ 2IQE/jvO9cK9lk9UII++EBw6T6igYGMYoT0MbD7Hcj1iOeZQyP2qbn0MPr+lWAeStOQjaM9slymit kJ2jJ1zmNgvem37oCieTL/hKPT9ImvjSD54+UkLgQFlZCyGAoxlx9NUMcyqARF7ldbcE3FQC32+vp DG1dST53wCQSYxWCbitwm1D9nM1+9n4SqHgnWnuZ1+Wlm66xrRnLn08ujzyDaoA+WvhLrRszGru0M 9hhvz+hYVagIf1z/xX9LUmwnDUTUzQQ53swzu7VBKdT/8kORl7XGxdjjG7vrOxlcTQ1KVSgtazYSm kLaexk3XBOxVB4Vm2hkquQ==; Date: Sat, 19 Oct 2024 10:58:30 +0300 Message-Id: <86v7xole1l.fsf@gnu.org> From: Eli Zaretskii To: Alvaro Ramirez In-Reply-To: (message from Alvaro Ramirez on Sat, 12 Oct 2024 19:27:09 +0100) Subject: Re: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path References: <975D6937-9E65-4E53-92E5-D9785D0A1932@xenodium.com> <86zfn9wo69.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 72272-done Cc: acorallo@gnu.org, visuweshm@gmail.com, stefankangas@gmail.com, 72272-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Alvaro Ramirez > Cc: stefankangas@gmail.com, 72272@debbugs.gnu.org, acorallo@gnu.org, > visuweshm@gmail.com > Date: Sat, 12 Oct 2024 19:27:09 +0100 > > Thanks for the comments Eli. > > Eli Zaretskii writes: > > >> From: Alvaro Ramirez > >> Date: Wed, 9 Oct 2024 18:31:35 +0100 > >> Cc: 72272@debbugs.gnu.org, Andrea Corallo , > >> Visuwesh > >> > >> 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. ------------=_1729324802-4622-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 24 Jul 2024 11:18:20 +0000 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 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 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 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= From: Alvaro Ramirez To: bug-gnu-emacs@gnu.org Subject: [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="=-=-=" 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-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 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) --=-=-=-- ------------=_1729324802-4622-1-- From unknown Thu Jun 19 16:24:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72272: [PATCH] dired-hide-details-mode hides directory's absolute path Resent-From: Alvaro Ramirez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Oct 2024 08:56:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: acorallo@gnu.org, visuweshm@gmail.com, stefankangas@gmail.com, 72272-done@debbugs.gnu.org Received: via spool by 72272-done@debbugs.gnu.org id=D72272.172932814815053 (code D ref 72272); Sat, 19 Oct 2024 08:56:03 +0000 Received: (at 72272-done) by debbugs.gnu.org; 19 Oct 2024 08:55:48 +0000 Received: from localhost ([127.0.0.1]:41388 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t25FU-0003uj-23 for submit@debbugs.gnu.org; Sat, 19 Oct 2024 04:55:48 -0400 Received: from out-181.mta0.migadu.com ([91.218.175.181]:54522) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t25FR-0003uR-SU for 72272-done@debbugs.gnu.org; Sat, 19 Oct 2024 04:55:47 -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=1729328085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GarWGqMTORRslAiF2nEcp4kqF/zmnoARI2qyHUfmMQ4=; b=i66+Uhoxwb3tBcuoXw/ZqgvFGXvgIiFkG/WGRPASyhbUC6Fr/JPzYrYUPRNicJLFBSKHBD UhuUjaAb4U0WiOv5whn2v2SnwKP34drkBKg13HrVSn40xD7Km5MNxw9+NlADP89aAndO4N LMQJQAjZxe0j9svM3aQnD069YDSsxxg= From: Alvaro Ramirez In-Reply-To: <86v7xole1l.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Oct 2024 10:58:30 +0300") References: <975D6937-9E65-4E53-92E5-D9785D0A1932@xenodium.com> <86zfn9wo69.fsf@gnu.org> <86v7xole1l.fsf@gnu.org> Date: Sat, 19 Oct 2024 09:54:43 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Alvaro Ramirez >> Cc: stefankangas@gmail.com, 72272@debbugs.gnu.org, >> acorallo@gnu.org, >> visuweshm@gmail.com >> Date: Sat, 12 Oct 2024 19:27:09 +0100 >> >> Thanks for the comments Eli. >> >> Eli Zaretskii writes: >> >> >> From: Alvaro Ramirez >> >> Date: Wed, 9 Oct 2024 18:31:35 +0100 >> >> Cc: 72272@debbugs.gnu.org, Andrea Corallo >> >> , >> >> Visuwesh >> >> >> >> 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. Nice to hear! > > Please in the future accompany patches with a ChangeLog-style > commit > log message, as described in CONTRIBUTE. (I added it for you > this > time.) Will do. Thanks for adding it. > > I'm now closing this bug. Thanks for all the guidance and help Eli!