Something is overriding my emacs font size - emacs

In my .emacs file, I have (set-face-attribute 'default nil :height 200) as the last line.
When I start up emacs, I actually see the text flash briefly to this size, but then quickly get resized to the default size (height 110).
How can I discover what's overriding my font setting?
My OS is Raspbian GNU/Linux 10 (buster).
Update: I've tried removing everything from my .emacs file, and then using M-x customize-face default to make the font height 200, as suggested by #Drew. My .emacs file now looks like
(custom-set-variables
;; custom-set-variables 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.
)
(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 (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 200 :width normal :foundry "1ASC" :family "Liberation Mono")))))
However, I'm still seeing the same effect on startup. A brief flash of size 200 and the font getting resized by something after that.

set-face-attribute with nil for the frame sets a face attribute for the frame that's selected when that function is invoked. Don't use it in your init file unless you know which frame will be selected when it's invoked, and you want to change the face on that frame.
Either customize face default or customize default-frame-alist (its font, color, etc. parameters). I suggest M-x customize-face default. That affects face default in general - the default for all new frames.
Beyond that, it's possible that something in your init file is changing the font of the default face later on. When you do M-x customize-face default you can see what the latest value of the font attribute is.
If you think something in your init file is messing things up, bisect your init file to find it. You can use command comment-region to comment out a block of code or (with C-u) uncomment a block of code. Comment out 1/2 of your init file, then 3/4, 7/8, 15/16,... till you find the culprit.

Related

how does emacs choose which script to initialize with?

In both emacs 25.2.2 on Ubuntu 18.10, and 26.2 on arch we are experiencing the following weird behavior:
Ubuntu 18:
there is a .emacs file in my home directory.
If I run emacs, it works
.emacs sets indent style, font, and color
(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 (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight bold :height 180 :width normal :foundry "urw" :family "Nimbus Mono L")))))
(set-background-color "black")
(set-foreground-color "green")
When emacs is run by gnome-settings, it does not set the font correctly, but does set the indent and the color. I therefore conclude that the font setting is not working when gnome is first set up.
On arch, running emacs looks ok. But then if we load the file and M-x eval-buffer the font changes. Evaluating twice changes the font again. Eval a third time does nothing.
Can anyone explain what is happening, and how we can reliably select a font regardless of when the command is run?

Emacs 23.3.1 fixedsys font issue

I have downloaded the Fixedsys.TTF font.
I have moved the font into the /usr/share/fonts/truetype directory.
I have opened Emacs and navigated to Options > Set Default Font... and selected
FixedsysTTF and specified Monospaced and size 11. I then used Options > Save Options.
I have noticed in my .emacs file:
'(default ((t (:stipple nil :background "#232323"
:foreground "#e6e1de" :inverse-video nil :box nil
:strike-through nil :overline nil :underline nil
:slant normal :weight semi-bold :height 110
:width normal :foundry "unknown" :family "FixedsysTTF"))))
I do some work in Emacs and close it with Ctrl+c Ctrl+x.
I then reopen Emacs and it does not produce the same font. Rather, if I follow step 2. again I find that Emacs has defaulted to Monospace Regular 10. Although the font that is actually shown is not even Monospace Regular 10.
In order to correct this situation I am required to manually follow step 2. again and then everything is fine until I exit and startup again.
My question is whether or not there is a simple fix for this? Or, what lisp functions are being called in the background when I do step 2 so I can just hack the .emacs file to forcefully load fixedsys.
PS: I did try the font Fixedsys Excelsior, which is perfect BUT for the fact that in said version of Emacs (that is not to say that this happens in ONLY said version, but I am restricted to 23.3.1) the 'A' character causes the proceeding character to overlap the 'A'. However, this version of Fixedsys does not cause a problem with Emacs, and it remembers the font on exiting and the re-opening. Therefore, it is either: correct the situation with the overlapping 'A', or get the other version of Fixedsys (the one linked in step 1) to work. I do actually prefer Fixedsys Excelsior, but I cannot live with an overlapping 'A'. FYI, when I use Fixedsys Excelsior I get the following in my .emacs file:
'(default ((t (:stipple nil :background "#232323"
:foreground "#e6e1de" :inverse-video nil :box nil
:strike-through nil :overline nil :underline nil :slant normal
:weight normal :height 117 :width normal :foundry "unknown"
:family "Fixedsys Excelsior 3.01"))))
Again, the font is downloaded from the Fixedsys Excelsior link above and then the TTF moved into /usr/share/fonts/truetype.
Can someone help sort out either of these issues?
I have found out how to solve this issue:
Downloaded this modified version of FixedSYS
Moved to /usr/share/fonts/truetype
Injected:
(set-face-attribute 'default nil :font "Fixedsys Excelsior 3.01-L-12") into my .emacs file
Just to let you know, your links to Fixedsys.TTF font are pointing to a video site with questionable credentials.
Chris

How to override override modeline customization from org-faces.el?

org-faces.el contains this code
(org-copy-face 'mode-line 'org-mode-line-clock
"Face used for clock display in mode line.")
;; ...snip...
(provide 'org-faces)
;;; org-faces.el ends here
Which makes the right side of my modeline (the org clock display) have the same face as 'mode-line. Using my .emacs I'd like to change this behavior so that the org clock display uses the same face as 'mode-line-inactive.
I tried adding this to .emacs:
(require 'org-faces) ;;necessary?
(org-copy-face 'mode-line-inactive 'org-mode-line-clock
"Face used for clock display in mode line."
:background "blue")
(provide 'org-faces) ;;necessary?
but the modeline is unchanged after evaluating .emacs. Where am I going wrong? I'm pretty new to Lisp. Thanks for any help.
You should redefine the face, as I do for "org-todo":
(set-face-attribute 'org-todo nil
:weight 'bold :box '(:line-width 1 :color "#D8ABA7")
:foreground "#D8ABA7" :background "#FFE6E4")
You may (or must, maybe, depending on where you place the above lines) leave the requiring of org-faces, but clearly not the provide line.
Alternatively, use a color theme that improves Org's use (such as my Emacs Leuven theme, see https://github.com/fniessen/emacs-leuven-theme), eventually customizing it to suit your taste.
This seems to work:
(eval-after-load "org-faces"
'(set-face-attribute 'org-mode-line-clock nil
:inherit nil))
That is, make the org-mode-line-clock no longer inherit attributes from the mode-line face. It seems like it gets the attributes from mode-line or mode-line-inactive as appropriate, when displayed in the mode line.

Emacs customize-face loses/fails to recognise font-name it wrote to my .emacs itself

I used the Options/Set Default Font menu item to set my default emacs font to be LMMonoLtCond10 (it brought up a nice font-selector GUI widget to let me do this). My emacs immediately adopted the new font, and I was very happy. I then did Options/Save Options, and on inspecting my .emacs.d/init.el file saw that it had written the following there:
(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 (:inherit nil :stipple nil :background "white" :foreground "black"
:inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal
:weight light :height 120 :width normal :foundry "unknown" :family "LMMonoLtCond10"))))
(There are a couple of other faces I've defined below that.)
Unfortunately, if I quit emacs, and restart, it completely fails to recreate the font configuration that I had selected. Instead, I think it's giving me LMRoman-12. Am I doing something wrong, or is this an emacs bug.
I'm using Emacs 23.1.1:
(emacs-version)
"GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.20.1)
of 2011-03-05 on palmer, modified by Debian"
on an Ubuntu system.
Sounds like it might be a bug. M-x report-emacs-bug

Unreadable buffer names in Emacs 23.2

I just upgraded from Emacs 21.2 to 23.2 (on Windows XP) and while I managed to tweak my .emacs to fit the new changes, I couldn't find a solution for the unreadable buffer names:
Neither in the minibuffer, nor in the buffer menu can the characters be displayed normally. Instead, all I see are the infamous Unicode blank rectangles.
Any idea how to fix that?
Thanks.
Update: Again, all buffers are displayed perfectly (same font) - even with syntax highlighting. Buffers that contain buffer names also display everything properly, except for buffer names. Weird.
Could this possibly be related to the new feature introduced in Emacs 23.2 called "uniquify-buffer-name-style"?
The most likely explanation for rectangles is that your font doesn't have the required characters. The fix is to choose a different font (or install a more complete version of the same font).
Or is the problem that Emacs assumes the wrong encoding for file names? If so, please give more information, such as what encoding the file names are in, what it looks like Emacs is interpreting them as, and examples of working and non-working file names.
OK - with the help of Tim X from gnu.emacs.help, I found the offending lines in my .emacs that broke the new version (both statements need to be commented out!):
(setq default-frame-alist
(cons '(font . "-*-Lucida Console-normal-r-*-*-12-*-*-*-c-*-*-
iso8859-1")
default-frame-alist))
(set-default-font
"-*-Lucida Console-normal-r-*-*-12-*-*-*-c-*-*-iso8859-1")
Per Tim's advice, I used the Options menu to set the font and then save it to my .emacs. That resulted in appending the following 2-line single statement:
(custom-set-faces
'(default ((t (:inherit nil :stipple nil :background
"Black" :foreground "LightGray" :inverse-video nil :box nil :strike-
through nil :overline nil :underline nil :slant normal :weight
normal :height 90 :width normal :foundry "outline" :family "Lucida
Console")))))
By doing so, I am not sure my .emacs will continue working in Linux (as it did before - my .emacs was 100% cross-platform before).