From: Juri Linkov <juri@linkov.net>
To: 29986@debbugs.gnu.org
Subject: bug#29986: Add frame arg to toggle-frame-maximized
Date: Thu, 04 Jan 2018 23:42:21 +0200 [thread overview]
Message-ID: <87r2r5z4g2.fsf@mail.linkov.net> (raw)
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
\f
;; 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).
next reply other threads:[~2018-01-04 21:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-04 21:42 Juri Linkov [this message]
2018-01-07 16:08 ` bug#29986: Add frame arg to toggle-frame-maximized martin rudalics
2018-01-07 21:30 ` Juri Linkov
2018-01-11 22:14 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r2r5z4g2.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=29986@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.