Created
October 26, 2022 20:08
-
-
Save mattmc3/cd749dfbcf53d47af06baf181980c458 to your computer and use it in GitHub Desktop.
Emacs frame (window) re-center
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; https://christiantietze.de/posts/2022/04/emacs-center-window-current-monitor-simplified/ | |
(defun my/frame-recenter (&optional frame) | |
"Center FRAME on the screen. | |
FRAME can be a frame name, a terminal name, or a frame. | |
If FRAME is omitted or nil, use currently selected frame." | |
(interactive) | |
(unless (eq 'maximised (frame-parameter nil 'fullscreen)) | |
(modify-frame-parameters | |
frame '((user-position . t) (top . 0.5) (left . 0.5))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment