Subject: Re: bug#73663: 29.4; indirect-buffer behaviour is not correct

From: PENG Kevin <[email-masked]>
Date: Mon, 07 Oct 2024 22:34:27 +0800

Yes, i know "C-c C-c" can preview the image directly.
But the case needed is to use one major-mode to edit,
and another major-mode to preview the result, with two
seperate windows. The svg edit is only one case for such
usages. As this document mentioned:
[[https://www.gnu.org/software/emacs/manual/html_node/emacs/Indirect-Buffers.html]]
#+BEGIN_QUOTE
The text of the indirect buffer is always identical to the text of its base
buffer;
changes made by editing either one are visible immediately in the other.
“Text” here includes both the characters and their text properties.
But in all other respects, the indirect buffer and its base buffer are
completely separate.
They can have different names, different values of point, different narrowing,
different markers, different overlays, different major modes, and different local variables. 
#+END_QUOTE

Seems the indirect-buffer also not work for any of other major modes.
fundamental-mode, org-mode, elisp-mode, ...
Almost all of the major-mode i know are failure.

Eli Zaretskii <[email-masked]> writes:

> [+]
>> From: PENG Kevin <[email-masked]>
>> Date: Sun, 06 Oct 2024 23:42:41 +0800
>> 
>> I have a .svg file want to edit in nXML-mode, and at the same time
>> want to preview the image with image-mode.
>> So i create one indirect-buffer by using =clone-indirect-buffer=,
>> then a new buffer is created, and i change the major-mode of
>> the indirect-buffer to image-mode, the original buffer's preview
>> changed to image-mode, but its major-mode is still nXML-mode.
>
> I guess that's because major-mode-suspend, which image-mode calls to
> be able to switch back to the original major mode, doesn't support
> indirect buffers.  Stefan, am I right?  Can this be fixed?
>
> Regardless, I don't really understand why you need a separate indirect
> buffer in this case: just typing "C-c C-c" will toggle the buffer
> between nXML mode and image mode, so previewing is simple and needs no
> other buffer.  Am I missing something?

-- 
Best Regards.