[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 22.1.90; desktop-save throws (error "No buffer named <uniquified buf
Re: 22.1.90; desktop-save throws (error "No buffer named <uniquified buffername>")
Fri, 8 Feb 2008 20:00:03 +0100
Well, yeah, but let's not exaggerate...
> Could you explain what is the problem, so we can try and find
> a cleaner workaround?
The original problem was that desktop.el saved the uniquified names,
so afterwards (in subsequent invocations of Emacs) the names were
"uniquified" but not really managed by uniquify. You started with A/C
and B/C, saved, reloaded, deleted A/C and still had B/C (instead of
The fix is simple: save the base name of the buffer instead of the
That was done by modifying the information returned by
`desktop-buffer-info', which is the information written to the desktop
file for each buffer.
That works fine, except that dired buffers are treated specially,
which triggers the OP problem.
When trying to decide whether a buffer has to be saved or not,
`desktop-save' passes the output of `desktop-buffer-info' to
`desktop-save-buffer-p', which in most cases only takes into account
the name of the visited file. For dired buffers, though, it also looks
at its second argument (the buffer name) to find the buffer. With my
previous change,that fails because the "buffer name" it gets is now
the base name, not the name of the real buffer (that was my mistake, I
didn't realize the special treatment of dired buffers).
Most fixes involve modifying the output of `desktop-buffer-info' to
return both the buffer-name and the base name; however, the list has
to be "fixed back" before saving it to the desktop. Or, alternatively,
you can opt *not* to modify the info list, and instead try to detect
whether the buffer is uniquify-managed at the point you're writing the
info list to the desktop; but that is also unclean because at that
point you shouldn't need to process any element of the list specially,
or know about its contents.
The cleanest fix would be to admit that the info list should have both
the buffer name and the base name. But that means bumping up the
version of the desktop file.
Re: 22.1.90; desktop-save throws (error "No buffer named <uniquified buffername>"), Martin Fischer, 2008/02/27