tags:

views:

1286

answers:

2

I am using emacs 23 on my Ubuntu netbook edition. Every app, automatically goes to fullscreen (so does my emacs). But depending on the font size (:height), I get a smaller working window. If I go to :height normal I get the full area but the fonts are HUGE!

any ideas?

+2  A: 

Your window manager is broken. emacs resizes itself when you change the font size (this happens during startup). Your window manager should tell emacs that emacs was resized by the window manager, at which point everything will work normally.

Anyway, start emacs as "emacs --daemon" and connect with "emacsclient -c" and you should not notice this problem.

jrockway
I don't think it's necessarily the window-manager's fault: I have `(set-frame-font pretty)` in my `'after-make-frame-functions` hook, and if emacs starts up maximized or full-screen I end up with a small window inside a big frame, but if emacs starts out in some frame, emacs shrinks the frame to fit the window. I haven't been able to figure out a way around this. ( `(window-height)` gives the same value as `(frame-height)` , so emacs has definitely got some wrong idea bout its environment)
quodlibetor
+1  A: 

OK, so actually I added this to my initfile:

(add-hook 'after-make-frame-functions
      (lambda (frame)
        (progn
          (add-to-list 'default-frame-alist
         (cons 'height
        (/ (x-display-pixel-height)
           (frame-char-height)))
         (add-to-list 'default-frame-alist
        (cons 'width
              (/ (x-display-pixel-width)
          (frame-char-width))))))))

and now the window is the same size as the full screen. If you are setting your fonts inside of the after-make-frame-functions hook then it is important that this comes first in your initfile, (I think because hooks are run in reverse order) but if you're just setting the fonts then this should work OK anywhere.

Of course for maximum safety you could put this and your 'set fonts' stuff into the same defun, with this coming after the fonts have been set.

EDIT: This is a slightly more forceful way to do it, in case that doesn't work.

This gives me some issues though, really you would probably want to subtract the height of the top panel from the height you're setting it to.

(add-hook 'after-make-frame-functions
  (lambda (frame)
    (progn
      (set-frame-height frame
      (/ (x-display-pixel-height)
         (frame-char-height)))
      (set-frame-width frame
      (/ (x-display-pixel-width)
         (frame-char-width))))))
quodlibetor