From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alvaro Ramirez Newsgroups: gmane.emacs.devel Subject: Re: Keen on a dired-hide-details-mode patch? Date: Fri, 02 Aug 2024 11:40:11 +0100 Message-ID: References: <6083C0AE-D71B-4E3C-B878-8F89E0BD91E3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31798"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: kickingvegas@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 02 17:30:59 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sZuF8-000801-CT for ged-emacs-devel@m.gmane-mx.org; Fri, 02 Aug 2024 17:30:58 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZuEF-0000GV-9o; Fri, 02 Aug 2024 11:30:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZphs-0005gu-MQ for emacs-devel@gnu.org; Fri, 02 Aug 2024 06:40:21 -0400 Original-Received: from out-185.mta0.migadu.com ([2001:41d0:1004:224b::b9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZphp-0002IP-I6 for emacs-devel@gnu.org; Fri, 02 Aug 2024 06:40: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=1722595214; 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=zG495A2gn8aBb29wlhMSy6kfCVdw+6mYuVO16xmqzLw=; b=Z6tXp09AaGz9nUnCSfTQe3bZjo/HEz1sQqKQZNzhv0xXJlvuRHve7ZPuxWvrWjdFx66Nq4 4xJktq+f3dLBR0Uoek+eUxURAIuKQE+ebgJyOg7kL+dcW6tYZu4t3D8XhkCVpn4TkMp+3b bXh7BKVl3CfcRJV8dSjQnqqNu6tu5AU= In-Reply-To: X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::b9; envelope-from=alvaro@xenodium.com; helo=out-185.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-Mailman-Approved-At: Fri, 02 Aug 2024 11:30:02 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322290 Archived-At: > Alvaro - > > Yes, `dired-maybe-insert-subdir` is the command that inserts a=20 > subdir provided > it is issued when the point is over a directory. For reference,=20 > I invoke it > from Casual Dired from here > https://github.com/kickingvegas/casual-dired/blob/4be72b52f91700cdb529a18= 5b8f6f21bd0a86542/lisp/casual-dired.el#L76 > > Ideally your hiding code would show the relative pathname of a=20 > subdir when > hiding is turned on, otherwise the fullpath. I think https://0x0.st/s/1UqYa811zfdRYdMdDWdE-Q/XO2D.gif shows=20 that? or do we mean something else? Without patching your core dired.el, try the following and see if=20 that does what you expect: (use-package dired :hook ((dired-mode . dired-hide-details-mode) (dired-after-readin=20 . ar/hide-dired-details-include-all-subdir-paths)) :config (defun ar/hide-dired-details-include-all-subdir-paths () (save-excursion (goto-char (point-min)) (while (re-search-forward dired-subdir-regexp nil t) (let* ((match-bounds (cons (match-beginning 1) (match-end=20 1))) (path (file-name-directory (buffer-substring (car=20 match-bounds) (cdr match-bounds)))) (path-start (car match-bounds)) (path-end (+ (car match-bounds) (length path))) (inhibit-read-only t)) (put-text-property path-start path-end 'invisible=20 'dired-hide-details-information))))))=20 > Note that my current understanding of subdir behavior with=20 > default Dired is > that it only supports subdirectories within the current parent=20 > directory. I > vaguely recall there are other 3rd party packages that try to=20 > let you insert > out-of-hierarchy subdirs. I don=E2=80=99t think it=E2=80=99s something yo= u need=20 > to support, but > this patch could potentially break such packages if pushed into=20 > core. I use one of them (dired-subtree). No breakage so far.