GNU bug report logs - #29986
Add frame arg to toggle-frame-maximized

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Thu, 4 Jan 2018 21:49:02 UTC

Severity: wishlist

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29986 in the body.
You can then email your comments to 29986 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#29986; Package emacs. (Thu, 04 Jan 2018 21:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 04 Jan 2018 21:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Add frame arg to toggle-frame-maximized
Date: Thu, 04 Jan 2018 23:42:21 +0200
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).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29986; Package emacs. (Sun, 07 Jan 2018 16:10:02 GMT) Full text and rfc822 format available.

Message #8 received at 29986 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>, 29986 <at> debbugs.gnu.org
Subject: Re: bug#29986: Add frame arg to toggle-frame-maximized
Date: Sun, 07 Jan 2018 17:08:55 +0100
>    (add-to-list 'after-make-frame-functions
>                 'toggle-frame-maximized)

How would this behave when the frame is maximized initially by the
windowing system/manager?  Would it then set the frame to its normal
size?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29986; Package emacs. (Sun, 07 Jan 2018 21:58:02 GMT) Full text and rfc822 format available.

Message #11 received at 29986 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 29986 <at> debbugs.gnu.org
Subject: Re: bug#29986: Add frame arg to toggle-frame-maximized
Date: Sun, 07 Jan 2018 23:30:14 +0200
>>    (add-to-list 'after-make-frame-functions
>>                 'toggle-frame-maximized)
>
> How would this behave when the frame is maximized initially by the
> windowing system/manager?  Would it then set the frame to its normal
> size?

Exactly.  But as long as the frame is not maximized initially
by the window manager, this should work fine.




Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Thu, 11 Jan 2018 22:16:01 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> linkov.net>:
bug acknowledged by developer. (Thu, 11 Jan 2018 22:16:02 GMT) Full text and rfc822 format available.

Message #16 received at 29986-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: 29986-done <at> debbugs.gnu.org
Subject: Re: bug#29986: Add frame arg to toggle-frame-maximized
Date: Fri, 12 Jan 2018 00:14:46 +0200
> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 09 Feb 2018 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 189 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.