3

I am using these commands in order to customize the height and the width of the Emacs frames when it starts:

(add-to-list 'default-frame-alist '(height . 50))
(add-to-list 'default-frame-alist '(width . 120))

My goal was to have Emacs use all the available height of my screen. The problem is that up to height 50 (circa) the frame is getting bigger as expected but from that point on it stops, although its height hasn't reached the maximum, as you can see in the image below:

enter image description here

After the start-up I can maximize it with the mouse. Why is that happening and after a number the frames can't even reach their maximum? How can I make it cover the whole screen's height?

Adam
  • 2,407
  • 2
  • 21
  • 38
  • If you want control every pixel precisely and have it always be perfect, then you will need to use `set-frame-size` (using the optional *pixelwise* argument) and `set-frame-position`. If you are happy with almost perfect and just about right, then the other forum participants will recommend things like `toggle-frame-maximized`. Here is the link to the relevant documentation: http://www.gnu.org/software/emacs/manual/html_node/elisp/Size-and-Position.html Here is what I use for OSX and Windows: http://stackoverflow.com/a/18711628/2112489 – lawlist May 11 '15 at 05:05
  • I don't understand what you are trying to do. If you just want to set the height and width of a new frame by default then what you tried should do that. However, a better way to do that is to customize option `default-frame-alist` - that's why it's a user option. But I fear that you are trying to do something else, which I haven't fathomed... – Drew May 11 '15 at 05:12
  • @Drew I just want to make Emacs maximized at startup but only vertically in my screen. What I do does that but not fully. As you see in the image it doesn't cover the whole height. – Adam May 11 '15 at 05:17
  • @lawlist I will check out your proposals. Thanks – Adam May 11 '15 at 05:18
  • Probable duplicate of [How to maximize my Emacs frame on start-up?](http://emacs.stackexchange.com/questions/2999/how-to-maximize-my-emacs-frame-on-start-up). – Dan May 11 '15 at 10:33
  • @Dan The OP wants to set the frame height to the maximum but in trying to do so, realized that it falls short by few pixels and then has to use the mouse to increase the height by those few pixels. The question is on how to take care of that. – Kaushal Modi May 11 '15 at 10:52
  • @lawlist That will make a great answer; setting `pixelwise` arg to `t` is the solution here. – Kaushal Modi May 11 '15 at 10:53
  • @kaushalmodi: at least one of the answers on the thread I linked offers the solution of `(fullscreen . fullheight)` in the `default-frame-alist`, which achieves what OP wants (unless I'm misunderstanding something). – Dan May 11 '15 at 12:49
  • @Dan None of the solutions refer to pixelwise resizing; the key is setting [`frame-resize-pixelwise`](http://doc.endlessparentheses.com/Var/frame-resize-pixelwise) to `t`. – Kaushal Modi May 11 '15 at 13:00
  • @kaushalmodi: not clear that pixelwise resizing is the relevant issue for the specific use case. OP just wants the frame maximized vertically on startup, which is what `(fullscreen . fullheight)` does. – Dan May 11 '15 at 13:04
  • @Dan My understanding is that OP incrementally tried increasing the height but the frame height stopped increasing after a point when "height-in-num-chars*pixels-per-char > pixel-height-of-screen" condition was met. By default, we cannot pixel-control the height and width of the frame; we can only control how many chars wide or high we want the frame. Setting that var to `t` allows user to set the height/width in number of pixels instead of characters. And that's what, I believe, will allow the OP to set the height perfectly. – Kaushal Modi May 11 '15 at 13:09
  • @Dan I don't want to maximize Emacs windows both ways (vertical and horizontally) only vertically :P – Adam May 12 '15 at 04:20
  • @kaushalmodi yes you are right that is what happened. – Adam May 12 '15 at 04:21
  • @Adam: Did you actually try it? Look again at my comment: `(fullscreen . fullheight)`? Look again at the post I linked: one of the answers explains that your options for the `fullscreen` parameter are `fullheight`, `fullwidth`, `fullboth`, and `maximized`. *The answer is already there.* – Dan May 12 '15 at 10:43
  • @Dan I tried the answer in your link. It maximizes the window. – Adam May 12 '15 at 10:49
  • @Adam: with `(fullscreen .fullheight)` in the `default-frame-alist`, I get a frame that is maximized vertically but not horizontally on startup. From the command line, you can also enter `emacs -fh`. – Dan May 12 '15 at 10:54
  • @Dan that worked! Nice. You can write it as an answer. That is what I wanted. – Adam May 12 '15 at 17:39
  • 1
    @Dan Can you add that as an answer so that we have one more **answered** question :) – Kaushal Modi Jul 10 '15 at 20:13
  • @Dan: yes, please post an answer, and OP, please accept it if it is satisfactory. – Drew Dec 04 '15 at 18:48

0 Answers0