[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Standard check before creating large num of frames
From: |
Eli Zaretskii |
Subject: |
Re: Standard check before creating large num of frames |
Date: |
Thu, 15 Sep 2016 17:58:18 +0300 |
> From: Tino Calancha <address@hidden>
> Date: Thu, 15 Sep 2016 15:26:43 +0900 (JST)
> Cc: address@hidden
>
> several functions might create new frames. In particular when
> `pop-up-frames' is non-nil, `display-buffer' creates a new frame.
> Creating a lot of new frames might be expensive.
>
> Some functions may ask for user confirmation before creating an
> many frames.
> For instance, see `ibuffer-do-view-1': this function ask for confirmation
> before creating > 3 frames.
> IMO, it's good if each function creating a large number of frames
> do a similar check.
> We might add a new option, for instance 'max-number-of-frames'
> or 'frame-max-number':
>
> (defcustom max-number-of-frames 3
> "Maximum number of frames to create before asking user confirmation."
> :version "25.2"
> :type 'integer
> :group 'convenience)
FWIW, I don't like nagging users like that. It could be an optional
feature, off by default, I guess. Did you really hear from someone
complaining about too many frames open without their consent?
A couple of minor comments:
> (defun frame-create-many-frames-p (nframes &optional prompt)
> "Return non-nil if it's OK to create NFRAMES.
> If NFRAMES + current number of frames is > `max-number-of-frames',
> ask for user confirmation.
> An optional arg is the prompt to ask the user."
> (let* ((tot (+ nframes (length (frame-list))))
> (str (or prompt (format "Really create %s frames? " nframes)))
> (res (or (<= tot max-number-of-frames)
> (y-or-n-p str))))
> res))
First, the message text is confusing: when the user asked for creating
a single additional frame, we are asking them
Really create 4 frames?
The user didn't ask for 4 frames, she only asked for one. A better
text would be
You already have 3 frames; really create another one?
In addition, I think you should also allow the user to tell Emacs
never ask this question again in the current session, not just yes/no
for this one frame.