Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for handling cloned indirect buffers #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dankessler
Copy link

Currently, if a user clones a buffer (with e.g., 'clone-indirect-buffer'), the
new clone will not be added to the current perspective.

This can be a little surprising: suppose I'm working on buffer native.txt in my current perspective and I call clone-indirect-buffer. I'll now have native.txt<2> displayed, but it is not in the current perspective.

I think the most reasonable behavior is for persp-mode to automatically add freshly cloned indirect buffers to the current workspace if the base-buffer is already in the current perspective (e.g.., if you are temporarily displaying buffer foreign.txt and then clone it, the new clone foreig.txt<2> probably should respect your wishes and not add itself to the current workspace).

However, I appreciate that users will have different tastes, so I've added a new customization option so they can restore the old behavior (nil), use what I think is the most natural behavior (t, the new default), or can set it to ('always') so that cloning always adds the newly cloned indirect buffer to the current perspective regardless of whether the base-buffer is a member or not.

I'm open to changing the default to nil, which would retain the "old" behavior and avoid annoying anyone that was relying on it, but I suspect there aren't many people who clone buffers that do not want them added to the current workspace.

Currently, if a user clones a buffer (with e.g., 'clone-indirect-buffer'), the
new clone will not be added to the current workspace.

Add new customizable option to allow user to specify what should be done when an
indirect buffer is created via cloning. By default (t or non-nil), if a buffer
is created via cloning, it is added to the current perspective only if its
associated base-buffer is also in the current perspective. Option can be set to
nil to never automatically add clone indirect buffers, or to 'always to add a
clone to the current perspective regardless of whether the base-buffer is in the
current perspective.
@dankessler
Copy link
Author

After using the patched version for a bit, I realize that this does not improve the behavior of indirect buffers created using Org-Mode's convenience functions (e.g., org-tree-to-indirect-buffer), since these call make-indirect-buffer directly rather than using any of the clone* commands. Unfortunately, as far as I can tell make-indirect-buffer does not have any associated hooks that could be exploited to modify behavior, but I'll try to think of a way to make this play nice with Org.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant