From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jay Berkenbilt Newsgroups: gmane.emacs.devel Subject: giving emacs initial size of 80 x as-much-as-possible Date: Fri, 26 Jun 2009 19:58:50 -0400 Message-ID: <20090626195850.1372305033.qww314159@soup.q.qbilt.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1246060779 30753 80.91.229.12 (26 Jun 2009 23:59:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Jun 2009 23:59:39 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 27 01:59:32 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MKLKL-0001zD-0i for ged-emacs-devel@m.gmane.org; Sat, 27 Jun 2009 01:59:29 +0200 Original-Received: from localhost ([127.0.0.1]:43753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MKLKK-0000tG-Ee for ged-emacs-devel@m.gmane.org; Fri, 26 Jun 2009 19:59:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MKLJt-0000Lm-SM for emacs-devel@gnu.org; Fri, 26 Jun 2009 19:59:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MKLJp-0000GI-9e for emacs-devel@gnu.org; Fri, 26 Jun 2009 19:59:01 -0400 Original-Received: from [199.232.76.173] (port=50659 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MKLJo-0000G9-Rp for emacs-devel@gnu.org; Fri, 26 Jun 2009 19:58:56 -0400 Original-Received: from hermes.mail.tigertech.net ([64.62.209.72]:40241) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MKLJo-0002Qj-Av for emacs-devel@gnu.org; Fri, 26 Jun 2009 19:58:56 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by hermes.tigertech.net (Postfix) with ESMTP id A6F214303DA for ; Fri, 26 Jun 2009 16:58:51 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at hermes.tigertech.net Original-Received: from glerbl (ip68-100-225-145.dc.dc.cox.net [68.100.225.145]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by hermes.tigertech.net (Postfix) with ESMTP id 5F8CA4303D8 for ; Fri, 26 Jun 2009 16:58:51 -0700 (PDT) Original-Received: from soup ([10.160.59.17] helo=soup.q.qbilt.org) by glerbl with esmtp (Exim 4.69) (envelope-from ) id 1MKLJi-0007a2-Eq for emacs-devel@gnu.org; Fri, 26 Jun 2009 19:58:50 -0400 Original-Received: from ejb by soup.q.qbilt.org with local (Exim 4.69) (envelope-from ) id 1MKLJi-0003ea-C2; Fri, 26 Jun 2009 19:58:50 -0400 X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: ejb@q.qbilt.org X-SA-Exim-Scanned: No (on soup.q.qbilt.org); SAEximRunCond expanded to false X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:111762 Archived-At: I'm running 23.0.95 with client-side fonts on a GNU/Linux system. The distribution is not important as long as client-side fonts are supported. I run on Red Hat Enterprise Linux 5 at work and Debian GNU/Linux at home, and the solution is identical. For years, I've been calculating in advance the number of rows I need to set in my emacs geometry based on the size of my font. In the brave newish world of scalable, client-side fonts, this is no longer straightforward since the size of my font is hard to predict. The size of, for example, Monospace-12, depends on many factors including the screen resolution and which font actually matches. Is there a simple way to know what the size of a character in a specific monospace font will be without running emacs to find out? I have dug through some of the code in xdisp.c and frame.c and have come across the functions frame-char-width and frame-char-height, so I know how to get the information about the size of the character once emacs is running, but not how to calculate it in advance. I see that the information comes from the max_ascent and max_descent information from the font, but I don't really see how to get that information reliably. I observe that, for some scale factors, emacs and xterm don't even use the same character size for the same font specification -- emacs sometimes uses one pixel more vertically than xterm. Right now, I have a little script that runs emacs on a lisp file that saves the results of a file, and this is meeting my needs, but it seems unfortunate to have to do this. Why am I doing this? Well, maybe I'm having a hard time moving into the modern world of session managers and so forth. I have code in my login that I have been using literally since 1989 that calculates the initial geometries of my xterms and emacs based on the size of the screen and other information. This way, I can log in on any screen size and get as close as possible to my usual screen parameters. I synchronize my files to many locations and even have this setup on my USB thumb drive. I don't like to have to manually resize windows or to use session managers to save my previous state. My method of calculating in advance has always worked in the past, but I'm having to jump through hoops with both emacs and xterm to get this information. Perhaps I could write a C program that queries the font to get the information. Maybe I'll go that route. Maybe there's some way to get what I need from the output of fc-match, but I don't see how to get the relevant information, particularly about ascent and descent information of the font. Anyway, I'd welcome any suggestions about how to handle this. It's not that big a deal though...my current solution of starting a special emacs just to get the information only adds a few seconds to my login. It's still much faster than the amount of time it would take me to set it up manually. -- Jay Berkenbilt