4

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

4 Answers4

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.

Tephra
  • 821
  • 5
  • 14
2
  • 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.

Drew
  • 75,699
  • 9
  • 109
  • 225
1

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)
gsl
  • 1,742
  • 17
  • 34
-1

moom-move-frame and other related functions in moom package move/resize Emacs frame (not window) https://github.com/takaxp/moom

AhLeung
  • 1,083
  • 5
  • 14
  • Please clarify in which way this package answers the question. Link-only answers are not very valuable since the link may go stale. – Stefan May 03 '20 at 04:39
  • In addition to explaining your answer in more detail, please do not post [duplicate answers](https://emacs.stackexchange.com/a/58245) to multiple questions. – Dan May 03 '20 at 09:32
  • Modified the answer to reply the question. – AhLeung May 04 '20 at 05:30