emacs/var/elfeed/db/data/ae/aeafcdc896c97046dc446a0539fd37ef318661f4
2022-01-03 12:49:32 -06:00

9 lines
1.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>Mickey Petersen tweets about cloning buffers and makes explicit a distinction that I must admit I wasnt clear on.</p>
<blockquote class="twitter-tweet">
<p dir="ltr" lang="en">You can clone indirect buffers in <a href="https://twitter.com/hashtag/emacs?src=hash&amp;ref_src=twsrc%5Etfw">#emacs</a> with C-x 4 c — very useful if you want to browse two or more parts of a large file. Changes in either is reflected in all the others.</p>
<p>(But if you want them totally separated, use M-x clone-buffer or C-x x n)</p>
<p>— Mickey Petersen (@mickeynp) <a href="https://twitter.com/mickeynp/status/1468346621419298820?ref_src=twsrc%5Etfw">December 7, 2021</a></p></blockquote>
<p></p>
<p>Im pretty familiar with indirect buffers, which are a clever way of looking at a buffer with two different views: you can have different narrowings, point positions, modes, and other properties while still maintaining identical text. Text changes made to the indirect buffer or the base buffer are instantly reflected in the other. Its almost always what you want but sometimes its convenient to simply make an independent copy of a buffer.</p>
<p>Mickeys tweet shows you how to do either. Oddly, I couldnt find <code>clone-buffer</code> in the manual but its documentation available with <code>describe-function</code> (<kbd>Ctrl</kbd>+<kbd>h</kbd> <kbd>f</kbd>) and has been around for a long time.</p>
<p>As I said, you almost always want <code>clone-indirect-buffer</code> or its siblings. Ive used it a few times but Ive never used <code>clone-buffer</code>. Still, its nice to know theyre both available. As usual, Emacs has us covered.</p>