Subject: bug#25228: 25.1; GNU emacs 25.1: custom-set-faces from init file ~/.emacs ignored

From: "Dr. Werner Fink" <[email-masked]>
Date: Tue, 20 Dec 2016 12:18:58 +0100

On Mon, Dec 19, 2016 at 10:43:37PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 19 Dec 2016 21:20:49 +0100
> > From: martin rudalics <[email-masked]>
> > CC: [email-masked], [email-masked]
> > 
> > IIUC all this ‘dynamic-setting-handle-config-changed-event’ mechanism is
> > about detecting changes applied to GConf and/or GSettings on the fly and
> > applying them to the running Emacs session.  Such configuration settings
> > should never override anything specified by the user in her .emacs.  The
> > mechanism was virtually inoperative for four years until Paul changed an
> > innocuous parameter descriptor.  So this mechanism has never been tested
> > in all those years ...
> 
> Can you describe how that mechanism is triggered by the offending
> change?

Just play around with eval-region/expression ... that is that I can switch with

  (font-setting-change-default-font ":0" t)

or

  (font-setting-change-default-font ":0" nil)

to the system default font settings and then with

  (custom-set-faces '(default ((t (:family "B&H LucidaTypewriter"
    :foundry "B&H" :slant normal :weight normal :height 110 :width normal)))))

IMHO it would be enough if the API below (custom-set-faces) would set
the default font used by (font-setting-change-default-font) ... or the
otherway around that (font-setting-change-default-font) would respect
the values specified by (custom-set-faces).

Debugging the code (font-setting-change-default-font) function shows with

   (setq frame-list (frames-on-display-list ":0"))
   (setq f (nth 0 frame-list))

to get the frame f that the face attribute is set correct

   (face-attribute 'default :font f 'default)

   #<font-object "-B&H-B&H LucidaTypewriter-normal-normal-normal-Sans-14-*-*-*-m-90-iso10646-1"> [2 times]

but using the outer call of font-get

   (font-get (face-attribute 'default :font f 'default) :user-spec)

results in

   "Monospace 11"

which is *not*  LucidaTypewriter. And as the call

   (frame-parameter f 'font-parameter)

returns nil the full call of the or switch

  (or (font-get (face-attribute 'default :font f 'default)
                               :user-spec)
                     (frame-parameter f 'font-parameter))

does return

   "Monospace 11"

Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr