[Top][All Lists]

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

Re: Opening multiple files in a single buffer?

From: Jakub Jankiewicz
Subject: Re: Opening multiple files in a single buffer?
Date: Sat, 13 Jun 2020 20:41:21 +0200

On Sat, 13 Jun 2020 11:10:00 -0700
Dan Hitt <> wrote:

> On Sat, Jun 13, 2020 at 7:41 AM Gregory Heytings <> wrote:
> >
> > .....
> >
> > 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.
> >
> >
> >  
> Another application would be to open all the code files in a directory into
> a single buffer, and do replace-string or query-replace on all of them, to
> rename variables, for example.  You'd want to be able to mark the
> sub-buffers read-only or not independently, since (e.g.) not all of them
> might be owned by the same account.  And you might want to make a provision
> so that one file could appear more than once in the linear list of
> sub-buffers (as could happen naturally with links).
> I think your idea is a real winner.
> I have no idea how hard it would be to implement, but could it be just a
> matter of making a new kind of buffer, say a multi-file buffer, and then
> just specifying the new behavior for all buffer functions for this new kind
> of buffer?

It can be just multi-file-mode major mode where you open file/buffers as
linked list and have functions that operate on that list like on one buffer.
You should be able to add and remove file/buffers form that list. With this
you will be able to write lisp function that open all the files and create a
list. Then you will need to implement the display.

I'm not elisp expert, but it look like something you can try to create. Maybe
start with POC to test if something like this is possible.

Jakub Jankiewicz, Web Developer

Attachment: pgpkKl6A48Ict.pgp
Description: Podpis cyfrowy OpenPGP

reply via email to

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