emacs window height is too small when the session is over SSH on macOS Xquartz

1

XQuartz 2.7.11 (xorg-server 1.18.4)

From Mac, I ssh-login to Ubuntu 18.04 and XigmaNAS, and start emacs. The emacs windows shows up as it should.

The emacs window pops out as normal size, then resizes itself to 5 or 6 lines. This is pretty inconvenient as the pane only shows emacs splash frame as it starts.

MacPort's emacs (+x11) does not have this problem when running natively on Mac. The problem happens to emacs over SSH on Ubuntu 18.04LTS and XigmaNAS which is FreeBSD.

Interestingly, if I use --geometry 80x60 where the height (60) is large enough (probably larger than the pixel height), the emacs window stays as the max height. On my Mac, if I use 80x57, the window goes back to 5-line height. If I use 80x58, the window height fills my screen. Width seems correct as far as I can tell.

Since this happens for both Ubuntu and FreeBSD over SSH, it's emacs's or Xquartz's problem. Most likely culprit is emacs's window height math is messed up.

Note that, the same problem happens with "emacs -q", so it's not related to ~/.emacs file I use.

So, the question is probably two parts but the ultimately I'm looking for a solution. The culprit is likely emacs height calc is confused, and defaulting to the small window.

A remedy is to set the window size in my .emacs file. I did that but the damage is done by then. If I start emacs with a file in the command line, it doesn't show up in the pane as the emacs splash becomes the first pane. This means that if I do something like "git commit", I have to switch the pane to the commit comment pane every time.

It's been driving me crazy. Someone out there must be in the same boat, so I came here to ask. If you've solved this, I'd really like to know and appreciate.

Naoyuki Tai

Posted 2019-06-03T15:46:24.937

Reputation: 139

Answers

1

I compiled emacs from source. I installed -dev libs for jpeg, gif, tiff, and xaw, x11, etc. but not with gtk.

This solves the problem, and probably there is some interaction between emacs and gtk lib is the issue. If you are frustrated, compiling from source with minimal X11 lib is a solution.

Naoyuki Tai

Posted 2019-06-03T15:46:24.937

Reputation: 139

1

I've also seen this issue for a while now, and finally did some investigation. I tried running emacs with -q and --no-site-file and observed the same behavior (resizing to 3 lines shortly after displaying). The threshold for the number of lines in an explicitly specified geometry is slightly different; in my case, 53 lines was the magic number. This is on Emacs 26.1 running on Ubuntu 19.04 using XQuartz 2.7.11.

For now, I've added a workaround to my init.el to explicitly detect this situation and force the window to a reasonable height, via:

(if (< (frame-height) 4)
    (set-frame-height (window-frame) 24))

Steve Byrne

Posted 2019-06-03T15:46:24.937

Reputation: 13

I have the same problem, and I wish someone would figure it out. For me the magic number is 52. I have installed the work-around provided by Steve, but that's a kludge. The bug should be found. – Dan Grayson – 2020-02-21T21:02:28.753