From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#74700: [PATCH] Revert Dired buffer when clicking on last segment of directory name Date: Thu, 05 Dec 2024 13:56:44 +0530 Message-ID: <87zflamt6j.fsf@gmail.com> References: <874j3iodzb.fsf@gmail.com> <86ttbiy5na.fsf@gnu.org> 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="2454"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74700@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 05 09:28:26 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tJ7Dl-0000Nj-Rx for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Dec 2024 09:28:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJ7DP-0002bd-QF; Thu, 05 Dec 2024 03:28:03 -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 1tJ7DO-0002bR-F8 for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 03:28:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJ7DO-0007PY-7B for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 03:28:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=7pxsmZxhn8kmrvW6VkmIIEaTp9HrILL4D3KGGIvG5tw=; b=D3+D3AL6VrFemWm/XCPJR7JR/3tiXvsd1AiIHlMnR9gzcsBlDSx32EN+W1Vg866iEMZR352Fekihqb0lsfhQDwjdyLiPY2r9hB+wCxVByBGsZYgNAf58dQ+Mn7CHfEE2eGrF80Jo4GS+emv7nPSaobaK22OkzE/suD1xZbQqkf8sfVpCJ2CS0m3NznXyDfizpzDUlNhckHfakj+skQo+de5ouSX8+xehW99fJDbyekwd4gwrhpYmwuBZtrQunuz/o3EQbCZqvoLtBuHE67a2fFRzF+LGPmV1fTeAa3g/iXQiU33eky153LWh41wf6b7oIjNsKyOjK/dMYZ6WVWm2Fg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tJ7DN-0007ce-Ph for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 03:28:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Dec 2024 08:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74700 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74700-submit@debbugs.gnu.org id=B74700.173338727629288 (code B ref 74700); Thu, 05 Dec 2024 08:28:01 +0000 Original-Received: (at 74700) by debbugs.gnu.org; 5 Dec 2024 08:27:56 +0000 Original-Received: from localhost ([127.0.0.1]:38098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJ7DI-0007cG-6a for submit@debbugs.gnu.org; Thu, 05 Dec 2024 03:27:56 -0500 Original-Received: from mail-pl1-f194.google.com ([209.85.214.194]:47354) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJ7DG-0007c2-Hb for 74700@debbugs.gnu.org; Thu, 05 Dec 2024 03:27:55 -0500 Original-Received: by mail-pl1-f194.google.com with SMTP id d9443c01a7336-215ac560292so5798065ad.2 for <74700@debbugs.gnu.org>; Thu, 05 Dec 2024 00:27:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733387209; x=1733992009; darn=debbugs.gnu.org; h=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=7pxsmZxhn8kmrvW6VkmIIEaTp9HrILL4D3KGGIvG5tw=; b=VWV2dfjT0VkiyXIDSdUWuriZJbtFa1FuTLP6X7gmlMGrkHNKmZtegVIh+A7FQpNdNo pL63SyaiiIUJ4Itr9MXsd1irjWIvCARxeod/CvjGscrYKPFkhvSE8/qeetcPFfAG34/E TmJF4ULoILdYoMcdZrnZTyXOAep0Jb3NQEcx1XhwWPejbtJCQvIEQuhEzWx99Hd2kHOC ePH4drWM5wMU6QJkDU9BSRsBpON28kARb1FsZvocpOyxezvzMggqlbTlVSL2NclODn1K /agWIgeeuwGvvTs2YdCl+Hjx96uEt8k1ErTcoRZ9TiJdz+LjlIJ9vfKmpkeKY4+IB8r4 2pKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733387209; x=1733992009; h=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=7pxsmZxhn8kmrvW6VkmIIEaTp9HrILL4D3KGGIvG5tw=; b=OPuBwKGNqqRfDFupD2LGsJnLzY2SyyHKBf0FIet2TmiF9WNAxOZKM2awB76KJvBdV9 BGyrST3WzxgE7xSVZe6ARutCRbp+EVZPg6A7a5/fyVvFEuqFvOlvnthTCUgpcjcvbgAY /JezN53DdkamzvKwZC7d2cR8dWx3SsWEQfjRI7MU+WqtQtq5QHu0cNFJjpbh8E7ypEz6 kdSfHfgoyytBWgGBOr/cCoCinu4wUzY6UOp0ad+t8ZhjAaFvpXf+64ttxW71UG99I82E Vho5WDEf2aqYB/11v3C/rcVQgjsu1GzxLTq71Ln+wairKcK3h14jKGZy03j7bO4gzF1B 0IOg== X-Gm-Message-State: AOJu0Yz8lfbtbT5QaoL4n3sjOSUvReNxUpkaVS3yH6NAuTA+k9YUjJxi G3pGXgVWxpW//uxpcu7+wY0jzc0wrPDqwInJYfuA38NbDga3VLX1 X-Gm-Gg: ASbGncsqRG/8TyNcPicWepZe30jpBxq+Q23Kdv95XQl2Ttp1+EhqE86IqTBuu9XAhop Ux6CvEsBh4IybgdL4ll72inwi1xDJBd1B1FK/VlcCcFGZuaja4WK/YoPAebF69A0vcVtih29V7b VvdIBWkniRLd6D7tW/TDY7jCTPHXYO1dNRfUvshkc5FJpQtDn9D2XiMEDBPAYZzjQCZ6hT3eePF kCzV+y+JH5tY1Uj0WSVLgyRlK/XGl264EyeUExM0apGL+8= X-Google-Smtp-Source: AGHT+IEN3AixE1VsQE8Oq8GFJsknxT6yTWJ+kqlfWGjLEwID5BoIz9FUcWxAz1iHiQ1fmUCcCkIYAQ== X-Received: by 2002:a17:902:d505:b0:215:9091:4f56 with SMTP id d9443c01a7336-215bceb588amr137975985ad.14.1733387208658; Thu, 05 Dec 2024 00:26:48 -0800 (PST) Original-Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-215f8e3ef8esm7593105ad.24.2024.12.05.00.26.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2024 00:26:47 -0800 (PST) In-Reply-To: <86ttbiy5na.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 05 Dec 2024 09:02:01 +0200") 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:296456 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=B5=E0=AE=BF=E0=AE=AF=E0=AE=BE=E0=AE=B4=E0=AE=A9=E0=AF=8D =E0=AE=9F= =E0=AE=BF=E0=AE=9A=E0=AE=AE=E0=AF=8D=E0=AE=AA=E0=AE=B0=E0=AF=8D 05, 2024] E= li Zaretskii wrote: >> From: Visuwesh >> Date: Thu, 05 Dec 2024 11:42:08 +0530 >>=20 >> Attached patch makes it possible to revert the current Dired buffer by >> clicking on the last segment of the directory line. With the patch >> applied, >>=20 >> /home/viz/lib/ports/emacs: >>=20 >> clicking on 'emacs' now reverts the buffer that shows ~/lib/ports/emacs. >> Previously, it did nothing. This makes it possible to update the Dired >> listing without needing to use the keyboard. > > Thanks, a few comments below. > >> +--- >> +*** Clicking on last segment of directory reverts buffer >> +When 'dired-make-directory-clickable' is non-nil, clicking on the last >> +segment of the directory name now reverts the Dired buffer. > > We don't call these "segments", we call them "components". And since > you are talking about the last one, you could also say "base name of > the directory". I've changed it to base name. >> + (when (search-forward ":" bound t) >> + (add-text-properties >> + segment-start (1- (point)) >> + `( mouse-face highlight > ^^ > We don't leave whitespace after the opening parenthesis. I removed the whitespace. But isn't that way to make lists such as ( 1 2 3) aligned without manual intervention? It is used in the list above too. >> + help-echo "mouse-1: revert this buffer" > > I think the help-echo should say something more similar to what we say > for the other components of the directory shown in the header line. > Something like "re-read this buffer's directory". Now done. >> + keymap ,(define-keymap >> + "" #'revert-buffer >> + "" 'follow-link >> + "RET" #'revert-buffer)))))))) > > Should we perhaps call dired-revert directly? revert-buffer-function is set to dired-revert by dired. If someone has changed it, for some reason, using revert-buffer would heed their customisation. So I've left it as revert-buffer. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Revert-Dired-buffer-when-clicking-on-basename-of-dir.patch >From 642338b96d5f39f3b11285fff319f744c1a07164 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Thu, 5 Dec 2024 11:40:02 +0530 Subject: [PATCH] Revert Dired buffer when clicking on basename of directory * lisp/dired.el (dired--make-directory-clickable): Make clicking on basename of the directory revert the Dired buffer. * etc/NEWS: Announce the change. (Bug#74700) --- etc/NEWS | 5 +++++ lisp/dired.el | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index e63132efeda..1ed529b0792 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -587,6 +587,11 @@ Without 'dired-hide-details-hide-absolute-location': /absolute/path/to/my/important/project: (100 GiB available) +--- +*** Clicking on base name of directory reverts buffer. +When 'dired-make-directory-clickable' is non-nil, clicking on the base +name of the directory now reverts the Dired buffer. + ** Grep +++ diff --git a/lisp/dired.el b/lisp/dired.el index f79a2220bea..9895229694a 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2082,7 +2082,16 @@ dired--make-directory-clickable "" click "" 'mouse-face "RET" click)))) - (setq segment-start (point))))))) + (setq segment-start (point))) + (when (search-forward ":" bound t) + (add-text-properties + segment-start (1- (point)) + `(mouse-face highlight + help-echo "mouse-1: re-read this buffer's directory" + keymap ,(define-keymap + "" #'revert-buffer + "" 'follow-link + "RET" #'revert-buffer)))))))) (defun dired--get-ellipsis-length () "Return length of ellipsis." -- 2.45.2 --=-=-=--