unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Buffers with buffers (transclusion)
@ 2024-10-15 13:53 Vladimir Kazanov
  2024-10-15 14:45 ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Vladimir Kazanov @ 2024-10-15 13:53 UTC (permalink / raw)
  To: emacs-devel

Hi all,

Recently I got interested in the best way to share text between buffers.

This is very useful, and was discussed a bunch of times in the past
(https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg00141.html,
https://lists.gnu.org/archive/html/emacs-devel/2018-07/msg00863.html).
There's also a nice overview of these discussions on Github:
https://github.com/alphapapa/transclusion-in-emacs.

My personal interest was sparkled by a prototype of a tool I published
recently (https://github.com/vkazanov/chunk-edit) that makes it
possible to edit multiple buffers from within a single host one.

I would love some advice on what approach Emacs maintainers might be
interested in. Here's are the ideas I have going from easy to hard:

1. Just track and copy all buffer edits using, say, overlay hooks.
This is what I did in chunk-edit.el. The problem with this approach is
inefficiency and brittleness.

2. Introduce indirection on the deepest possible level, e.g., come up
with something like composite buffers (buffers consisting of multiple
buffers), or make buffers use segments internally.

3. Make the iterator in xdisp.c understand a new display spec -
(display . buffer), which would make it possible to display external
buffers within the current buffer. From what I see right now (xdisp.c
is not the easiest piece of code), this would make the text not
editable and is not the same use-case I had in mind but might open up
a bunch of  interesting capabilities.

Did anybody look into something like this recently? Any
comments/ideas/guidance would be great.

--
Regards,

Vladimir Kazanov



^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: Buffers with buffers (transclusion)
@ 2024-10-15 17:57 Christopher Howard
  2024-10-16 10:48 ` Vladimir Kazanov
  0 siblings, 1 reply; 20+ messages in thread
From: Christopher Howard @ 2024-10-15 17:57 UTC (permalink / raw)
  To: Vladimir Kazanov; +Cc: Eli Zaretskii, emacs-devel

Hi, *chunk-edit* seemed like a very appealing idea to me, so I tried it right away this morning. My use case was editing two chunks of elisp code that were very far apart in a single file.

However, for me the fatal issue is that chunk-edit-mode replaces the active major mode, so that indentation, and presumably other things, are not handled properly. I think any approach to this has to deal with that properly — maintaining the correct major mode in chunk.

It think my particular use case could instead be handled with zones.el. Not sure about the case where you have, e.g., someone wanting to edit a region in a C header file and a region in a C source file, in the same buffer. I suppose that might be useful, e.g., when using search and replace macros and such like.

-- 
Christopher Howard



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2024-10-19  0:25 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 13:53 Buffers with buffers (transclusion) Vladimir Kazanov
2024-10-15 14:45 ` Eli Zaretskii
2024-10-15 15:01   ` Vladimir Kazanov
2024-10-16 22:44     ` James Thomas
2024-10-17  6:27       ` Eli Zaretskii
2024-10-17  8:38         ` Vladimir Kazanov
2024-10-17 11:00           ` Eli Zaretskii
2024-10-17 11:38             ` Vladimir Kazanov
2024-10-17 12:59               ` Eli Zaretskii
2024-10-17 13:24                 ` Vladimir Kazanov
2024-10-17 15:15                   ` Eli Zaretskii
2024-10-17 14:36             ` Suhail Singh
2024-10-17 15:19               ` Eli Zaretskii
2024-10-17 16:28                 ` Suhail Singh
2024-10-17 17:18                   ` Eli Zaretskii
2024-10-18  9:25                     ` Vladimir Kazanov
2024-10-19  0:25                       ` Suhail Singh
2024-10-17 14:09           ` James Thomas
  -- strict thread matches above, loose matches on Subject: below --
2024-10-15 17:57 Christopher Howard
2024-10-16 10:48 ` Vladimir Kazanov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).