From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#61785: [PATCH] Add option to keep some columns in dired-hide-details-mode Date: Sat, 25 Feb 2023 12:30:14 +0100 Message-ID: <87sfeu3ruh.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25932"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 61785@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 25 12:31:18 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pVslq-0006bZ-7U for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Feb 2023 12:31:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVslg-00058y-N6; Sat, 25 Feb 2023 06:31:08 -0500 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 1pVslb-00057V-1m for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 06:31:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVsla-0007ih-Po for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 06:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVsla-0001bg-J6 for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 06:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Feb 2023 11:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61785 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16773246336136 (code B ref -1); Sat, 25 Feb 2023 11:31:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Feb 2023 11:30:33 +0000 Original-Received: from localhost ([127.0.0.1]:39279 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVsl5-0001as-Hu for submit@debbugs.gnu.org; Sat, 25 Feb 2023 06:30:33 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:51572) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVsl2-0001ak-RY for submit@debbugs.gnu.org; Sat, 25 Feb 2023 06:30:30 -0500 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 1pVsky-0004sz-RO for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 06:30:27 -0500 Original-Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVsks-0007QH-Kt for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 06:30:21 -0500 Original-Received: by mail-ed1-x533.google.com with SMTP id s26so7223830edw.11 for ; Sat, 25 Feb 2023 03:30:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=aLddHDx/VBkvDHEv7KUXJXKsfU3nDbzdFpyVNkbj1j4=; b=mo1xNKGhKzohtBXmhfhqdFvOIvZNrw+3nhKKcq148ktCAtJaTare/EqhBfsZskziam jwPRzFhiNor/lGglZgtOZID8cUx/yzh/O/K2t0kDCSS4Wr/lHB3Bn67+0Oq3plp1EH5/ 60BlCULpuRpui/kQvQsd2k0GGNGFmKlYpV+2vICVA9lGLKClY1LFmpi/kys26wMvg8ux lQT1tCG5JeHcozKf1KavTmAH+vXf+kKYnkuf/cCaEDd53OZw0b9AOwcPPZtHtLHi1f5c k9FG+plbOZNlpHbGTiPik1Q1vUbjtBUgrpn88PZZ2whSD+CB4+3Ef56c9E1x23DRR9j1 OGDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aLddHDx/VBkvDHEv7KUXJXKsfU3nDbzdFpyVNkbj1j4=; b=AqQh2Z+hdS4JQNBYNcYi+QZeEXoHWwKsTVc5jtHA7noGQZE26Gw6aaUNW2EVccqjar erLU0C/W8agTFvyCBhbGzehtzLLeSsUqHTyTOMYekhVizvXqMLyRpmT3LqUZylWQasjH o0llsmCNMZUJ6ilwHsMN3pfe8WVOushwzOn1VdxXcY6eMiXqItQRZkkk6M/WyIqB2InT nZJeft5J6Oog4z1ca7kGITQu1isNfa5nYDvHc14JsBh61Hh0LiMzczBiqCr7caDNCbpF lFp88TTInFUPH8QgXPPzHZiLBwbScKcNFByYv5NBlxk7i39BbzLwRQkgykXdEEJZW1gJ 9VBQ== X-Gm-Message-State: AO0yUKUl8ic0TsLv71oWK7hZC+TU8wiw2PclYhJbpmNM4bCFQMEksT8A kD0biDMqXWdEZIefQTExJz2ucm79xEY= X-Google-Smtp-Source: AK7set/O3NLF338etOX7QcU1kgPUhJtO5l2juC3j5hOnAIENN5boknmPDsHc4J+q5ei303kEQGq0RQ== X-Received: by 2002:a17:906:4ad1:b0:8f8:375e:f0b6 with SMTP id u17-20020a1709064ad100b008f8375ef0b6mr2112706ejt.58.1677324615787; Sat, 25 Feb 2023 03:30:15 -0800 (PST) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::6fd0]) by smtp.gmail.com with ESMTPSA id a24-20020a17090640d800b008b1797b77b2sm724845ejk.221.2023.02.25.03.30.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 03:30:15 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=arstoffel@gmail.com; helo=mail-ed1-x533.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256712 Archived-At: --=-=-= Content-Type: text/plain Tags: patch I find the normal dired buffer a bit too busy but dired-hide-details-mode a bit too lacking. So I'd like show only the details I care most about, for instance like this: --8<---------------cut here---------------start------------->8--- /home/augusto/emacs: 4.0K Feb 25 . 4.0K Feb 20 .. 4.0K Feb 25 admin 4.0K Feb 20 autom4te.cache 4.0K Feb 25 build-aux 3.6K Feb 20 aclocal.m4 11K Feb 25 autogen.sh 932 Jun 6 BUGS ... --8<---------------cut here---------------end--------------->8--- The above can be obtained by setting (setq dired-hide-details-preserved-columns '(5 6 7)) After writing this, I realized one could easily modify the new user option to be an alist mapping column numbers to arbitrary text properties to be applied to that column. If anyone thinks this variant is useful, I'd be happy to adapt the patch. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Add-option-to-keep-some-columns-in-dired-hide-detail.patch >From 58ed1d179e4b9a66f21a3507787033bd94d7107d Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sat, 25 Feb 2023 12:15:43 +0100 Subject: [PATCH] Add option to keep some columns in dired-hide-details-mode * lisp/dired.el (dired-hide-details-preserved-columns): New user option. (dired-insert-set-properties): Use it. --- lisp/dired.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lisp/dired.el b/lisp/dired.el index 2bcb28a0e00..7a9076ecb49 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -490,6 +490,11 @@ dired-guess-shell-znew-switches (string :tag "Switches")) :version "29.1") +(defcustom dired-hide-details-preserved-columns nil + "List of columns which are not hidden in `dired-hide-details-mode'." + :type '(repeat integer) + :version "30.1") + ;;; Internal variables @@ -1880,8 +1885,15 @@ dired-insert-set-properties (put-text-property (line-beginning-position) (1+ (line-end-position)) 'invisible 'dired-hide-details-information)) - (put-text-property (+ (line-beginning-position) 1) (1- (point)) - 'invisible 'dired-hide-details-detail) + (save-excursion + (let ((end (1- (point))) + (opoint (goto-char (1+ (pos-bol)))) + (i 0)) + (put-text-property opoint end 'invisible 'dired-hide-details-detail) + (while (re-search-forward "[^ ]+" end t) + (when (member (cl-incf i) dired-hide-details-preserved-columns) + (put-text-property opoint (point) 'invisible nil)) + (setq opoint (point))))) (when (and dired-mouse-drag-files (fboundp 'x-begin-drag)) (put-text-property (point) (save-excursion -- 2.39.2 --=-=-=--