Subject: RE: bug#17401: 24.4.50; Narrow to {region,page,defun} in an indirect clone buffer in the other window

From: Drew Adams <[email-masked]>
Date: Sat, 10 May 2014 21:12:44 -0700 (PDT)

> I was initially against the idea of naming the indirect buffer
> according to the narrowed region, for the simple reason that the
> name stops making sense as soon as you widen the buffer.
> 
> However, I expect that people are far less likely to widen these
> buffers (as opposed to simply killing them); and this naming
> approach would certainly be useful in the buffer list, so I think
> it's a good idea after all.
> 
> I've also noticed there are some org-mode specific narrowing
> commands as well, which should probably be supported. I did
> consider whether we could support all existing narrowing commands
> automagically with some trickery, but I concluded that the only
> approach I could think of was too convoluted and brittle for its
> own good, so I think simply adding a new function alongside each
> existing one is still the most practical way to go.
> 
> Do we want both a `narrow-to-*-indirect' and an `...-other-window'
> variant for each case? I think the latter works very nicely with
> the C-x 4 n prefix (as per the initial patch), but I can see the
> utility in providing both functions.

I agree about killing vs widening indirect buffers.  And I
don't find a need for same-window versions of the commands,
for my own use.

FWIW, attached is what I've been using lately.

The default buffer naming is similar to what Lennart suggested,
but (for the non-defun command) the region text (with whitespace
collapsed) is used, not the first line.  And the buffer-name
length is limited.  And the text following the original name is
separated by ` | ' instead of being enclosed in <...>.

Two options control naming: one limits the length, the other
is a name prefix (e.g., to easily distinguish indirect buffers).

A prefix arg prompts you for the new buffer name.

For defun narrowing, a negative prefix arg prompts you for the
text that follows ` | ' (in place of the defun object name).

To me, being able to provide names different from the default
is important.

--

(FWIW, I also use library `wide-n.el', which lets you widen
to any number of narrowings of the same buffer - e.g., cycle.
http://www.emacswiki.org/emacs-de/MultipleNarrowings)