help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: resize emacs frame / gui-window via keybinding


From: Jeffrey Spencer
Subject: Re: resize emacs frame / gui-window via keybinding
Date: Wed, 22 Aug 2012 15:02:32 +1000

Use to use these but could be modified in a function set to a key binding to provide the desired functionality.
;; Set frame height to roughly full screen
;; (set-frame-height
;;  (selected-frame)
;;  (/ (display-pixel-height) (frame-char-height)))
;; ;; Set frame width to roughly half screen
;; (set-frame-width
;;  (selected-frame)
;;  (/ (/ (display-pixel-width) 4) (frame-char-width)))


On Wed, Aug 22, 2012 at 11:15 AM, Peter <peter.milliken@gmail.com> wrote:
Depends on why (as always, it would help us help you :-)). For instance, I have this in my .emacs - it sizes Emacs to fill the screen on startup (Windows XP - otherwise I have to do it manually on each startup :-( ).

(defun enlarge-frame ()
  "Enlarge the selected frame to fill a sizeable portion of the screen,
based on the current screen resolution"
  (interactive)
  ;; Set the frame size
  ;; set the new width, with a little space on the sides
  (setq lframe-width (- (/ (x-display-pixel-width) (frame-char-width)) 8))
  ;; set the new height, allowing for title bars
  (setq lframe-height (- (/ (x-display-pixel-height) (frame-char-height)) 5))
  ;; apply to the selected frame
  (set-frame-size (selected-frame) lframe-width lframe-height))

The final line in the .emacs is this (otherwise if you just run it as part of your .emacs it resizes during loading of the .emacs and then reverts to the default "small" size after it has completed processing your .emacs!):

(run-at-time "0.1 sec" nil 'enlarge-frame)

Depending, you might need to expand the time specified in this last statement.

Hope this is a possible solution to why you want to know this information :-)

Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]