* Change `set-frame-font' to allow keeping of frame size
@ 2003-04-06 15:35 Ehud Karni
2003-04-06 23:07 ` Richard Stallman
0 siblings, 1 reply; 5+ messages in thread
From: Ehud Karni @ 2003-04-06 15:35 UTC (permalink / raw)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I suggest to change the `set-frame-font' to allow the user to keep
the frame size after the font is changed. I think this should be the
default, but to be compatible with current behavior, the default is
NOT to keep the frame size,
(this diff is against 21.3 but it should apply to HEAD too).
cd /usr/local/share/emacs/21.3/lisp/
diff -c /usr/local/share/emacs/21.3/lisp/frame-org.el /usr/local/share/emacs/21.3/lisp/frame.el
*** /usr/local/share/emacs/21.3/lisp/frame-org.el Sat Nov 3 17:56:49 2001
- --- /usr/local/share/emacs/21.3/lisp/frame.el Sun Apr 6 17:01:59 2003
***************
*** 775,791 ****
(defun set-frame-font (font-name)
"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'."
! (interactive
! (list
! (let ((completion-ignore-case t))
! (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)))))))
! (modify-frame-parameters (selected-frame)
! (list (cons 'font font-name)))
(run-hooks 'after-setting-font-hook 'after-setting-font-hooks))
(defun set-background-color (color-name)
- --- 775,803 ----
(defun set-frame-font (font-name)
"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 size of the frame 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 size of frame 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))
(defun set-background-color (color-name)
Diff finished at Sun Apr 6 17:02:05
- --
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+kEkpLFvTvpjqOY0RAivVAJ95WWou26+OnCXz7YvJ6EaXx+MRdACdHXMX
/4IGB5CjE3nHL1nE0Oq3SEM=
=L6/p
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Change `set-frame-font' to allow keeping of frame size
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
0 siblings, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2003-04-06 23:07 UTC (permalink / raw)
Cc: emacs-devel
(defun set-frame-font (font-name)
"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 size of the frame 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 size of frame after changing font ? ")))
! (list font keep)))
You need to add keep-size to the argument list, or it won't work.
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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Change `set-frame-font' to allow keeping of frame size
2003-04-06 23:07 ` Richard Stallman
@ 2003-04-07 10:03 ` Ehud Karni
2003-04-08 2:30 ` Richard Stallman
0 siblings, 1 reply; 5+ messages in thread
From: Ehud Karni @ 2003-04-07 10:03 UTC (permalink / raw)
Cc: emacs-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sun, 06 Apr 2003 19:07:36 -0400, Richard Stallman <rms@gnu.org> 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-----
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Change `set-frame-font' to allow keeping of frame size
2003-04-07 10:03 ` Ehud Karni
@ 2003-04-08 2:30 ` Richard Stallman
2003-04-08 19:16 ` Ehud Karni
0 siblings, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2003-04-08 2:30 UTC (permalink / raw)
Cc: emacs-devel
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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Change `set-frame-font' to allow keeping of frame size
2003-04-08 2:30 ` Richard Stallman
@ 2003-04-08 19:16 ` Ehud Karni
0 siblings, 0 replies; 5+ messages in thread
From: Ehud Karni @ 2003-04-08 19:16 UTC (permalink / raw)
Cc: emacs-devel
-----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-----
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-04-08 19:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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.