Yoshiki,
You need to change:
+ (if auto-save-list-file-name
to
+ (if auto-save-list-file-prefix
But please read my code below too since it replaces this section with a
call to a new function.
I agree a patch is a good idea because it fixes the problem for most users,
but the one provided will not fix it in all cases (see code below that I
think does).
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.
Steve, I was setting auto-save-list-file-prefix to nil in my init file,
that's probably why I saw different behavior than the test case you
showed (you were exec'ing the setq in the *scratch* buffer I believe).
I would propose a more permanent solution by adding the following to
startup.el,
or maybe files.el. Not sure which is better.
One added benefit to this approach is that the user can now define their own
auto-save-make-list-file-name in similar fashion to
make-auto-save-file-name.
Oooohhhhh! I just got a warm fuzzy! More configuration options, that's
just what XEmacs needs!
I'm no lisp expert... so forgive any style errors, and feel free to change
the names as desired. The code does seem to work though.
(defconst auto-save-default-list-file-prefix "~/.saves-"
"*Default value for auto-save-list-file-prefix.")
(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"
(if auto-save-list-file-prefix
(expand-file-name
(format "%s%d-%s"
auto-save-list-file-prefix
(emacs-pid)
(system-name)))
nil))
(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))
(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)))
Then inside normal-top-level you can change:
+ (if auto-save-list-file-name
+ (setq auto-save-list-file-name
+ (expand-file-name
+ (format "%s%d-%s"
+ auto-save-list-file-prefix
+ (emacs-pid)
+ (system-name)))))
to:
+ (setq auto-save-list-file-name (auto-save-make-list-file-name))
since that code has been moved to the function instead.
Troy
-----Original Message-----
From: Yoshiki Hayashi [mailto:yoshikiï¼ xemacs.org]
Sent: Wednesday, October 25, 2000 2:11 AM
To: Steve Youngs
Cc: Troy Noble; XEmacs beta; 'Adrian Aichner'; xemacs-patches(a)xemacs.org
Subject: Re: auto-save-list-file-name
Steve Youngs <youngs(a)xemacs.org> writes:
In the scratch buffer:
(setq auto-save-list-file-prefix nil)
M-x eval-current-buffer
C-x C-f ~/temp/fred RET
C-x C-s
<bang on the keyboard repeatedly until 'auto-save-interval' expires>
The result:
,----[ ~/nil5896-slackware.mynet.pc ]
| /home/steve/temp/#fred#
| /home/steve/temp/fred
`----
This patch fixes it. Recommended for 21.1.
2000-10-25 Yoshiki Hayashi <yoshiki(a)xemacs.org>
* startup.el (normal-top-level): Set up auto-save-list-file-name
iff auto-save-list-prefix is non-nil.