all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: martin rudalics <rudalics@gmx.at>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Note on e65c307 breaks font-height
Date: Sat, 28 May 2016 03:38:31 -0700	[thread overview]
Message-ID: <57497527.8050600@cs.ucla.edu> (raw)
In-Reply-To: <5748490A.6020906@gmx.at>

[-- Attachment #1: Type: text/plain, Size: 2787 bytes --]

martin rudalics wrote:
>  > What exactly is in your .emacs file? That is, can you give a recipe to
> reproduce the problem?
>
> It's reproducible here with my
>
> (custom-set-faces
>   ;; custom-set-faces was added by Custom.
>   ;; If you edit it by hand, you could mess it up, so be careful.
>   ;; Your init file should contain only one such instance.
>   ;; If there is more than one, they won't work right.
>   '(default ((t (:stipple nil :background "grey92" :foreground "black"
> :inverse-video nil :box nil :strike-through nil :overline nil :underline nil
> :slant normal :weight normal :height 98 :width normal :foundry "outline" :family
> "Courier New")))))

I'm afraid that's not enough of a recipe for me to reproduce the problem. On 
Ubuntu 16.04 x86-64 if I change my ~/.emacs file so that it contains just the 
abovementioned code, and then run the shell command 'src/emacs -q --eval 
"(set-face-attribute 'default nil :height 80)"', I get a *scratch* buffer where 
evaluating (setq F (face-attribute 'default :font (car (car (cdr 
(current-frame-configuration)))) 'default)) yields a font object F that prints 
as #<font-object "-DAMA-Ubuntu 
Mono-normal-normal-normal-*-11-*-*-*-m-0-iso10646-1">, and (font-get F 
:user-spec) indeed yields "Ubuntu Mono 13" in emacs-25 whereas it yields nil in 
Emacs 24.5. OK, but what is the regression here? The display has the same (ugly) 
appearance in Emacs 24.5 that it does in emacs-25. And in both Emacs 24.5 and 
emacs-25 if I reapply .emacs the display changes to the same (nicer) appearance.

The emacs-25 value of (font-get F :user-spec) is what was intended by commit 
42707278 as part of a fix for Bug#5157, by the way.


> My analysis so far is as follows: In ‘font-setting-change-default-font’
> the disjunct (frame-parameter f 'font-parameter) always evaluates to
> nil here.  Before your patch, the disjunct
>
>           (or (font-get (face-attribute 'default :font f 'default)
>                     :user-spec)
>
> always evaluated to nil.  After your patch it returns "Monospace 11" and
> ‘frame-font’ gets set to that and the frame's default font too.  IIUC
> the height of the default face gets set to that value too but a new
> frame gets the value from my .emacs.  As a consequence, customizing the
> default face will present me different height values corresponding to
> the frame where I start the customization from.  That is awfully weird.

I'm afraid I can't reproduce a problem from this informal description. Perhaps 
if you could say exactly which code to run....  That being said, does the 
attached experimental patch address the issue for you? Again, I'm not seriously 
proposing installing this, just trying to understand the problem.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-face-attribute-default-settings.patch --]
[-- Type: text/x-diff; name="0001-Fix-face-attribute-default-settings.patch", Size: 1683 bytes --]

From 6e3fee06d9bbac50f843efb333d1e919b78299b1 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 28 May 2016 03:37:00 -0700
Subject: [PATCH] Fix face attribute default settings

Problem reported by Martin Rudalics in:
http://lists.gnu.org/archive/html/emacs-devel/2016-05/msg00557.html
* lisp/dynamic-setting.el (font-setting-change-default-font):
Don't confuse default face font user spec with frame font.
---
 lisp/dynamic-setting.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/dynamic-setting.el b/lisp/dynamic-setting.el
index 6021a3b..854d3ad 100644
--- a/lisp/dynamic-setting.el
+++ b/lisp/dynamic-setting.el
@@ -53,17 +53,17 @@ font-setting-change-default-font
 	  (set-frame-font new-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))))
+	  (let ((user-spec (font-get (face-attribute 'default :font f 'default)
+				     :user-spec))
+		(frame-font (frame-parameter f 'font-parameter)))
 	    (when frame-font
-	      (set-frame-parameter f 'font-parameter frame-font)
+	      (set-frame-parameter f 'font-parameter frame-font))
+	    (when default-face-font-user-spec
 	      (set-face-attribute 'default f
 				  :width 'normal
 				  :weight 'normal
 				  :slant 'normal
-				  :font frame-font))))))))
+				  :font user-spec))))))))
 
 (defun dynamic-setting-handle-config-changed-event (event)
   "Handle config-changed-event on the display in EVENT.
-- 
2.7.4


  parent reply	other threads:[~2016-05-28 10:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26 10:44 Note on e65c307 breaks font-height martin rudalics
2016-05-26 15:05 ` Paul Eggert
2016-05-26 15:22   ` Eli Zaretskii
2016-05-26 15:33     ` Paul Eggert
2016-05-26 15:50       ` Eli Zaretskii
2016-05-26 15:57         ` Paul Eggert
2016-05-26 16:33           ` Eli Zaretskii
2016-05-27 13:18   ` martin rudalics
2016-05-28 10:17     ` Eli Zaretskii
2016-05-29 13:43       ` martin rudalics
2016-05-29 15:07         ` Eli Zaretskii
2016-05-30  8:00           ` martin rudalics
2016-06-04  7:28             ` Eli Zaretskii
2016-06-04  9:48               ` martin rudalics
2016-06-04 10:52                 ` Eli Zaretskii
2016-06-04 13:07                   ` martin rudalics
2016-05-28 10:38     ` Paul Eggert [this message]
2016-05-29 13:43       ` martin rudalics
2016-05-29 17:14         ` Paul Eggert
2016-05-30  8:00           ` martin rudalics
2016-05-26 15:16 ` 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=57497527.8050600@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /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.