1. Frank Fischer
  2. evil
Issue #205 wontfix

Use clone-indirect-buffer instead of split-window

created an issue

When splitting windows, the split-window* emacs commands are used, which simply create a new window that uses the same buffer (see http://superuser.com/a/338412 for some details). It would be nice (and somehow more vim-like) to use clone-indirect-buffer for splitting windows, since then fold state, etc. are independent from one window to another.

Comments (7)

  1. Frank Fischer repo owner
    • changed status to open

    While I understand the intention, I'm not sure if using clone-indirect-buffer is the right way. Using it for splitting windows would create a new buffer each time, and those buffers are not removed when some window is closed again. Thus you would end up with a large bunch of indirect buffers, wouldn't you? I'm not too familiar with indirect buffers, but unless I'm wrong this is what the manual implies. So how could you resolve that many-unused-indirect-buffers problem?

  2. edgimar reporter

    I don't know if it would work, but what I can picture is keeping track of the indirect buffers created when a main ('direct') buffer is split, and then adding a hook so that when closing a window, if it is in a buffer in the "evil" list of indirect buffers, it gets killed too. This shouldn't cause any problems, since the content of indirect buffers is always kept in sync with the main buffer it was split from (as far as I understand), so killing an indirect buffer won't cause any information loss.

  3. Frank Fischer repo owner

    (Reply via fran...@mathematik.tu-chemnitz.de):

    I'm not sure if it is so easy. You also have to consider what happens if someone shows some buffer in another window (two showing the same buffer - when should the buffer be deleted?) using non-evil commands, what happens if the original buffer is closed (this also removes the indirect buffers) and probably other non-trivial situations. IMO it can be quite tough to do it right. I wonder if there is some Emacs package out there that manages stuff like this? I would prefer utilizing an external package instead of doing all stuff within evil (because it may be useful in general, with or without evil).

  4. edgimar reporter

    One of the motivating use-cases for me of using indirect-clones is being able to have diferent folding in different windows. That is not possible with direct clones, nor is it possible using winpoint.el, etc. which only allow for different point locations in the window.

  5. Frank Fischer repo owner

    Fair enough. But still, I suggest that you look for a (or develop one ;)) package that provides a concise set of functions that deal with multiple windows and indirect buffers in a compatible way. IMO this is beyond the scope of evil, it's more a general Emacs pproblem. And I'm quite sure that a package solving it is also interesting for other non-evil Emacs users, so an external package is probably the best way to go. (As far as I can tell, it would not need any of the infrastructure provided by evil, so it would be an independent part anyway).

    Because of this I will mark this issue as wont-fix. But please feel free to discuss this issue on the mailing list or maybe develop a package that fits your needs. Once it is ready, we'll be happy to provide the appropriate key-bindings or whatever in evil, either directly in the core package or as extension package.

  6. Log in to comment