[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Change `set-frame-font' to allow keeping of frame size
From: |
Ehud Karni |
Subject: |
Change `set-frame-font' to allow keeping of frame size |
Date: |
Sun, 6 Apr 2003 18:35:06 +0300 |
-----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:address@hidden 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-----
- Change `set-frame-font' to allow keeping of frame size,
Ehud Karni <=