I am trying to setup my init files, and want a special set of dimensions for my main Emacs window. If I place my window wherever I want it, is there a way of querying Emacs as to the main window dimensions? I.e., is there a way of querying the value of the top, left, width, and height values of the main window as it is currently placed?

  • 1
    In Emacs, we use the word "frame" to mean the whole kitten kaboodle; whereas, "window" is within the "frame" and there can be many "windows". Please edit your question (title and body) accordingly. In addition, please specify your operating system -- other solutions may exist, e.g., an applescript on OSX to get frame coordinates, etc. – lawlist Jan 23 '15 at 15:30
  • How about this google search for "emacs window dimensions"? Among the first hits are manual pages for window sizes and frame size and position. – Dan Jan 23 '15 at 15:42
  • @Dan -- I don't believe any of those functions return frame coordinates on the OS desktop in pixels. – lawlist Jan 23 '15 at 15:51

There's (window-width) and (window-pixel-width) (and the equivalent height functions) for getting the width in characters and pixels respectively.

There's also (window-pixel-top) and (window-pixel-left).

I'm not really sure if these are what you're looking for.

I used helm-apropos to find these functions. There's also a built-in command to search functions: M-x apropos RET window left RET.

  • Thanks! I didn't know about apropos. – NVaughan Jan 23 '15 at 22:37

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.