all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ehud Karni" <ehud@unix.mvs.co.il>
Cc: emacs-devel@gnu.org
Subject: Re: Change `set-frame-font' to allow keeping of frame size
Date: Tue, 8 Apr 2003 22:16:59 +0300	[thread overview]
Message-ID: <200304081916.h38JGxDa022011@beta.mvs.co.il> (raw)
In-Reply-To: <E192isW-0000l6-00@fencepost.gnu.org> (message from Richard Stallman on Mon, 07 Apr 2003 22:30:28 -0400)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 07 Apr 2003 22:30:28 -0400, Richard Stallman <rms@gnu.org> wrote:
> 
>     If optional KEEP-SIZE is non nil the current frame size (in pixels)
>     is kept by adjusting the frame `height' and `width' parameters"
> 
> It should say explicitly what the default behavior is, rather than
> making the user try to guess.  Also, it needs to say "non-nil",
> not "non nil".
> 
> Aside from that, I think the optional feature is ok, but asking a question
> is obnoxious.  Would you please make it test the prefix arg instead?

Here is the new definition:

(defun set-frame-font (font-name &optional 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'.

The default behavior is to keep the numbers of lines and columns in
the frame, thus may change its pixel size. If optional KEEP-SIZE is
non-nil (interactively, prefix argument) the current frame size (in
pixels) is kept by adjusting the numbers of the lines and columns."
  (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))))))
     (list font current-prefix-arg)))
  (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+kyArLFvTvpjqOY0RApQlAJwIBVHXgaTcwDX1MVzuYukwDQ0lNQCdFRUT
XtIplxLWM5eGZnxshLMQ1jw=
=lGa4
-----END PGP SIGNATURE-----

      reply	other threads:[~2003-04-08 19:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-06 15:35 Change `set-frame-font' to allow keeping of frame size Ehud Karni
2003-04-06 23:07 ` Richard Stallman
2003-04-07 10:03   ` Ehud Karni
2003-04-08  2:30     ` Richard Stallman
2003-04-08 19:16       ` Ehud Karni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200304081916.h38JGxDa022011@beta.mvs.co.il \
    --to=ehud@unix.mvs.co.il \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.