From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#29986: Add frame arg to toggle-frame-maximized Date: Thu, 04 Jan 2018 23:42:21 +0200 Organization: LINKOV.NET Message-ID: <87r2r5z4g2.fsf@mail.linkov.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1515102446 754 195.159.176.226 (4 Jan 2018 21:47:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 4 Jan 2018 21:47:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) To: 29986@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 04 22:47:21 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1eXDM6-000881-I4 for geb-bug-gnu-emacs@m.gmane.org; Thu, 04 Jan 2018 22:47:18 +0100 Original-Received: from localhost ([::1]:45541 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXDO5-0006YL-O6 for geb-bug-gnu-emacs@m.gmane.org; Thu, 04 Jan 2018 16:49:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXDNq-0006Ua-Qt for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 16:49:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXDNn-0008Bh-7b for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 16:49:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55643) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eXDNn-0008Ba-48 for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 16:49:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eXDNm-0002QM-Sp for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 16:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Jan 2018 21:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29986 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15151025339283 (code B ref -1); Thu, 04 Jan 2018 21:49:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Jan 2018 21:48:53 +0000 Original-Received: from localhost ([127.0.0.1]:36089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXDNd-0002Pc-Kn for submit@debbugs.gnu.org; Thu, 04 Jan 2018 16:48:53 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXDNc-0002PG-9d for submit@debbugs.gnu.org; Thu, 04 Jan 2018 16:48:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXDNW-0007zB-5h for submit@debbugs.gnu.org; Thu, 04 Jan 2018 16:48:47 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:60062) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eXDNW-0007yt-3A for submit@debbugs.gnu.org; Thu, 04 Jan 2018 16:48:46 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXDNU-0006Ne-PO for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 16:48:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXDNQ-0007tL-Hu for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 16:48:44 -0500 Original-Received: from hapkido.dreamhost.com ([66.33.216.122]:48344) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eXDNQ-0007qQ-9N for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 16:48:40 -0500 Original-Received: from homiemail-a76.g.dreamhost.com (sub3.mail.dreamhost.com [69.163.253.7]) by hapkido.dreamhost.com (Postfix) with ESMTP id 07A398E005 for ; Thu, 4 Jan 2018 13:48:36 -0800 (PST) Original-Received: from homiemail-a76.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a76.g.dreamhost.com (Postfix) with ESMTP id 9A68945807B for ; Thu, 4 Jan 2018 13:48:34 -0800 (PST) Original-Received: from localhost.linkov.net (m91-129-109-142.cust.tele2.ee [91.129.109.142]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a76.g.dreamhost.com (Postfix) with ESMTPSA id E8747458079 for ; Thu, 4 Jan 2018 13:48:33 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:141784 Archived-At: I propose to add a standard optional arg =E2=80=98frame=E2=80=99 to =E2=80=98toggle-frame-maximized=E2=80=99 and =E2=80=98toggle-frame-fullsc= reen=E2=80=99, so it would be easier to add to ~/.emacs such customizations as e.g. (add-to-list 'after-make-frame-functions 'toggle-frame-maximized) diff --git a/lisp/frame.el b/lisp/frame.el index a28baf7..7ed2f9f 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2388,8 +2388,8 @@ blink-cursor-mode =0C ;; Frame maximization/fullscreen =20 -(defun toggle-frame-maximized () - "Toggle maximization state of selected frame. +(defun toggle-frame-maximized (&optional frame) + "Toggle maximization state of FRAME. Maximize selected frame or un-maximize if it is already maximized. =20 If the frame is in fullscreen state, don't change its state, but @@ -2404,19 +2404,19 @@ toggle-frame-maximized =20 See also `toggle-frame-fullscreen'." (interactive) - (let ((fullscreen (frame-parameter nil 'fullscreen))) + (let ((fullscreen (frame-parameter frame 'fullscreen))) (cond ((memq fullscreen '(fullscreen fullboth)) - (set-frame-parameter nil 'fullscreen-restore 'maximized)) + (set-frame-parameter frame 'fullscreen-restore 'maximized)) ((eq fullscreen 'maximized) - (set-frame-parameter nil 'fullscreen nil)) + (set-frame-parameter frame 'fullscreen nil)) (t - (set-frame-parameter nil 'fullscreen 'maximized))))) + (set-frame-parameter frame 'fullscreen 'maximized))))) =20 -(defun toggle-frame-fullscreen () - "Toggle fullscreen state of selected frame. -Make selected frame fullscreen or restore its previous size if it -is already fullscreen. +(defun toggle-frame-fullscreen (&optional frame) + "Toggle fullscreen state of FRAME. +Make selected frame fullscreen or restore its previous size +if it is already fullscreen. =20 Before making the frame fullscreen remember the current value of the frame's `fullscreen' parameter in the `fullscreen-restore' @@ -2431,14 +2431,14 @@ toggle-frame-fullscreen =20 See also `toggle-frame-maximized'." (interactive) - (let ((fullscreen (frame-parameter nil 'fullscreen))) + (let ((fullscreen (frame-parameter frame 'fullscreen))) (if (memq fullscreen '(fullscreen fullboth)) - (let ((fullscreen-restore (frame-parameter nil 'fullscreen-restore))) + (let ((fullscreen-restore (frame-parameter frame 'fullscreen-restore))) (if (memq fullscreen-restore '(maximized fullheight fullwidth)) - (set-frame-parameter nil 'fullscreen fullscreen-restore) - (set-frame-parameter nil 'fullscreen nil))) + (set-frame-parameter frame 'fullscreen fullscreen-restore) + (set-frame-parameter frame 'fullscreen nil))) (modify-frame-parameters - nil `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen))= )) + frame `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen= )))) ;; Manipulating a frame without waiting for the fullscreen ;; animation to complete can cause a crash, or other unexpected ;; behaviour, on macOS (bug#28496).