2

Are there emacs commands which will let me resize/move the frames/windows?

By frame/window I mean the GUI object that X/Windows/whateverAppleCallsIt to contain the interface to emacs. Sorry, emacs language conflicts with OS-GUI language.

  • Emacs 25 (net yet officially released, but available to the public if so desired) contains some important bug fixes if you eventually decide to create frames and have them set at precise sizes/locations from the outset -- including, but not limited to pixelwise. – lawlist Jul 31 '16 at 16:37
5

There are the built in functions set-frame-size, set-frame-height, set-frame-width and set-frame-position which let's you programmatically set the frame size and position.

For example (set-frame-size (selected-frame) 300 300 t) would set the currently selected frame size to 300x300 pixels.

If you want to set the size interactively there is the frame-cmds package available on melpa that you can install via M-x package-install RET frame-cmds RET if you have melpa in you package-archives list or download from it from the emacs wiki.

1
  • In addition to frame-cmds.el, which is mentioned by @Tephra, you have library frame-fns.el, on which it depends, and which provides some general frame-manipulation utility functions.

  • Libraries fit-frame.el and autofit-frame.el, which shrink-wrap a frame to fit the text that is in its selected window (used typically in a one-window frame). See Shrink-Wrapping Frames.

  • Library zoom-frm.el lets you easily zoom the text in a frame (or a buffer) in and out. It extends and is more flexible than the standard Emacs text "scaling" provided by vanilla Emacs.

  • Library doremi-frm.el provides another way to incrementally resize frames.

0

Yes, one can find the official detailed list here:

Those could be combined to do all sort of things, like for example:

(defun my/frame-move-resize (position)
  "Resize selected frame to cover exactly 1/3 of screen area, and
  move frame to given third of current screen. Symbol POSITION can
  be either left, center, right."

  (pcase position
    ('left   (setf x 0))
    ('center (setf x 1))
    ('right  (setf x 2)))

  (let* ((HEIGHT (display-pixel-height))
     (WIDTH  (display-pixel-width)))
    (set-frame-size (selected-frame) (/ WIDTH 3) HEIGHT t)
    (set-frame-position (selected-frame) (* x (/ WIDTH 3)) 0)))

;; Example:
(my/frame-move-resize 'center)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.