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: Tue, 24 Dec 2024 08:52:16 +0530 Message-ID: <874j2tbw9j.fsf@gmail.com> References: <874j3iodzb.fsf@gmail.com> <86ttbiy5na.fsf@gnu.org> <87zflamt6j.fsf@gmail.com> <8634it19cc.fsf@gnu.org> <87msgmozm3.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1602"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: eliz@gnu.org, 74700@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 24 04:24:23 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 1tPvWw-0000LF-AS for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Dec 2024 04:24:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPvWf-0007yP-8J; Mon, 23 Dec 2024 22:24:05 -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 1tPvWd-0007xw-Jp for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 22:24:03 -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 1tPvWd-0005q9-As for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 22:24:03 -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=Q2BKA/3DhWmP3ifr9rYisE1+FVuCRhr4pzDCBPm7xRA=; b=AeClJbjWtK3MzCnsRImc/isDvV/mZUrjclGKVLUYknDvp9L8jsYnDozEmMHHScKfo3Z8eTbIEmVqd2JRn7P2ZRst4Dx++6igHvwDfDV6oHexpFnIRhQRRyt3dkHxdIIEtebsG8KquIE+tjt+SPMow3nC3J8CQ0Kavo6mXLTTb++0kDyeT2pVuS3XVd77b9El4qifb8HgYeWUl06no6bvxu7ur9aNLbJRhesTGcObXvO0B6gIdH9+UTPNQym24MnnVE57ilJj8SRoJDimtM4IgRsERKpJe94SogyJEEuSIZoxFLpnMYTE/bDKPY+7HQZnYap7dD6g8vAj9orfzBA5vw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tPvWc-0004Lj-4U for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 22:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Dec 2024 03:24:02 +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.173501060516669 (code B ref 74700); Tue, 24 Dec 2024 03:24:02 +0000 Original-Received: (at 74700) by debbugs.gnu.org; 24 Dec 2024 03:23:25 +0000 Original-Received: from localhost ([127.0.0.1]:58847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPvW0-0004Km-Pz for submit@debbugs.gnu.org; Mon, 23 Dec 2024 22:23:25 -0500 Original-Received: from mail-pl1-f195.google.com ([209.85.214.195]:49455) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPvVw-0004KZ-KD for 74700@debbugs.gnu.org; Mon, 23 Dec 2024 22:23:24 -0500 Original-Received: by mail-pl1-f195.google.com with SMTP id d9443c01a7336-2166f1e589cso54218585ad.3 for <74700@debbugs.gnu.org>; Mon, 23 Dec 2024 19:23:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735010540; x=1735615340; 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=Q2BKA/3DhWmP3ifr9rYisE1+FVuCRhr4pzDCBPm7xRA=; b=fhaLxTdZWVgxj+b3odykJfIKlaHbkoAjIA54mB39R2TizwcSwh88QgBQ4IcImPfJbs uvZqpS7RPSlKQw5TAiSDw1ppU1vL6WiZb0/9n2ZcDIb90UGkrXkog/A0BSPZCVBW3O/J 0ZPGNOYim13EErqb8fHwnPXjxNqYKeVlIvzw9ZP8bgeJRBHtOhmt39oyxXMh6IAO7iFY v4Yg3maDvkbfph8eVUTWQQCJoUeYpHvHPTLksNEhzy6KUupnTQCsTotj1S1NekNkMZ/n uJLd/lTD8nfFlJ202U4BXbo7ORf+RqOSJuSEz5IJyAp4IK8GU6tBNOzpZR+pwKI3Pla4 7thw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735010540; x=1735615340; 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=Q2BKA/3DhWmP3ifr9rYisE1+FVuCRhr4pzDCBPm7xRA=; b=uaeKRD2sxXc/AN6WE9ycTvZB4bbkSjE2L/nHNgfDmxfpgAreI9uYrVlXM2Mb1X98n0 2G1B0UhfQ7RRyw2db9sddYhzTgR+RiG9MLhwJr7KvGVIUrk25NFol6Dzm0Q0rgTLpwCf ydLQuwvFoGDLmxRXlheTy6kvs5iBEk1NleFOXz3Yh/l9yGB6+l1CGUxjADZ4Q3++tA5h 2cmHrmfER50uaPESOM2I7EKmhB9wrYr7bz+zlgqGFj1MAvwdbEtmvorcJl1uj1VYE2x8 x68HfaPjjzSRE95E6huh/D+FefPL/LTLanGpwgqHTJJMlS8f3TuWsFEe+w2Fz3+kB6H9 D7tQ== X-Gm-Message-State: AOJu0Yw6zRbEaeFv+QkPYkWzK2OM06hKkj5oOn3akUhF9KzXmJZ6QEuD 1W6RvcQtxg667a4lEzdwpOxzAyQerK5PsuOAvS3EmxFNMBylk9rTrJkbXvrI X-Gm-Gg: ASbGncubsrmJ3T1uY97fyCwGZ03O7o6Ckp2gwp7bBm1mDmKx30H3JWjuzGd8lz1e54C XeewH63szsrGNXdSoluDvx3bmTCBkXaS0y5VzKu6gWN8QI4DAuxbnWZq1w6PZXBy3csbtkFT39P jYY8sM1+Lcwc+q1xUgAGQ5HuMRi7cJx6Mn4V7lLODHXaqY0ywa9xo+FsNpYOKLUXiVyJndNbVw+ yYgy2Q0dlpPB9tdzrkgjNDv/fVhGXq2j77dg/7z5X/r6eTL12Hv X-Google-Smtp-Source: AGHT+IFwLrOKoqmEfe16EDRaoO2EiDC1p2kSKU0oLIItkm3DZBvqzZAOSvZ9DkWqD24aAgJjAprbWw== X-Received: by 2002:a17:902:db05:b0:216:1543:195e with SMTP id d9443c01a7336-219e6e8c5d1mr199051805ad.5.1735010539874; Mon, 23 Dec 2024 19:22:19 -0800 (PST) Original-Received: from localhost ([49.204.129.41]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc964f09sm80981025ad.26.2024.12.23.19.22.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 19:22:19 -0800 (PST) In-Reply-To: <87msgmozm3.fsf@web.de> (Michael Heerdegen's message of "Mon, 23 Dec 2024 22:31:32 +0100") 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:297678 Archived-At: [=E0=AE=A4=E0=AE=BF=E0=AE=99=E0=AF=8D=E0=AE=95=E0=AE=B3=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 23, 2024] M= ichael Heerdegen wrote: > Hello, > > a user on emacs-help (Dieter, CC'd) mentioned that in contrast to hitting= g, > reverting with this new method loses the position of point, instead, > point is repositioned at the beginning of the buffer. And I agree that > this is not the optimal behavior. Can we maybe improve this? > I didn't notice this, thanks for bringing this to my attention. This also caught another bug that I would not have noticed since I have mouse-autoselect-window set non-nil. With the following patch, using mouse-2 on the base name reverts the buffer without moving point. However, using mouse-1 still moves the point to bob. I believe we could fix it by directly binding mouse-1 but I would like to respect mouse-1-click-follows-link like the rest of the code in the function. I cannot tell how to prevent mouse-1 from moving point reading the Info nodes (info "(elisp) Clickable Text") and (info "(emacs) Mouse References"). I tried (with-selected-window (posn-window (event-start e)) ...) to no avail. This goes beyond my level of knowledge so someone else will have to take care of this. But please install the following patch because without it using mouse-2 on the base name tries to revert the current-buffer instead of the dired buffer when the dired buffer is not shown in the selected window. diff -u --label /home/viz/lib/ports/emacs/lisp/dired.el --label \#\ /home/viz/lib/ports/emacs/lisp/dired.el /tmp/buffer-content-C8k= gcN --- /home/viz/lib/ports/emacs/lisp/dired.el +++ # @@ -2089,8 +2089,10 @@ `( mouse-face highlight help-echo "mouse-1: revert this buffer" keymap ,(define-keymap - "" #'revert-buffer - "" 'follow-link + "" (lambda (_) + (interactive "@e") + (revert-buffer)) + "" 'mouse-face "RET" #'revert-buffer)))))))) =20 (defun dired--get-ellipsis-length () Diff finished. Tue Dec 24 08:40:30 2024