Juri Linkov writes: >> I note that `bury-buffer' removes the buffer from the frame-local >> buffer lists of all frames, not just the selected one. This is an >> unwanted side-effect in this case, as we want the effects of >> `next-buffer' to remain frame-local. I propose to add an optional >> parameter to `bury-buffer' to support this. > > I think this change should be made for all invocations of > `bury-buffer', not only from `next-buffer'. [...] And so there is no > need for a new optional parameter. That's fine by me. > Also I think recoding a buffer to the new frame parameter should be > made in `bury-buffer' instead of `next-buffer'. Some commands call `bury-buffer' > directly, and it would be good to record their buffers in the > frame-local parameter. Ah, good idea. I implemented this in the patch at the end of this message. It involves adding a new element to the frame struct, and changing switch-to-buffer, bury-buffer and kill-buffer etc. to maintain the list. > Instead of introducing a new frame parameter `previous-buffer-list' > what do you think about reusing the existing frame parameter `buffer-list'? > It could have a special marker delimiting a list of frame's "next" visited > buffers and "previous" visited buffers. A nil value could serve as > such special marker. So for example, (frame-parameter nil 'buffer-list) > could contain: > > (# # nil # #) I thought of this as well, but it would be an incompatible change that is not strictly necessary. The 'buffer-list frame parameter has been in Emacs since (I think) 1997; some external packages may rely on its current contents. Also, using a special marker seems a bit less clean to me than using a separate parameter. (It is also less efficient.) The below patch also renames `prev-buffer' to `previous-buffer', and extends it to support the buffer-predicate frame parameter. It incorporates all fixes that have been suggested in this thread, except for the customization option for disabling frame-local behaviour. (`other-buffer' has been unconditionally using the frame-local buffer list for years; I don't see a point in making it configurable for next-buffer/previous-buffer either.) If there are no objections, I will document the changes and install them in CVS.