help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to set frame parameters?


From: Mickey Ferguson
Subject: how to set frame parameters?
Date: Tue, 18 Jan 2005 09:48:25 -0800

 
"Quokka" <NoSpam@iinet.net.au> wrote in message news:41ec8088$0$16226$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
> Actually .. I find that that is why I put it into the registry,
> so when I am on a different machine with a different size screens
> (i.e. 19inch work station as opposed to a laptop)
> then the size goes back to default.
Different perspectives of the same issue.  I specifically wanted my window to be 80 columns wide (actually 81, because I didn't want the 80th character to be displayed as a wrap), and the length set to the size of the screen where I'm working.  I had a function that calculated the maximum length (max-lines) that I could use for the window.  I also calculated that for a 1024x768 display (my default at work), with the toolbar disabled (because I only want the menu, and frankly I almost never use it either), I could fit 87 lines for my display with my desired font.  See the code below.
 
So is there an easier (and more correct) way to accomplish this task?  Here's what I have in my .emacs:
 
(cond
 ((eq window-system 'w32)
  (progn
    (and window-system
         (setq
          screen-width (x-display-pixel-width)
          screen-height (x-display-pixel-height)))
 
    (defun max-lines (arg)
      "Calculate maximum number of lines supported, based on number pre-calculated, scaled to 1024x768 display."
      (interactive "P")
      (if (eq screen-height 768)
          arg
        (+ 1 (/ (* screen-height arg) 768))))
;;;See HKCU/Software/GNU/Emacs key for initial size customizations
;;;(specifically, emacs.Geometry)
;[HKEY_CURRENT_USER\Software\GNU\Emacs]
;"emacs.Font"="-*-Terminal-bold-r-*-*-8-60-96-96-c-*-ms-oem"
;"emacs.Geometry"="81x87"
 
;;; Instead of using the registry key above, we now set things manually as below
    (set-default-font "-*-Terminal-bold-r-*-*-8-60-96-96-c-*-ms-oem")
    (set-frame-width (selected-frame) 81)
    (set-frame-height (selected-frame) (max-lines 87))
    (set-frame-position (selected-frame)
                        ; for BLDMGRCDRW02, right-anchor window.  For all others, left.
                        (if (equal (getenv "COMPUTERNAME") "BLDMGRCDRW02") -1 0)
                        0)
    )))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]