From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.devel Subject: PATCH: bookmark.el LIFO preservation Date: Mon, 16 Jul 2007 12:35:11 +0200 Message-ID: <877ip0myao.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1184582148 1406 80.91.229.12 (16 Jul 2007 10:35:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2007 10:35:48 +0000 (UTC) Cc: emacs-devel@gnu.org To: kfogel@red-bean.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 16 12:35:46 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IANvc-0007MJ-Ez for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2007 12:35:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IANvb-0005RY-Rm for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2007 06:35:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IANvR-0005RO-QZ for emacs-devel@gnu.org; Mon, 16 Jul 2007 06:35:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IANvQ-0005R4-ED for emacs-devel@gnu.org; Mon, 16 Jul 2007 06:35:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IANvQ-0005R1-1E for emacs-devel@gnu.org; Mon, 16 Jul 2007 06:35:32 -0400 Original-Received: from smtp-out1.libero.it ([212.52.84.41]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IANvP-0003jQ-6j for emacs-devel@gnu.org; Mon, 16 Jul 2007 06:35:31 -0400 Original-Received: from localhost (172.31.0.46) by smtp-out1.libero.it (7.3.120) id 4688F317015B1DDD for emacs-devel@gnu.org; Mon, 16 Jul 2007 12:35:30 +0200 X-Scanned: with antispam and antivirus automated system at libero.it Original-Received: from smtp-out2.libero.it ([172.31.0.38]) by localhost (asav-out5.libero.it [192.168.32.33]) (amavisd-new, port 10024) with ESMTP id WfR9QQ9gBvlo for ; Mon, 16 Jul 2007 12:35:29 +0200 (CEST) Original-Received: from MailRelay10.libero.it (192.168.32.119) by smtp-out2.libero.it (7.3.120) id 4611FD3807AA52C5 for emacs-devel@gnu.org; Mon, 16 Jul 2007 12:35:29 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAHfmmkaXFSCK/2dsb2JhbACBSA Original-Received: from ppp-138-32.21-151.libero.it (HELO ambire.localdomain) ([151.21.32.138]) by outrelay-b10.libero.it with ESMTP; 16 Jul 2007 12:35:28 +0200 Original-Received: from ttn by ambire.localdomain with local (Exim 4.63) (envelope-from ) id 1IANv5-00018s-NX; Mon, 16 Jul 2007 12:35:11 +0200 X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:74883 Archived-At: --=-=-= according to comments in bookmark.el, if `bookmark-sort-flag' is non-nil, the entries in the menu list are to be displayed in LIFO order. unfortunately, while `bookmark-maybe-sort-alist' currently does manage a properly non-destructive sort, it then goes on to assign the result to `bookmark-alist' anyway, thus losing the original order. entries have no timestamp, either, so the order cannot even be recovered. to see this behavior: (setq bookmark-sort-flag t) ; default t anyway (bookmark-bmenu-list) ; note lexical ordering (setq bookmark-sort-flag nil) (bookmark-bmenu-list) ; note lexical ordering (describe-variable 'bookmark-alist) the last form is not strictly necessary; i include it to demonstrate the lossage at the data-structure level. below is a small patch that makes the display option actually only affect display. here is a ChangeLog entry: * bookmark.el (bookmark-maybe-sort-alist): Don't modify bookmark-alist. Instead, if not sorting, simply return it. (bookmark-bmenu-list): Call bookmark-maybe-sort-alist for its return value, not for its side effect. do you mind if i install it? thi ________________________________________________________ --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=.ttn.bookmark.diff Index: bookmark.el =================================================================== RCS file: /sources/emacs/emacs/lisp/bookmark.el,v retrieving revision 1.94 diff -c -r1.94 bookmark.el *** bookmark.el 16 Jul 2007 02:16:00 -0000 1.94 --- bookmark.el 16 Jul 2007 10:11:25 -0000 *************** *** 1045,1054 **** ;;Return the bookmark-alist for display. If the bookmark-sort-flag ;;is non-nil, then return a sorted copy of the alist. (if bookmark-sort-flag ! (setq bookmark-alist ! (sort (copy-alist bookmark-alist) ! (function ! (lambda (x y) (string-lessp (car x) (car y)))))))) (defvar bookmark-after-jump-hook nil --- 1045,1054 ---- ;;Return the bookmark-alist for display. If the bookmark-sort-flag ;;is non-nil, then return a sorted copy of the alist. (if bookmark-sort-flag ! (sort (copy-alist bookmark-alist) ! (function ! (lambda (x y) (string-lessp (car x) (car y))))) ! bookmark-alist)) (defvar bookmark-after-jump-hook nil *************** *** 1590,1596 **** (insert "% Bookmark\n- --------\n") (add-text-properties (point-min) (point) '(font-lock-face bookmark-menu-heading)) - (bookmark-maybe-sort-alist) (mapcar (lambda (full-record) ;; if a bookmark has an annotation, prepend a "*" --- 1590,1595 ---- *************** *** 1613,1619 **** help-echo "mouse-2: go to this bookmark in other window"))) (insert "\n") ))) ! bookmark-alist)) (goto-char (point-min)) (forward-line 2) (bookmark-bmenu-mode) --- 1612,1618 ---- help-echo "mouse-2: go to this bookmark in other window"))) (insert "\n") ))) ! (bookmark-maybe-sort-alist))) (goto-char (point-min)) (forward-line 2) (bookmark-bmenu-mode) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--