Troy Noble <troy.noble(a)channelpoint.com> writes:
Yoshiki,
You need to change:
+ (if auto-save-list-file-name
to
+ (if auto-save-list-file-prefix
Oops. Thanks! I'll post a fixed version to xemacs-patches.
Too many errors in one day...
Your patch addresses the problem if the auto-save-list-file-prefix
is
set in the user's initialization file. If they later toggle
auto-save-list-file-prefix to nil (like Steve did), the
auto-save-list-file-name will still be set to the value to which it was
initialized in normal-top-level unless the user also sets
auto-save-list-file-name to nil.
That's the second half of the problem Steve was alluding to I
believe.
Actually, I don't see it as a problem. Rather I think it
is a feature. The problematic example is:
1. Create a new file e.g. test and it is auto
saved. This will create #test# and ~/.saves-foo.
2. Then set auto-save-list-file-name to nil.
3. Save test or kill that buffer. This will remove #test#
but it won't remove ~/.save-foo because there's no way
XEmacs can know what was the auto-save list file.
Of course you can avoid this by calling save-some-buffers
but IMHO it should no be toggled in one session. It should
persist one session or you'll end up with a lot of .save-*
files left around after several sessions.
Here's some comment to your Lisp:
(defconst auto-save-default-list-file-prefix "~/.saves-"
"*Default value for auto-save-list-file-prefix.")
You need to use defvar or defcustom to declare user option
(indicated by * in doc-string). You also don't need to
create a new variable since value of
auto-save-list-file-prefix only affects recover-session
after auto-save-default-list-file-name is set.
(defun auto-save-make-list-file-name ()
"Make a name suitable for auto-save-list-file-name based on
auto-save-list-file-prefix. If auto-save-list-file-prefix is nil,
returns nil"
First sentence of doc-string should end sentence within
first line. (That is not a must, but it is recommended.)
Last sentence should be ended with .
[...]
(defun auto-save-disable-list-file ()
"Turn off creation of auto save list file by clearing the
auto-save-list-file-name and auto-save-list-file-prefix.
WARNING: Turning off auto save list file creation does not
disable auto saving, but will cause recover-session to
be unusable for files edited during this session"
(setq auto-save-list-file-prefix nil
auto-save-list-file-name nil))
Setting auto-save-list-file-prefix is not necessary.
(defun auto-save-enable-list-file ()
"Turn on creation of auto save list file by setting the
auto-save-list-file-name and auto-save-list-file-prefix."
(setq auto-save-list-file-prefix auto-save-default-list-file-prefix
auto-save-list-file-name (auto-save-make-list-file-name)))
Same here.
I agree it might be a good idea to add
auto-save-make-list-file-name but the only place safe to set
it is .emacs with the same reason above. It differs from
make-auto-save-file-name in that buffer-auto-save-file-name
is created per buffer basis and is a buffer local variable
while auto-save-list-file-name is a global one. You can
make it safe by setting old auto-save-list-file-name value
to some other variable and change some functions in fileio.c
to take care of that but I don't think it's worth the
effort.
--
Yoshiki Hayashi