From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud Newsgroups: gmane.emacs.devel Subject: Re: [External] : [emacs bookmark.el] Sorting by last set Date: Tue, 07 Jun 2022 17:55:57 +0200 Message-ID: <87tu8wwjqq.fsf@elite.giraud> References: <875ylhvu4k.fsf@red-bean.com> <87a6ar84rn.fsf@elite.giraud> <875yle7ryg.fsf@elite.giraud> 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="36879"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (berkeley-unix) Cc: Stefan Monnier , Karl Fogel , Lars Ingebrigtsen , emacs-devel To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 07 18:02:21 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 1nybev-0009LB-Mr for ged-emacs-devel@m.gmane-mx.org; Tue, 07 Jun 2022 18:02:21 +0200 Original-Received: from localhost ([::1]:36164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nybet-0001qA-Ux for ged-emacs-devel@m.gmane-mx.org; Tue, 07 Jun 2022 12:02:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nybYt-0006tO-Sg for emacs-devel@gnu.org; Tue, 07 Jun 2022 11:56:07 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]:35538) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nybYp-0002YG-81 for emacs-devel@gnu.org; Tue, 07 Jun 2022 11:56:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=yh9P908UPoZ3BnAP 9DSkOxhfmlboqQG8J6RIn33J9zw=; h=in-reply-to:date:references:subject: cc:to:from; d=ledu-giraud.fr; b=i3JxP8AIacPzoEzEnrtOodHI23tt0WFlgLwHcI qADST24oOYlOEpxOwJ04m9gLDbSIRCRPEazOLc5Xb5e9shZVjI5aneraIjUlWMIS92QX2v ZJIcXIDOaqXBe+x4EX0IvsKaDwzVId5Bw+9erOE01QJbHhPLS9XBOIZtESEBZinCNO7zFj Elb4zwjP89ly/dZtGrDAUQcSbwM4/1p/3daFV0up3McRoL/6NlmUtGtfS4n+8GrLgU4NSl TkRHR7JOAICCIrT+S8pJGOUBc96x838SkwZlVwr/6EHbcsGkDb1gmrrDOFdx8/5F+ZOBl8 JtlkUqttHlIVKHcZ4EpDI5qQ== Original-Received: from elite.giraud ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id f44db76e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 7 Jun 2022 17:55:58 +0200 (CEST) In-Reply-To: (Drew Adams's message of "Mon, 6 Jun 2022 00:39:09 +0000") Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr 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:290866 Archived-At: --=-=-= Content-Type: text/plain Drew Adams writes: >> > It works for this "setting" and RE-"setting" but not for annotations >> > change nor renaming. Maybe "set" is not a good name. Why not >> > "placed"? As a bookmark in book? >> >> Why not change the code so that any change (renaming, >> annotation tweaks, ...) update the timestamp? > > ... which was also my suggestion. As the > default, at least. Ok. Here is a patch for this default. I kept the 'last-modified name but now annotations editing, renaming or relocation of a bookmark will update this field. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-last-modified-meaning-in-bookmark.el.patch >From b3b131b3e3ec9b338fae431e3f54e2e435e5d8d1 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Tue, 7 Jun 2022 17:35:02 +0200 Subject: [PATCH] Fix last-modified meaning in bookmark.el Renaming, relocating or editing annotations of a bookmark now updates the last-modified field. * lisp/bookmark.el (bookmark-update-last-modified): new function to update the last-modified field. (bookmark-send-edited-annotation, bookmark-relocate) (bookmark-rename): use `bookmark-update-last-modified' in annotations editing, relocation and renaming. --- lisp/bookmark.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 849303fac7..b0b54e52d8 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -120,7 +120,7 @@ bookmark-sort-flag recently created ones come first, oldest ones come last). `last-modified' means that bookmarks will be displayed sorted -from most recently set to least recently set. +from most recently modified to least recently modified. Other values means that bookmarks will be displayed sorted by bookmark name." @@ -468,10 +468,17 @@ bookmark-get-handler "Return the handler function for BOOKMARK-NAME-OR-RECORD, or nil if none." (bookmark-prop-get bookmark-name-or-record 'handler)) + (defun bookmark-get-last-modified (bookmark-name-or-record) "Return the last-modified for BOOKMARK-NAME-OR-RECORD, or nil if none." (bookmark-prop-get bookmark-name-or-record 'last-modified)) + +(defun bookmark-update-last-modified (bookmark-name-or-record) + "Update the last-modified date of BOOKMARK-NAME-OR-RECORD to the current time." + (bookmark-prop-set bookmark-name-or-record 'last-modified (current-time))) + + (defvar bookmark-history nil "The history list for bookmark functions.") @@ -1069,6 +1076,7 @@ bookmark-send-edited-annotation (from-bookmark-list bookmark--annotation-from-bookmark-list) (old-buffer (current-buffer))) (bookmark-set-annotation bookmark-name annotation) + (bookmark-update-last-modified bookmark-name) (setq bookmark-alist-modification-count (1+ bookmark-alist-modification-count)) (message "Annotation updated for \"%s\"" bookmark-name) @@ -1355,6 +1363,7 @@ bookmark-relocate (format "Relocate %s to: " bookmark-name) (file-name-directory bmrk-filename)))))) (bookmark-set-filename bookmark-name newloc) + (bookmark-update-last-modified bookmark-name) (setq bookmark-alist-modification-count (1+ bookmark-alist-modification-count)) (if (bookmark-time-to-save-p) @@ -1417,6 +1426,7 @@ bookmark-rename nil 'bookmark-history)))) (bookmark-set-name old-name final-new-name) + (bookmark-update-last-modified final-new-name) (setq bookmark-current-bookmark final-new-name) (bookmark-bmenu-surreptitiously-rebuild-list) (setq bookmark-alist-modification-count -- 2.36.0 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=--