Subject: bug#14233: 24.3; Don't constrain frame size to character multiples

From: "Drew Adams" <[email-masked]>
Date: Sun, 28 Apr 2013 08:33:10 -0700

> Conceptually, `modify-frame-parameters' allows to change several frame
> parameters for the next redisplay.  But the outcome depends on the
> evaluation order of the ALIST argument.  Suppose you want to change a
> frame's font and size in one and the same call.  The result 
> would depend on which element is evaluated first due to the fact
> that changing the font allows to change the size of the frame too.
> This is not my idea of clean semantics.

Respecting the order means that it is clear - pretty much equivalent,
presumably, to modifying one frame parameter at a time, in order.

Whether you do that using (a) separate calls, in sequence, to single-parameter
setting functions or (b) using one or more calls to a general setting function
that accepts an alist (which is of course ordered), changes nothing, AFAICT.

Either way, you still have to take into account any interdependence among
parameters.

>  > The new value is calculated this way (in frame-cmds.el):...
>  >     (modify-frame-parameters frame (list (cons 'font fontname)))
> 
> I suppose it would be trivial to change this single line to use
> `set-frame-font' in order to deal with the change I propose.  But if
> people like the current behavior I can obviously leave things as they
> are now.

1. `set-frame-font' apparently has this side effect, which is not appropriate
here:

  Also, if FRAME is non-nil,
  alter the user's Customization settings as though the
  font-related attributes of the `default' face had been "set in
  this session", so that the font is applied to future frames.

(It should say FRAMES, not FRAME, BTW.)

Why does `set-frame-font' not allow you to change the font for a given frame
(besides the selected frame), without also changing face `default' for future
frames?

Interestingly, in Emacs 20 (and in 21 it was essentially the same),
`set-frame-font' just used `modify-frame-parameters' - very clear and simple:

(defun set-frame-font (font-name)
  "Set the font of the selected frame to FONT.
When called interactively, prompt for the name of the font to use.
To get the frame's current default font, use `frame-parameters'."
  (interactive "sFont name: ")
  (modify-frame-parameters (selected-frame)
			   (list (cons 'font font-name)))
  (frame-update-faces (selected-frame)))

;; And `frame-update-faces' was a no-op (obsolete in Emacs 21):
(defun frame-update-faces (frame) nil)

Nowadays, `set-frame-font' is an incomprehensible monster.

2. `modify-frame-parameters' is the basic, general, workhorse function for
frames.  It lets you set any number of frame parameters in any order.  Yes, I
would very much like it to continue working in the same, straightforward manner,
including for parameter `font'.