From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.devel Subject: Standard check before creating large num of frames Date: Thu, 15 Sep 2016 15:26:43 +0900 (JST) Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1473921150 18062 195.159.176.226 (15 Sep 2016 06:32:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 15 Sep 2016 06:32:30 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: tino.calancha@gmail.com To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 15 08:32:26 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkQDW-000389-Dv for ged-emacs-devel@m.gmane.org; Thu, 15 Sep 2016 08:32:14 +0200 Original-Received: from localhost ([::1]:60199 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkQDU-0006qh-Lq for ged-emacs-devel@m.gmane.org; Thu, 15 Sep 2016 02:32:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkQ9H-0004PQ-6n for emacs-devel@gnu.org; Thu, 15 Sep 2016 02:27:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkQ9D-0004tJ-Ec for emacs-devel@gnu.org; Thu, 15 Sep 2016 02:27:50 -0400 Original-Received: from mail-pf0-f171.google.com ([209.85.192.171]:36066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkQ9D-0004t9-8f for emacs-devel@gnu.org; Thu, 15 Sep 2016 02:27:47 -0400 Original-Received: by mail-pf0-f171.google.com with SMTP id 128so13525207pfb.3 for ; Wed, 14 Sep 2016 23:27:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:message-id:user-agent:mime-version; bh=8xWsLEUDPjfjGVTfQe2FaJzWBH1wEX6kT1Zg4qWJ6sg=; b=We8PaolZUGiKRSbVbefekRcZmkO0VqFc0wnCgMvUTykS3B8Vbi41ih/oeBofWhFwOH PFYnr0nBsJSzkXWGk1o9BjcDJpbTQgZg7XB8a5rps8K4UzHRH6gfAtaR3IwLLNOP1xKE KVfLM+YJC+jNcHKtC1vG55jsNlXIKh7ohl1RjEXRcGSN4f1WVH0yjevEImf5TVhZoAf5 3RvlwyMYG+B7caHfzlvevClMAsEnRb4kJLoQxsXm8T/6jYSxNr/ass/wOFit5vffyPMw BbHGF9s7Lxgu5wK2PODtciWYwfxy+cTnzTBWOcyEMmsxmAY8OcHXypNslDRsDUI/6ozp UHLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:message-id:user-agent :mime-version; bh=8xWsLEUDPjfjGVTfQe2FaJzWBH1wEX6kT1Zg4qWJ6sg=; b=GHKOOq0WBexJZgw5zEeNCWx/YrFWn0CsQHAGUq1rfVF8fprSDnBxyzwM1OHUGYxMLN SVCyIkqdgiJqzU+yzecx1ngQidDs6THUJ0BB/DEWsxtKvPz5O2TzWQhkaU1GIGKbp+LB 9IzyuoUV/U47FoMwvm0//Ynt8VpI8cmkP9LabfXAVkMytgKWec6Ao+0Y5OVd6+QYd5LS 7zBJXPczyGRuEERrOUpNlPC+fKmQQm2uTgXM+h3GaDgsU51fX41ueywO4ad58QOJK2qW swc+MI5llzOLsOy+klJsrKA5mSAbUC0hVhzaC0Km2hJK+V6mVN2p1MWCsRhYHF2XGLvA V4RA== X-Gm-Message-State: AE9vXwN6ON33hWcnFtvKYOahvkul+gdiHMHArppmSPGOTzIWxeoemGjLzyTW1moWx/KHLQ== X-Received: by 10.98.73.22 with SMTP id w22mr11792246pfa.62.1473920806532; Wed, 14 Sep 2016 23:26:46 -0700 (PDT) Original-Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id yu7sm2091682pab.45.2016.09.14.23.26.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Sep 2016 23:26:46 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.171 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207440 Archived-At: Dear all, 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) We might want to standarize the check as well: (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)) Please, let me know your opinions/suggestions about this proposal. In case we want to add these things: where should they live? Regards, Tino