Subject: bug#16904: 24.3; [PATCH] ff-find-other-file and friends now work with indirect clone buffers

From: Stefan Monnier <[email-masked]>
Date: Mon, 10 Mar 2014 01:00:51 -0400

>> Multiple narrowing within the same buffer is indeed not supported, but
>> we could easily add commands to "hide everything but the current region"
>> which are per-window, where "hide" means "make invisible" rather than
>> making it completely inaccessible as narrowing does.
> Is the intent for this to replace narrowing?

Not "replace", but yes, it would be a new similar feature.

> I think it would be confusing to have two very similar but subtly
> different mechanisms for doing the same thing.

Agreed.  But if we want several separate narrowings at the same time in
a single buffer (i.e. without using indirect buffers), then I think
that's what it would look like.

I imagine it would come as an Elisp package which would replace C-x n n,
for those rare users like you who want such a functionality.

>> As for separate mark-rings, I'm not sure what alternative I can offer.
>> Maybe we could have some kind of new command `pop-to-nearest-mark'?
> Maybe. That's brittle, though.

Yes, clearly.

> Here's another way in which an indirect view into a buffer is better
> than another window: iswitchb (and maybe other C-x b methods too) sorts
> already-visible windows last. This usually results in way more typing
> when trying to switch in this way.

Interesting point, indeed.

> Hmmm. You could set the buffer-file-name variable when the indirect
> buffer is created.

It's set to nil to avoid problems linked to having to handle "multiple
buffers accessing the same file".  We'd otherwise have to add special
code so that (for example) when you save one of the buffers, the
others's states are correspondingly updated (otherwise they'd think that
some external process changed the file).

> I guess I just don't know about (and haven't seen any) fundamental
> breakage in indirect buffers, so my current instinct is to try to fix
> it, rather than switch to something else entirely.  Most of the issues
> I've seen are small things, like modules that use (buffer-file-name).

There's some major breakage lurking with most modes that use
things like text-properties or after-change-functions.

A way to "fix" things might be to restrict the use of indirect clones so
they are read-only.

> What issues are there with indirect buffers? The default C-x 4 c binding
> makes an indirect clone, so it's not THAT obscure.

I know.  It seemed like a good idea at the time ;-(

        Stefan