From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: master 57d2f24: * lisp/frame.el (make-frame-on-monitor): New command. (Bug#34516) Date: Sun, 3 Mar 2019 16:01:32 -0800 (PST) Message-ID: References: <20190225211142.21954.14993@vcs0.savannah.gnu.org> <20190225211144.0DD23206A2@vcs0.savannah.gnu.org> <83ef7umv4v.fsf@gnu.org> <877edluew8.fsf@mail.linkov.net> <87k1hjk5ow.fsf@mail.linkov.net> <871s3pynwx.fsf@mail.linkov.net> <87sgw3r98y.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="19197"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 04 01:02:25 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h0b3p-0004si-5c for ged-emacs-devel@m.gmane.org; Mon, 04 Mar 2019 01:02:25 +0100 Original-Received: from localhost ([127.0.0.1]:45729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0b3n-00068N-TH for ged-emacs-devel@m.gmane.org; Sun, 03 Mar 2019 19:02:23 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0b39-000686-A5 for emacs-devel@gnu.org; Sun, 03 Mar 2019 19:01:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0b38-0004Qy-6o for emacs-devel@gnu.org; Sun, 03 Mar 2019 19:01:43 -0500 Original-Received: from aserp2130.oracle.com ([141.146.126.79]:42936) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h0b37-0004Mt-S7 for emacs-devel@gnu.org; Sun, 03 Mar 2019 19:01:42 -0500 Original-Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x23NxtpA171613; Mon, 4 Mar 2019 00:01:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=MIlj7zYAxQnrNLub/N9MU3Qb/EBn+OmILm8mMeyK0wQ=; b=cks9xmBs7b/uEdC3ZtDyddz2KV962L03i7exCRXxA8hOyfKwiX9InTrATNy/witPPL4m 1MY32UABKbGEW3t/YYkecmnBFENQK1OzMcwuS4Sd3qNun5JPBH9mUw7rhBmjodmBZTdK pN4sK6lslnuYMB4wH3UXZYhFtpVAj/+Ln88acqxQvXl6oI2tIYMvywer1IYGMOyyWICo wIGdrgjmNZv6yeRM8l3CM7zEkY1uyvbLxmE+YeunVUcHqYdXGf77SrPqyXJkA84BZ5fh ViZk+kD6UfsWYij7V1cYRvhK3il6scdqOHln6AdvOUZzNzQJ/azbreFbTl4u6zfT9Phv yA== Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2qyfbdvb3c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 04 Mar 2019 00:01:40 +0000 Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2401YLA014763 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 4 Mar 2019 00:01:34 GMT Original-Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x2401X8R019432; Mon, 4 Mar 2019 00:01:33 GMT In-Reply-To: <87sgw3r98y.fsf@mail.linkov.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4810.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9184 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903030186 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 141.146.126.79 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:233807 Archived-At: > > As an aside and FWIW, I think `C-x 5 2' should, by > > default, make a new frame that is a clone of the > > selected one (same parameters). I proposed this in > > bug #34715. >=20 > `clone-frame' would be a useful command since it will also > maximize the cloned frame if the original was maximized. >=20 > But why rebind `C-x 5 2' to it? Because I found I was pretty much always using `make-frame-command' to open the current buffer in another frame. For my use it was thus kind of a frame-duplication anyway, but without everything about the frame getting duplicated. See also below, for more "why".=20 > Like the following existing key binding: > `C-x 4 c' - clone-indirect-buffer-other-window > shouldn't the new command be bound to a similar key sequence: > `C-x 5 c' - clone-frame Obviously such choices are judgment calls and subject to opinion. Normally I'd argue not to change the default behavior (of `C-x 5 2'), for backward compatibility. But in this case I'd argue to change it, and keep the current behavior on `C-u'. But as I said, that's maybe partly because I typically do not have multiple windows in a frame where I use `C-x 5 2'. To me it's natural to have a prefix arg change between cloning and just doing `make-frame-command'. Just which of those behaviors should be the default behavior is a separate question. I don't insist that the default behavior must change. But I do think that the natural place for the clone behavior is on `C-x 5 2', not `C-x 5 c'. Yes, in some ways you can say this is similar to `clone-indirect-buffer-other-window. But it's not really very similar. It's not about indirect buffers, and it's not about cloning a buffer. It's about showing a buffer in another place (frame). FWIW, the code I actually use is a bit more involved, as follows: 1. Cloning the frame to keep the same parameters, particularly the same size, is handy. But giving the new frame the exact same position (as well as size) puts it right on top of the frame that's cloned. I find it handier to position it a bit offset. That makes it more apparent that the frame was cloned, and gives me instant access to both frames. Someone else might prefer the exactly-on-top behavior. Or someone might prefer a different offset amount or direction. Or someone might prefer to always use some particular set of frame parameters for cloning. 2. The code I use always selects the new frame (except when `C-u' is used, to just invoke `make-frame-command'). I find that this is what I want nearly always. And this behavior is what `clone-indirect-buffer-other-window' does: you generally clone a frame to work in it, I think; you don't want to keep working in the original (cloned) frame. Below is the code I actually use, FWIW. (The binding of `fit-frame-inhibit-fitting-flag' has an effect only if someone is using my `fit-frame.el' code - you can ignore it.) The user option lets you choose a particular set of frame parameters to use. Or you can choose an offset and otherwise keep the same parameters as the current frame. Or you can choose nil or zero offsets, to get exactly the same frame parameters. ------8<------------ (defcustom clone-frame-parameters (cons 30 30) "Frame parameter settings that override those of the frame to clone. The value can be an alist of frame parameters or a cons of two integers, (LEFT-OFFSET . TOP-OFFSET). The latter case sets parameters `left' and `top' of the new frame to the `left' and `top' of the selected frame, offset by adding LEFT-OFFSET and TOP-OFFSET to them, respectively." :type '(choice (cons :tag "Offset from current frame location" (integer :tag "Left") (integer :tag "Top")) (alist :tag "Parameters to augment/replace those of current frame= " :key-type (symbol :tag "Parameter"))) :group 'Frame-Commands) (defun clone-frame (&optional frame no-clone) "Make and select a new frame with the same parameters as FRAME. With a prefix arg, don't clone - just call `make-frame-command'. Return the new frame. FRAME defaults to the selected frame. The frame is created on the same terminal as FRAME. If the terminal is a text-only terminal then also select the new frame." (interactive "i\nP") (if no-clone (make-frame-command) (let* ((fit-frame-inhibit-fitting-flag t) (clone-frame-parameters (if (and clone-frame-parameters (not (consp (car clone-frame-parameters)))) `((left . ,(+ (car clone-frame-parameters) (or (cdr (assq 'left (frame-parameters frame))) 0))) (top . ,(+ (cdr clone-frame-parameters) (or (cdr (assq 'top (frame-parameters frame))) 0)))) clone-frame-parameters)) (default-frame-alist (append clone-frame-parameters (frame-parameters frame))) (new-fr (make-frame))) (select-frame new-fr) new-fr)))