Subject: bug#29986: closed (Re: bug#29986: Add frame arg to toggle-frame-maximized)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 11 Jan 2018 22:16:02 +0000

Your bug report

#29986: Add frame arg to toggle-frame-maximized

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
29986: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=29986
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#29986: Add frame arg to toggle-frame-maximized
From: Juri Linkov <[email-masked]>
To: [email-masked]
Date: Fri, 12 Jan 2018 00:14:46 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> I propose to add a standard optional arg ‘frame’ to
> ‘toggle-frame-maximized’ and ‘toggle-frame-fullscreen’,
> so it would be easier to add to ~/.emacs such customizations
> as e.g.
>
>   (add-to-list 'after-make-frame-functions
>                'toggle-frame-maximized)

Done.

Subject: Add frame arg to toggle-frame-maximized
From: Juri Linkov <[email-masked]>
To: [email-masked]
Date: Thu, 04 Jan 2018 23:42:21 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

I propose to add a standard optional arg ‘frame’ to
‘toggle-frame-maximized’ and ‘toggle-frame-fullscreen’,
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
 
 ;; Frame maximization/fullscreen
 
-(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.
 
 If the frame is in fullscreen state, don't change its state, but
@@ -2404,19 +2404,19 @@ toggle-frame-maximized
 
 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)))))
 
-(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.
 
 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
 
 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).