From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Ehud Karni" Newsgroups: gmane.emacs.devel Subject: Re: Change `set-frame-font' to allow keeping of frame size Date: Mon, 7 Apr 2003 13:03:07 +0300 Organization: Mivtach-Simon Insurance agencies Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200304071003.h37A3755028148@beta.mvs.co.il> References: <200304061535.h36FZ61t005675@beta.mvs.co.il> Reply-To: ehud@unix.mvs.co.il NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-8 Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1049710232 31919 80.91.224.249 (7 Apr 2003 10:10:32 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 7 Apr 2003 10:10:32 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Apr 07 12:10:28 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 192Ta3-0008IR-00 for ; Mon, 07 Apr 2003 12:10:23 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 192TdV-0006qX-00 for ; Mon, 07 Apr 2003 12:13:57 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 192TZG-00042a-03 for emacs-devel@quimby.gnus.org; Mon, 07 Apr 2003 06:09:34 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 192TYi-0003p8-00 for emacs-devel@gnu.org; Mon, 07 Apr 2003 06:09:00 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 192TWX-0002AM-00 for emacs-devel@gnu.org; Mon, 07 Apr 2003 06:06:46 -0400 Original-Received: from unix.sw.co.il ([192.114.178.12] helo=unix.mvs.co.il) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 192TT6-00010T-00; Mon, 07 Apr 2003 06:03:12 -0400 Original-Received: from beta.mvs.co.il (beta [10.253.0.3]) by unix.mvs.co.il (8.11.6/8.11.6) with ESMTP id h37A39s01127; Mon, 7 Apr 2003 13:03:09 +0300 Original-Received: from beta.mvs.co.il (localhost [127.0.0.1]) by beta.mvs.co.il (8.12.5/8.12.5) with ESMTP id h37A38tB028154; Mon, 7 Apr 2003 13:03:09 +0300 Original-Received: (from root@localhost) by beta.mvs.co.il (8.12.5/8.12.5/Submit) id h37A3755028148; Mon, 7 Apr 2003 13:03:07 +0300 Original-To: rms@gnu.org In-reply-to: (message from Richard Stallman on Sun, 06 Apr 2003 19:07:36 -0400) X-Mailer: Emacs 21.3.1 rmail (send-msg 1.108) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:12950 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12950 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sun, 06 Apr 2003 19:07:36 -0400, Richard Stallman wrote: > > (defun set-frame-font (font-name) Sorry, the 2nd arg was omitted on copying (I tested this defun). > Whether this is a good change, I am not sure. I do not understand the > description of the feature. What does it mean to "keep the current > size"? And what is the other alternative? The "Keep size" means keeping the pixel size (its footprint on the screen) of the frame. From your question it is clear that the wording should be changed to clarify this. How about: (defun set-frame-font (font-name keep-size) "Set the font of the selected frame to FONT-NAME. When called interactively, prompt for the name of the font to use. To get the frame's current default font, use `frame-parameters'. If optional KEEP-SIZE is non nil the current frame size (in pixels) is kept by adjusting the frame `height' and `width' parameters" (interactive (let* ((completion-ignore-case t) (font (completing-read "Font name: " (mapcar #'list ;; x-list-fonts will fail with an error ;; if this frame doesn't support fonts. (x-list-fonts "*" nil (selected-frame))))) (keep (yes-or-no-p "Keep the frame size (in pixels) after changing font ? "))) (list font keep))) (let (fht fwd) (if keep-size (setq fht (* (frame-parameter nil 'height) (frame-char-height)) fwd (* (frame-parameter nil 'width) (frame-char-width)))) (modify-frame-parameters (selected-frame) (list (cons 'font font-name))) (if keep-size (modify-frame-parameters (selected-frame) (list (cons 'height (round fht (frame-char-height))) (cons 'width (round fwd (frame-char-width))))))) (run-hooks 'after-setting-font-hook 'after-setting-font-hooks)) Ehud. - -- Ehud Karni Tel: +972-3-7966-561 /"\ Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign Insurance agencies (USA) voice mail and X Against HTML Mail http://www.mvs.co.il FAX: 1-815-5509341 / \ mailto:ehud@unix.mvs.co.il Better Safe Than Sorry -----BEGIN PGP SIGNATURE----- Comment: use http://www.keyserver.net/ to get my key (and others) iD8DBQE+kUzbLFvTvpjqOY0RAq9ZAKCIexrmW92xV8nZidKovKISYLjEHwCfcmFT YVRN3ekdFMDPM6SYyaw3YTk= =EMBW -----END PGP SIGNATURE-----