From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Re: PATCH: bookmark.el LIFO preservation Date: Mon, 16 Jul 2007 09:02:56 -0700 Message-ID: <87wsx0nxov.fsf@red-bean.com> References: <877ip0myao.fsf@ambire.localdomain> Reply-To: Karl Fogel NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184602126 6657 80.91.229.12 (16 Jul 2007 16:08:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2007 16:08:46 +0000 (UTC) Cc: emacs-devel@gnu.org To: Thien-Thi Nguyen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 16 18:08:44 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 1IAT7s-0005yV-IN for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2007 18:08:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IAT7s-0000K6-3t for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2007 12:08:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IAT2J-0003Hr-LL for emacs-devel@gnu.org; Mon, 16 Jul 2007 12:02:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IAT2I-0003HU-V0 for emacs-devel@gnu.org; Mon, 16 Jul 2007 12:02:59 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IAT2I-0003HO-R0 for emacs-devel@gnu.org; Mon, 16 Jul 2007 12:02:58 -0400 Original-Received: from sanpietro.red-bean.com ([66.146.193.61]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IAT2I-0003FG-B9 for emacs-devel@gnu.org; Mon, 16 Jul 2007 12:02:58 -0400 Original-Received: from localhost ([127.0.0.1]:57987) by sanpietro.red-bean.com with esmtp (Exim 4.63) (envelope-from ) id 1IAT2H-0007t8-18; Mon, 16 Jul 2007 11:02:57 -0500 In-Reply-To: <877ip0myao.fsf@ambire.localdomain> (Thien-Thi Nguyen's message of "Mon\, 16 Jul 2007 12\:35\:11 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-detected-kernel: Linux 2.6 (newer, 3) 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:74900 Archived-At: Thien-Thi Nguyen writes: > 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? Thank you for the clear explanation and the fix! It'd be great if you would install it, yes. -Karl