unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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

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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).