GNU bug report logs - #13882
24.2; saveplace.el limit drop least recently used

Previous Next

Package: emacs;

Reported by: Kevin Ryde <user42 <at> zip.com.au>

Date: Tue, 5 Mar 2013 20:52:01 UTC

Severity: normal

Tags: patch

Found in version 24.2

Done: Karl Fogel <kfogel <at> red-bean.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 13882 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Kevin Ryde <user42 <at> zip.com.au>
Cc: Karl Fogel <kfogel <at> red-bean.com>, 13882 <at> debbugs.gnu.org
Subject: Re: bug#13882: 24.2; saveplace.el limit drop least recently used
Date: Thu, 07 Mar 2013 19:32:45 +0400
Kevin Ryde <user42 <at> zip.com.au> writes:
> When saveplace.el reaches save-place-limit, the file positions retained
> via ~/.emacs-places are the first limit-many in alphabetical order.
> I hoped instead it would be the first limit-many most recently used.
> Ie. drop the least recently visited files in order to enforce the limit.
>
> I struck this when I reached my save-place-limit with lots of files I
> had visited long ago but which happened to be alphabetically before ones
> I was visiting now.  The save-place feature no longer saved places
> across sessions for files I now visited.
> <example>

I can confirm that this is a problem, and it doesn't look "minor" in the
context of this package.

> ...
> I get some joy from not sorting save-place-alist when saving per change
> below.
>
> I believe save-place-to-alist keeps save-place-alist in "most recent
> first" order (by delq and re-push to move an existing entry to the
> start), and that that order should be preserved when saving.

I like the solution, but according to the ChangeLog the decision to sort
the list was made at the request of a user, who apparently has to merge
saveplace history files from time to time:

2010-12-29  Karl Fogel  <kfogel <at> red-bean.com>

	* saveplace.el (save-place-alist-to-file): Save list sorted and
	pretty-printed, so that it is mergeable by line-based text merging,
	as suggested by Iain Dalton <iain.dalton {_AT_} gmail.com>.

Paging the author.

Karl, do you think this consideration is still important? I don't see a
reasonable way to keep the list easy to merge and still retain the
"most-recently used" information.

You either keep the list unsorted (and continually shuffle the
elements), or store some timestamps, which will also be a source of
merge conflicts.

> 2013-03-04  Kevin Ryde  <user42 <at> zip.com.au>
>
> 	* saveplace.el (save-place-alist-to-file): Don't `sort'
> 	save-place-alist alphabetically, keep it in "most recent first" order.
> 	This ensures save-place-limit drops the least recently visited files,
> 	not the alphabetically last files.  Dropping alphabetically last files
> 	had meant save-place stopped working across sessions after
> 	.emacs-places filled with alphabetically early names.

--Dmitry




This bug report was last modified 12 years and 75 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.