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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Kevin Ryde <user42 <at> zip.com.au>
Subject: bug#13882: closed (Re: bug#13882: 24.2; saveplace.el limit drop
 least recently used)
Date: Wed, 13 Mar 2013 19:01:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 13882 <at> debbugs.gnu.org.

-- 
13882: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13882
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Karl Fogel <kfogel <at> red-bean.com>
To: Kevin Ryde <user42 <at> zip.com.au>
Cc: Ian Dalton <iain.dalton <at> gmail.com>, 13882-done <at> debbugs.gnu.org,
	Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#13882: 24.2; saveplace.el limit drop least recently used
Date: Wed, 13 Mar 2013 13:59:12 -0500
Kevin Ryde <user42 <at> zip.com.au> writes:
>Ian Dalton <iain.dalton <at> gmail.com> writes:
>> I no longer use this setup, so I don't know how useful a change it was. I
>> think that the Unison UI had some kind of option to do guided file merges,
>> but it only worked for the usual simple line-oriented diff.
>
>Hmm.  Making the file line-wise probably helped, but I imagine there's
>no file format which could give the perfect result from the usual
>diff/patch contextual merges.
>
>How about keeping the line-by-line pretty print for everyone's
>readability, but drop the sort since it's actively harmful, and leave
>anything more for future thought.

Done; see revision below.  Thanks, Dmitry, Kevin, and Ian, for your
thorough & patient explanations.

  ------------------------------------------------------------
  revno: 112040
  revision-id: kfogel <at> red-bean.com-20130313185405-ibq2um8vj55d4x0a
  parent: eggert <at> cs.ucla.edu-20130313184222-yq69wjnyhzd6o40d
  committer: Karl Fogel <kfogel <at> red-bean.com>
  branch nick: trunk
  timestamp: Wed 2013-03-13 13:54:05 -0500
  message:
    * saveplace.el (save-place-alist-to-file): Don't sort
    `save-place-alist', just pretty-print it (bug#13882).
  modified:
    lisp/ChangeLog      changelog-20091113204419-o5vbwnq5f7feedwu-1432
    lisp/saveplace.el   saveplace.el-20091113204419-o5vbwnq5f7feedwu-622
  ------------------------------------------------------------

-Karl

[Message part 3 (message/rfc822, inline)]
From: Kevin Ryde <user42 <at> zip.com.au>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2; saveplace.el limit drop least recently used
Date: Wed, 06 Mar 2013 07:49:14 +1100
[Message part 4 (text/plain, inline)]
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.

The effect can be seen by setting a small limit per init.el below.  Then
foo.el to visit three files successively

    HOME=`pwd` emacs -Q -l ./init.el -l ./foo.el

This leaves .emacs-places (in the current directory due to faked $HOME)
containing

    (("/tmp/aa" . 4)
     ("/tmp/bb" . 4)
     ("/tmp/cc" . 4))

Notice /tmp/cc was the most recently visited file but it's at the end of
the list and will be truncated when load-save-place-alist-from-file
enforces save-place-limit of 2.

    HOME=`pwd` emacs -Q -l ./init.el /tmp/cc
    =>
    point is at start of buffer /tmp/cc
    I hoped it would be at the end from the last visit

Note that you must exit and restart emacs to see the effect, because
save-place-limit is only enforced by load-save-place-alist-from-file.
Within a session there's no limit, only in reading the .emacs-places
file on restarting emacs.

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.

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.

[init.el (application/emacs-lisp, attachment)]
[foo.el (application/emacs-lisp, attachment)]
[saveplace.el.nosort.diff (text/x-diff, attachment)]
[Message part 8 (text/plain, inline)]


In GNU Emacs 24.2.1 (i486-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-09-10 on biber, modified by Debian
Configured using:
 `configure '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.2/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
 'build_alias=i486-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_AU
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default enable-multibyte-characters: t

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.