Emacs 23 and font size

I am using emacs 23 on my Netbook Ubuntu release. Every application automatically goes into full screen mode (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


source to share


3 answers


OK, so 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 install the fonts inside the hook after-make-frame-functions

, then it is important that this is first in your initfile (I think because the hooks are done in reverse order), but if you are just installing the fonts then this should work fine anywhere.

Of course, for maximum security, you can put this fontset and yours in the same defun, and this will happen after the fonts are installed.



EDIT: This is a slightly stronger way to do it in case it doesn't work.

This is giving me some trouble, although indeed you probably want to subtract the height of the top bar from the height you set 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))))))
+1


source


Your window manager is broken. emacs resizes when the font size changes (this happens at startup time). The window manager should tell emacs that emacs has been modified by the window manager, at which point everything should work fine.



Anyway, start emacs as "emacs -daemon" and connect to "emacsclient -c" and you shouldn't notice this problem.

+2


source


The font size issue can be fixed by simply selecting a different font size as the default font (Options-> Set Default Font) and then saving the options (Options-> Save Options). Emacs seems to have problems with font sizes to match system sizes (it discusses standard XIs over DPI versus standard GTK DPIs), but if you pick one that works, it stays the same.

In order to get the correct view of the window, I found that the alist frame issue was not taking the minibuffer into account correctly, as well as different font sizes not resizing the frame correctly. If you set the initial-frame-alist to (fullscreen. Fullwidth) and (minibuffer-lines. 1) it correctly size the minibuffer and fit to the correct width, causing the effect as if you manually resized the window to the maximum viewable area (not quite the same as maximizing). You can set them through Options-> Customize Emacs-> Settings Matching Regexp ... Then enter initial-frame-alist. Set two new parameters and values: "minibuffer-lines" to "1" and "fullscreen" to "fullwidth".

Removing the "minibuffer-lines" parameter will give you a window of screen width that does not match the height, and removing the "fullscreen" parameter means the image is not resized. Trying to set fullscreen to fullscreen gives the same problem as setting nothing, and "fullscreen" for "fullheight" gives white space only in height and not in width when using a smaller font size.

+1


source







All Articles