Subject: RE: bug#1562: 23.0.60; modify-frame-parameters in Emacs 23 for fonts

From: "Drew Adams" <[email-masked]>
Date: Sun, 14 Dec 2008 09:30:03 -0800

> > (1) `modify-frame-parameters' changes the `font' parameter 
> > behind your back from the value you provide
> > `modify-frame-parameters':
> >
> > (modify-frame-parameters frame
> >   (list (cons 'font "-outline-Lucida Console-normal-normal-\
> > normal-mono-15-*-*-*-c-*-iso8859-1")))
> >
> > The `font' frame parameter is then:
> >
> > "-outline-Lucida Console-normal-normal-normal-mono-15-\
> > *-*-*-c-*-fontset-auto8"
> >
> > IOW, iso8859-1 gets replaced by fontset-auto8.
> 
> I don't see this. Please try with emacs -Q.

See attached file, bug-zoom.el.
emacs -Q, then load the file or eval it a sexp at a time if you want to see the
initial font name etc.

After loading, (frame-parameter nil 'font) gives
"-outline-Lucida Console-normal-normal-normal-mono-14-*-*-*-c-*-iso8859-1"

Then do `C-u 5 M-x enlarge-font'. (frame-parameter nil 'font) gives
"-outline-Lucida Console-normal-normal-normal-mono-19-*-*-*-c-*-iso8859-1"
which is correct.

Then do `C-u -5 M-x enlarge-font'. (frame-parameter nil 'font) gives
"-outline-Lucida Console-normal-normal-normal-mono-14-*-*-*-c-*-fontset-auto1"
which is NOT correct.

The code calls `modify-frame-parameters' with the same 14-point font name that
was returned initially, and which ends in "-iso8859-1", not "-fontset-auto1".
But that's not what the `font' parameter value is after the
`modify-frame-parameters' call.

`M-x debug-on-entry enlarge-font', and you will see, just after this call
(notice that the font name passed as argument is correct):

Debugger entered--returning value: nil
  modify-frame-parameters(#<frame emacs@DRADAMS-LAP1 0x2acf600> ((font .
"-outline-Lucida Console-normal-normal-normal-mono-14-*-*-*-c-*-iso8859-1")))

that (frame-parameter nil 'font) gives
"-outline-Lucida Console-normal-normal-normal-mono-14-*-*-*-c-*-fontset-auto1"
which is wrong.

(I also tried using `copy-sequence' to ensure that the string passed is a new
one etc. No improvement.)

Initially, I thought perhaps it had something to do with the call to
`query-fontset' in the commented-out piece of code in `enlarged-font-name',
since `query-fontset' returns a string with "-fontset-auto1" at the end. But the
bug remains, even with that code commented out.

Note too that over time, "-fontset-auto1" becomes "-fontset-auto2", and so on.

The bug seems to be in `modify-frame-parameters'.

FWIW, let me be clear why I would like this bug fixed. While waiting for the
fix, I hacked the code for Emacs 23 to just modify the :height attribute for the
`default' face. That is what most people do, to zoom a frame. That does not give
as many font/frame size possibilities as my code does - it is not as flexible.
So yes, I know there is a rudimentary workaround, but I would like this code to
work again, as it does in Emacs 20, 21, and 22. It doesn't seem right that
`modify-frame-parameters' modifies a frame differently from what you tell it to
do.