all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Dr. Werner Fink" <werner@suse.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 25228@debbugs.gnu.org
Subject: bug#25228: 25.1; GNU emacs 25.1: custom-set-faces from init file ~/.emacs ignored
Date: Tue, 20 Dec 2016 17:41:39 +0100	[thread overview]
Message-ID: <20161220164139.mx5zfjp3tuueeqnh@boole.suse.de> (raw)
In-Reply-To: <83tw9y37b6.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 1503 bytes --]

On Tue, Dec 20, 2016 at 06:15:57PM +0200, Eli Zaretskii wrote:
> > Date: Tue, 20 Dec 2016 12:18:58 +0100
> > From: "Dr. Werner Fink" <werner@suse.de>
> > Cc: martin rudalics <rudalics@gmx.at>, 25228@debbugs.gnu.org
> > 
> > > 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)))))
> 
> Thanks.  However, I don't have easy access to systems where this
> problem happens, so I must examine the source code instead.  That is
> why I asked to describe which code triggers this and how it started
> affecting us after commit e65c307.

The only guess I have is that the correction had now enabled the :user-spec
key/attribute.  For a workaround I've change some lines of code in
lisp/dynamic-setting.el ... compare with the attached patch.

With this patch both the custom font if enabled in ~/.emacs as well as
the system font works here for GNU Emacs with GTK as well as with X11.


Werner

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

[-- Attachment #1.2: emacs-25.1-custom-fonts.patch --]
[-- Type: text/x-patch, Size: 2479 bytes --]

Work around openSUSE bug #1016172
 
--
 lisp/dynamic-setting.el |   30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

--- lisp/dynamic-setting.el
+++ lisp/dynamic-setting.el	2016-12-20 16:17:30.100242946 +0000
@@ -33,6 +33,7 @@
 ;;; Customizable variables
 
 (declare-function font-get-system-font "xsettings.c" ())
+(declare-function font-face-attributes "font.c" (font &optional frame))
 
 (defvar font-use-system-font)
 
@@ -42,28 +43,29 @@ If DISPLAY-OR-FRAME is a frame, the disp
 
 If SET-FONT is non-nil, change the font for frames.  Otherwise re-apply the
 current form for the frame (i.e. hinting or somesuch changed)."
-  (let ((new-font (and (fboundp 'font-get-system-font)
-		       (font-get-system-font)))
-	(frame-list (frames-on-display-list display-or-frame)))
-    (when (and new-font (display-graphic-p display-or-frame))
+  (let ((system-font (and (fboundp 'font-get-system-font)
+                       (font-get-system-font)))
+        (frame-list (frames-on-display-list display-or-frame))
+	(user-font (face-attribute 'default :font)))
+    (when (and system-font (display-graphic-p display-or-frame))
       (clear-font-cache)
       (if set-font
 	  ;; Set the font on all current and future frames, as though
 	  ;; the `default' face had been "set for this session":
-	  (set-frame-font new-font nil frame-list)
+	  (if (not user-font)
+	      (set-frame-font system-font nil frame-list)
+	     (set-frame-font user-font nil frame-list))
 	;; Just redraw the existing fonts on all frames:
 	(dolist (f frame-list)
-	  (let ((frame-font
-		 (or (font-get (face-attribute 'default :font f 'default)
-			       :user-spec)
-		     (frame-parameter f 'font-parameter))))
+	  ;; (apply 'font-spec (font-face-attributes (font-get-system-font)))
+	  (let* ((frame-font
+		  (or (face-attribute 'default :font f 'default)
+		      (frame-parameter f 'font-parameter)))
+		 (font-attr (font-face-attributes frame-font)))
 	    (when frame-font
 	      (set-frame-parameter f 'font-parameter frame-font)
-	      (set-face-attribute 'default f
-				  :width 'normal
-				  :weight 'normal
-				  :slant 'normal
-				  :font frame-font))))))))
+	      (apply #'set-face-attribute 'default f 
+	      (set-face-attribute 'default font-attr)))))))))
 
 (defun dynamic-setting-handle-config-changed-event (event)
   "Handle config-changed-event on the display in EVENT.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-12-20 16:41 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 10:03 bug#25228: 25.1; GNU emacs 25.1: custom-set-faces from init file ~/.emacs ignored Dr. Werner Fink
2016-12-19 15:09 ` bug#25228: [emacs-bug] " Dr. Werner Fink
2016-12-19 17:37 ` Eli Zaretskii
2016-12-19 18:36   ` martin rudalics
2016-12-19 18:57     ` Eli Zaretskii
2016-12-19 20:20       ` martin rudalics
2016-12-19 20:43         ` Eli Zaretskii
2016-12-20 10:59           ` martin rudalics
2016-12-20 16:11             ` Eli Zaretskii
2016-12-20 16:25               ` martin rudalics
2016-12-20 17:06                 ` Eli Zaretskii
2016-12-20 17:28                   ` Dr. Werner Fink
2016-12-20 17:34                   ` martin rudalics
2016-12-20 17:55                     ` Eli Zaretskii
2016-12-20 18:18                       ` martin rudalics
2016-12-20 18:39                         ` Eli Zaretskii
2016-12-20 18:49                           ` martin rudalics
2016-12-20 19:31                             ` Eli Zaretskii
2016-12-20 19:11                           ` Rostislav Svoboda
2016-12-20 19:24                             ` Rostislav Svoboda
2016-12-20 19:34                               ` Eli Zaretskii
2016-12-20 21:50                                 ` Rostislav Svoboda
2016-12-21  7:42                                   ` martin rudalics
2016-12-21 11:03                                     ` Rostislav Svoboda
2016-12-21 17:25                                       ` Eli Zaretskii
2016-12-22  8:35                                       ` martin rudalics
2016-12-22 11:59                                         ` Rostislav Svoboda
2016-12-22 17:45                                           ` martin rudalics
2016-12-20 19:29                             ` martin rudalics
2016-12-21  8:11             ` Dr. Werner Fink
2016-12-21  8:47               ` bug#25228: [emacs-bug] " Dr. Werner Fink
2016-12-21  8:56                 ` martin rudalics
2016-12-21 11:08                   ` Dr. Werner Fink
2016-12-22  8:35                     ` martin rudalics
2016-12-22 11:46                       ` Dr. Werner Fink
2016-12-22 17:44                         ` martin rudalics
2016-12-23  7:20                           ` Dr. Werner Fink
2016-12-21 17:24                 ` Eli Zaretskii
2016-12-21 17:39                   ` Dr. Werner Fink
2016-12-21 18:04                     ` Eli Zaretskii
2016-12-21  8:48               ` martin rudalics
2016-12-21 12:08                 ` Dr. Werner Fink
2016-12-21 17:34                   ` Eli Zaretskii
2016-12-22  8:35                     ` martin rudalics
2016-12-22 17:30                       ` Eli Zaretskii
2016-12-22 17:45                         ` martin rudalics
2016-12-23  7:29                           ` Dr. Werner Fink
2016-12-20 11:18           ` Dr. Werner Fink
2016-12-20 16:15             ` Eli Zaretskii
2016-12-20 16:41               ` Dr. Werner Fink [this message]
2016-12-20 16:56                 ` bug#25228: [emacs-bug] " Dr. Werner Fink
2016-12-20 17:58                   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161220164139.mx5zfjp3tuueeqnh@boole.suse.de \
    --to=werner@suse.de \
    --cc=25228@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.