From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Fix bookmark-bmenu-list sorting. Date: Sun, 20 Mar 2022 18:40:18 -0500 Message-ID: <87lex4ura5.fsf@red-bean.com> References: <875yovm1m6.fsf@elite.giraud> <87v8wvkk64.fsf@red-bean.com> <83v8wuj3v0.fsf@gnu.org> <87tucewgu7.fsf@red-bean.com> <83lexqi3z9.fsf@gnu.org> <87tuceuo4b.fsf@red-bean.com> <83czj2hrdv.fsf@gnu.org> <87a6e5lui6.fsf@elite.giraud> <837d99j10x.fsf@gnu.org> <874k4dlpeg.fsf@elite.giraud> <834k4divrt.fsf@gnu.org> <87wnh9k43g.fsf@elite.giraud> <83v8wth5lh.fsf@gnu.org> <87h78afndq.fsf@red-bean.com> <87zgm25d9o.fsf@elite.giraud> Reply-To: Karl Fogel 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="7001"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Manuel Giraud Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Mar 21 00:44:42 2022 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 1nW5E2-0001eb-6y for ged-emacs-devel@m.gmane-mx.org; Mon, 21 Mar 2022 00:44:42 +0100 Original-Received: from localhost ([::1]:44264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nW5E0-0000c3-Qr for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Mar 2022 19:44:40 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nW59w-0007Xo-M7 for emacs-devel@gnu.org; Sun, 20 Mar 2022 19:40:28 -0400 Original-Received: from sanpietro.red-bean.com ([45.79.25.59]:58556) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nW59s-0001Wf-Cz; Sun, 20 Mar 2022 19:40:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=red-bean.com; s=202005newsp; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:Reply-To:References:Subject:Cc:To:From:Sender: Content-Transfer-Encoding:Content-ID:Content-Description; bh=8PZMFRnpjR+K98lvEVpEivmDOv4dAMHt2h4Nw/9YJQs=; t=1647819622; x=1649029222; b=g8DllcavXqVR/g4fjPadnkj0EZCdFOymre1p5qG2jk2xGUfA6oHrWrLGe/6FvbkH/iVcsqE4F7/ 8PRIikblBeBMWfHpS/E2/2+9WN5Hm4fps7P3WHjs6a/L+aITt60pTbEPTtJE5XLs5ZkhL80ypDdBg /x/3RwZk6b9SkiTuTHfV9W1Axl2VYvEnwwqzKIWujd8OZ7IJPiVUQSNcKBZo4vzz0ielpiU7dlPYM HZxWNJfqHWLrapDJOAexV69JdUmdV5M4WbxIA70ZqxacJkGJtdhojlGY9NpUZ5OU16A8ZKLzJJQoH is5Cu5+cLYnV/Dydh9qFZhlksxu+f5+ACwJg==; Original-Received: from 99-112-125-163.lightspeed.cicril.sbcglobal.net ([99.112.125.163]:35248 helo=floss) by sanpietro.red-bean.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nW59o-008Zgc-9W; Sun, 20 Mar 2022 23:40:20 +0000 In-Reply-To: <87zgm25d9o.fsf@elite.giraud> (Manuel Giraud's message of "Mon, 07 Mar 2022 10:21:23 +0100") Received-SPF: pass client-ip=45.79.25.59; envelope-from=kfogel@red-bean.com; helo=sanpietro.red-bean.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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" Xref: news.gmane.io gmane.emacs.devel:287326 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 07 Mar 2022, Manuel Giraud wrote: >Karl Fogel writes: > >>>Thanks. >>> >>>Let's install this on master. We can consider backporting to=20 >>>the >>>emacs-28 branch after Emacs 28.1 is released. >> >> Installed in commit a6abd06c73. > >Thanks. I've tested both of your patch and they are working as=20 >intended: >the order is modified between two `bookmark-bmenu-list' call if I=20 >change >`bookmark-sort-flag'. > >There is one minor thing left: the tabulated-list bar (I don't=20 >how it is >called) keep the old information =C2=AB sorted by bookmark name =C2=BB whe= n=20 >I have >revert to `bookmark-sort-flag' as nil. Manuel, could you please give me a more verbose reproduction=20 recipe for that last paragraph above? Maybe even include a=20 screenshot? I've attached an updated patch here (please use this version), and=20 when I test it, I don't see anything that says "sorted by bookmark=20 name". I don't know what the tabulated-list bar you're referring=20 to is, but I don't see anything that would obviously be it. (I have tried things like turning `menu-bar-mode' on and off.=20 I've also tried looking in the code of=20 "lisp/emacs-lisp/tabulated-list.el", but I don't see any place=20 where a message "sorted by bookmark name" would be set up.) Now, there is another related UI issue: In the tabulated-list header line at the top of the buffer, we=20 have the expected three columns: "Bookmark", "Type", and "File".=20 The first column, "Bookmark", has a down-triangle / up-triangle=20 toggle for switching between descending and ascending sort by=20 bookmark name. But if `bookmark-sort-flag' is nil, then when the=20 buffer is regenerated the bookmarks will be listed in=20 creation-date order -- and the triangular toggle will just keep=20 whichever value the triangle had already. Maybe the right fix for that is for the buffer to somehow indicate=20 *which* property the bookmarks are sorted by -- name or=20 creation-date -- and make sure that the triangle always reflects=20 the sorting direction of whichever thing is currently being sorted=20 on. However, before I go down that road, I'd like to fully=20 understand your initial "one minor thing" bug report above first. Best regards, -Karl --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-Ensure-bookmark-bmenu-buffer-sorts-when-it-should.patch Content-Transfer-Encoding: quoted-printable >From c8c00cac4bc16e7fccb228756b825ae022b315a0 Mon Sep 17 00:00:00 2001 From: Karl Fogel Date: Thu, 17 Mar 2022 22:47:16 -0500 Subject: [PATCH] Ensure bookmark bmenu buffer sorts when it should MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit This patch is still WIP, as, as Manuel Giraud has pointed out in his post "Re: [PATCH] Fix bookmark-bmenu-list sorting." of 7 March 2022 (Message-ID: <87zgm25d9o.fsf@elite.giraud>) the following: > There is one minor thing left: the tabulated-list bar (I don't how > it is called) keep the old information =C2=AB sorted by bookmark name = =C2=BB > when I have revert to `bookmark-sort-flag' as nil. I'm finding out more details from him; once we have it all sorted out, I will update this change. --- lisp/bookmark.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git lisp/bookmark.el lisp/bookmark.el index 80fb1cdfc7..400a673447 100644 --- lisp/bookmark.el +++ lisp/bookmark.el @@ -1819,7 +1819,17 @@ bookmark-bmenu--revert (list location))]) entries))) (tabulated-list-init-header) - (setq tabulated-list-entries (reverse entries))) + ;; The value of `bookmark-sort-flag' might have changed since the + ;; last time the buffer contents were generated, so re-check it. + (if bookmark-sort-flag + (progn + (setq tabulated-list-sort-key '("Bookmark" . nil)) + (setq tabulated-list-entries entries)) + (setq tabulated-list-sort-key nil) + ;; And since we're not sorting by bookmark name, show bookmarks + ;; in reverse order of creation: most recently created at the + ;; top, least recently created at the bottom. + (setq tabulated-list-entries (reverse entries)))) (tabulated-list-print t)) =20 ;;;###autoload --=20 2.35.1 --=-=-=--