Emacs font size changes frame size

emacsfontsgnome

I'm using emacs 23.1.1. I set the font size in my .emacs with

(set-face-attribute 'default nil :height 100)

The problem is that my emacs is now really small. The outer box (what I call a window and what I think emacs calls a "frame") is sized normally, but the inner box (which I call a "frame" and emacs a "window", I think) is too small. I tried the suggestions here, but neither of them seem to work.

Any ideas? I'm on ubuntu netbook if that's relevant. My entire startup file is:

(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))))))


(autoload 'octave-mode "octave-mod" nil t)
(setq auto-mode-alist
      (cons '("\\.m$" . octave-mode) auto-mode-alist))
(add-hook 'octave-mode-hook
          (lambda ()
            (abbrev-mode 1)
            (auto-fill-mode 1)
            (if (eq window-system 'x)
                (font-lock-mode 1))))
(tool-bar-mode -1)
(set-face-attribute 'default nil :height 100)

Here is a picture of what it looks like. It might be hard to tell, but the "window" is taking up the whole screen; that whitespace is all inside emacs.

Emacs

Best Answer

I think I had problems of this nature before and solved them using Xresources. That might have been with XEmacs though. I think the basic idea is that Emacs creates the frame before reading .emacs, so you can give it a heads up using Xresources.

For an example, here are some of the contents of my ~/.Xdefaults:

emacs*geometry: WxH
Emacs.menuBar: off
Emacs.toolBar: off
Emacs*font: Font-Family Pt-size

(where W, H, Font-Family, and Pt-size should be customized)

I use 'xrdb /path/to/.Xdefaults' during my GNOME session start-up to compile/load these settings. You can invoke xrdb manually while testing this out.

Related Question