unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Angelo Graziosi <angelo.g0@libero.it>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Visiting a set of files listed in a file
Date: Sat, 9 Apr 2022 21:06:42 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488E2EA43257744749F533CF3E89@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <1056523648.1760849.1649537198302@mail1.libero.it>

> > dired-simultaneous-find-file: Too many files to visit simultaneously.
> Try C-u prefix
> >
> > the file I tried contains 52 files listed...
> 
> With 10 files listed it works but it opens also 10 window!
> 
> I would only visit them with one window for the last file (I would also
> increase the number of files...)

As the doc of what I wrote says, and as the doc of
`dired-simultaneous-find-file' says, you can use
optional arg NOSELECT (prefix arg) to not try to
show 52 windows in your frame.

And as I said, if you don't want to leverage
`dired-simultaneous-find-file' then just use some
of its code to define your own function.  This is
its definition in Emacs 27.2.  It's probably the
same in Emacs 28:

(defun dired-simultaneous-find-file (file-list noselect)
  "Visit all files in FILE-LIST and display them simultaneously.
The current window is split across all files in FILE-LIST, as evenly as
possible.  Remaining lines go to the bottom-most window.  The number of
files that can be displayed this way is restricted by the height of the
current window and the variable `window-min-height'.  With non-nil
NOSELECT the files are merely found but not selected."
  ;; We don't make this function interactive because it is usually too clumsy
  ;; to specify FILE-LIST interactively unless via dired.
  (let (size)
    (if noselect
        ;; Do not select the buffer.
        (find-file-noselect (car file-list))
      ;; We will have to select the buffer.  Calculate and check window size.
      (setq size (/ (window-height) (length file-list)))
      (or (<= window-min-height size)
          (error "Too many files to visit simultaneously.  Try C-u prefix"))
      (find-file (car file-list)))
    ;; Decrement.
    (dolist (file (cdr file-list))
      (if noselect
          ;; Do not select the buffer.
          (find-file-noselect file)
        ;; Vertically split off a window of desired size.  Upper window will
        ;; have SIZE lines.  Select lower (larger) window.  We split it again.
        (select-window (split-window nil size))
        (find-file file)))))

You might also be interested in the first comment there:

 ;; We don't make this function interactive because it is usually
 ;; too clumsy to specify FILE-LIST interactively unless via dired.

In your case, you really do want to visit zillions of files.

(Why?  Are you sure you want to do that - visit all of them
at the same time?  Maybe you instead want to visit them one
at a time, doing something to each in turn, then killing it.
I'd suggest you think more about what you really need/want.)

Clearly you don't want to visit each of them in a window
(at the same time), do you?  So just do what you want.  Maybe
use NOSELECT to visit all of them (if you really need that),
and display only whichever of the buffers you want to show.

  reply	other threads:[~2022-04-09 21:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-09  9:31 Visiting a set of files listed in a file Angelo Graziosi
2022-04-09  9:59 ` Eli Zaretskii
2022-04-09 10:15   ` Angelo Graziosi
2022-04-09 10:40     ` Eli Zaretskii
2022-04-09 11:01       ` Angelo Graziosi
2022-04-09 11:10         ` Eli Zaretskii
2022-04-09 11:29           ` Angelo Graziosi
2022-04-09 14:44             ` Eli Zaretskii
2022-04-09 20:21               ` Angelo Graziosi
2022-04-09 17:44 ` [External] : " Drew Adams
2022-04-09 20:29   ` Angelo Graziosi
2022-04-09 20:35     ` Angelo Graziosi
2022-04-09 20:46       ` Angelo Graziosi
2022-04-09 21:06         ` Drew Adams [this message]
2022-04-09 21:45           ` Angelo Graziosi
2022-04-09 20:56     ` Drew Adams
2022-04-10  1:07 ` James Thomas
2022-04-11 15:18   ` João Pedro
2022-04-11 15:31   ` chad
2022-04-11 20:34     ` Angelo Graziosi
2022-04-12  6:59   ` James Thomas
2022-04-12 21:17 ` Mathias Dahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB5488E2EA43257744749F533CF3E89@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=angelo.g0@libero.it \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).