4

I have a buffer with some data. I want to select part of buffer and open the selection in different buffer (and window) to make it easier to read for me. Is there some function that does it?

I am looking for something like clone-indirect-buffer-other-window, but for selection, not a whole buffer.

Drew
  • 75,699
  • 9
  • 109
  • 225
MatthewRock
  • 1,453
  • 13
  • 27
  • `narrow-to-region` ... and if you like using `org-mode`, there are some `narrow-to-subtree...` functions. The code behind the scenes use that all the time to limit the scope of the buffer that is being operated on. And, when you are done, you can `widen` and/or exit the indirect buffer. – lawlist Aug 21 '17 at 00:42
  • @lawlist Why did you write that in comment question? It looks like a valid answer. – MatthewRock Aug 21 '17 at 00:56
  • I generally write comments instead of answers because it's quick (and I'm usually just in between projects, such as compiling something with a minute or two of down-time to see the latest activity on the net) ... it looks like Drew has it covered. :) – lawlist Aug 21 '17 at 01:03
  • @lawlist But I want to upvote you, since it helps me and I don't have to download anything else! – MatthewRock Aug 21 '17 at 01:09
  • Could you please try `jac.el` available [at github](https://github.com/TobiasZawada/jac/blob/master/jac.el)? After installing `jac.el` you just need the command `jac` to clone the current buffer. The advantage of `jac` is that it only synchronizes text but no text properties. `font-lock` should work in both buffers independently. – Tobias Jan 16 '19 at 11:50

2 Answers2

4

See library Narrow Indirect (code: narrow-indirect.el).

It lets you create an indirect buffer that is a clone of the current buffer and that is narrowed to a particular portion of it.

Such an indirect buffer gives you a different view of a portion of the buffer, or even of the whole buffer (use C-x h C-x 4 n n). It always has the same text and text properties, but otherwise it is pretty independent.

Drew
  • 75,699
  • 9
  • 109
  • 225
1

There is also edit-indirect.

It lets you create an completely independent buffer which might use a different major-mode, too. You can edit this buffer and commit you changes back to the original buffer when done.

clemera
  • 3,401
  • 13
  • 40