> The hook that that applet installs on kill-emacs-hook is
probably
> broken.
That's what I thought, too, but it doesn't appear to be so.
Here is the hook function, from
xemacs-packages/edit-utils/saveplace.el:
(defun save-place-alist-to-file ()
(let ((file (expand-file-name save-place-file)))
(save-excursion
(message "Saving places to %s..." file)
(set-buffer (get-buffer-create " *Saved Places*"))
(delete-region (point-min) (point-max))
(print save-place-alist (current-buffer))
(let ((version-control
(cond
((null save-place-version-control) nil)
((eq 'never save-place-version-control) 'never)
((eq 'nospecial save-place-version-control)
version-control)
(t
t))))
(write-file file)
(kill-buffer (current-buffer))
(message "Saving places to %s...done" file)))))
Does anybody see anything wrong with that code? It looks to
me like all the hassles I had are due to write-file and
kill-buffer. What happens if write-file or kill-buffer
throws an error? We are processing a hook function, after all.
If an error is thrown, you will get an error. The result is you won't be
able to exit :(
We should probably trap errors around the kill-emacs-hook and convert to
warnings.
Another oddity was that everytime I tried this, I got another
buffer. Soon I had " *Saved Places*", " *Saved Places*<2>",
"
*Saved Places*<3>", etc. I didn't think get-buffer-create
was supposed to do that. The docstring certainly doesn't
suggest that that is acceptable behavior.
Strange ...