[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Opening multiple files in a single buffer?

From: Gregory Heytings
Subject: Re: Opening multiple files in a single buffer?
Date: Sat, 13 Jun 2020 16:53:48 +0000
User-agent: Alpine 2.21 (NEB 202 2017-01-01)

Douglas Lewan:

I've now been using Emacs for many, many years, and there is perhaps a single feature I'm really missing, namely opening more than one file in a single buffer, with the contents of the files appearing one after the other in the same buffer, with some kind of visual separator between them. I don't know if that feature exists in other text editors.

For example, suppose you write a book, which has fifteen chapters in files chap1.tex, ..., chap15.tex.  Opening these files in a single buffer means that you could use isearch-{forward,backward} in the whole book.  (I know that multi-isearch-buffers could be used in this particular case, but it is not as convenient to use.)  You could also use query-replace on the whole book, or reindent all files, or execute shell-command on all files at once, and so forth.  (Again I know that all this can be done with already existing features, e.g. through dired, but again I find them not as convenient as what I have in mind.)

Each file would have its own major and minor modes, and the mode-line would adapt depending on the file corresponding to the buffer portion in which the point is currently located.

My question is: Is this feasible, or is the one-to-one correspondence between buffers and files too deeply rooted in Emacs' codebase that it is not feasible?  If it is feasible, could this feature be considered for implementation in a future Emacs version?

I would say it's feasible, but probably awkward as stated. An application that implements something similar via a sequence of buffers with a way of navigating next and previous and providing appropriate commands via a (map) function would probably be simpler to build and manage. It would also be much more natural.

In fact, what I have in mind is not an additional application, but a core feature, that would be transparent (or almost transparent) to everything else. It would not require a rewrite of any command. For example it would also be possible to narrow the (multi-file) buffer to the last X lines of a file and the first Y lines of the next file in the buffer.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]