bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13882: 24.2; saveplace.el limit drop least recently used


From: Karl Fogel
Subject: bug#13882: 24.2; saveplace.el limit drop least recently used
Date: Thu, 07 Mar 2013 15:20:37 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Dmitry Gutov <dgutov@yandex.ru> writes:
>Kevin Ryde <user42@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@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.

Hmmm.  I see your point, and, of course, there are arguments both ways.

We could supply an user-option to control the behavior, but that still
leaves the question of which default we should choose...

However, I think the answer to that is also clear: unsorted should be
the default (or rather, chronologically sorted should be the default),
and if a user wants the list alphabetized (for merge purposes), they can
configure it so.  And this would be documented not only in the new
variable, but also in the doc string of `save-place-limit'.

What do you think?

-Karl

>> 2013-03-04  Kevin Ryde  <user42@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]