archlinux emacs can't autoload monaco-fonts - emacs

I installed the monaco fonts from the AUR in archlinux, and set emacs's fonts to monaco, but it doesn't load the monaco fonts when emacs starts, I have to set the font to monaco manually when starting emacs, can anyone one give me some hint of what to do?
This is part of my .emacs.d/init.el:
(custom-set-faces
'(default ((t (:family "Monaco" :foundry "unknown" :slant normal :weight normal :height 128 :width normal)))))

I find the (custom-set-faces ...) doesn't make sense in this case, I use the following code found in https://superuser.com/ and succeed.
(set-frame-font "Monaco 14" nil t)
(add-to-list 'default-frame-alist
'(font . "Monaco 14"))

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: whitespace face overriden by solarized?

I tried out the solarized theme (available from here) and really liked it. However, it somehow overwrites my whitespace settings and no matter how I configure the whitespace-face, it gets overwritten. Any ideas on how to control the color of my whitespaces while keeping the neat looking color-theme-solarized-dark?
From .emacs:
;;; Install colortheme
(add-to-list 'load-path "/home/blabla/.emacs.d/color-theme-6.6.0/")
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
(color-theme-hober)))
;;; Install solarized
(add-to-list 'load-path "/home/blabla/.emacs.d/emacs-color-theme-solarized")
(require 'color-theme-solarized)
(color-theme-solarized-dark)
This was my previous setup:
(custom-set-faces
'(whitespace-space ((((class color) (background light)) (:background "white" :foreground "darkgrey"))))
'(whitespace-tab ((((class color) (background light)) (:background "white" :foreground "darkgrey")))))
The only thing I found to have any effect was:
(whitespace-space ((t (:background "red"))))
Of course, that just renders an ugly background for every white space.
Using GNU Emacs 23.3.1.
The version of Solarized here has all the faces needed for whitespace-mode to look good with Solarized. It's for Emacs 24 (but may work on Emacs 23 as well if load-theme is present there) only though, but if you don't want to use it you can simply copy the relevant colors into the definition of the color theme you've downloaded.

How to disable auctex fontification, without losing color highlighting?

I like maximum syntax highlighting of AucTeX, but I don't like AucTeX messing with fonts. For example, if I use italics, it shows italicized letters in my emacs buffer, and shows subscripts and superscripts in small letters (slightly above or below the line). I prefer to use a fixed width font regardless of the latex environment I am in.
I tried changing the settings for the variable font-latex-deactivated-keyword-classes, but then the syntax coloring also disappears.
Could someone suggest a way to fix this?
Thanks.
From http://www.gnu.org/software/auctex/manual/auctex/Faces.html#Faces
In case you want to change the colors and fonts used by font-latex please refer to the faces mentioned in the explanations above and use M-x customize-face RET <face> RET. All faces defined by font-latex are accessible through a customization group by typing
M-x customize-group RET font-latex-highlighting-faces RET.
The above command opens the settings buffer where you can set the appropriate font face. Once you save changes, your .emacs file will contain a line similar to:
'(font-latex-sectioning-5-face ((((class color) (background light))
(:inherit variable-pitch :foreground "blue4" :weight normal :foundry
"outline" :family "Century Gothic")
In your example, you can customize the Font Latex Italic Face to your specifications. Your .emacs should then contain
'(font-latex-italic-face ...)
to whatever you set it to. You can similarly customize superscript, subscript and whole host of other font faces.
In recent versions of AUCTeX:
(setq font-latex-fontify-script nil)
(setq font-latex-fontify-sectioning 'color)
See this page in the manual and the section Deactivating defaults of built-in keyword classes.
Tested on Emacs 24.3. Put the following in your ~/.emacs file:
(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.
'(font-latex-bold-face ((t nil)))
'(font-latex-doctex-documentation-face ((t nil)))
'(font-latex-doctex-preprocessor-face ((t nil)))
'(font-latex-italic-face ((t nil)))
'(font-latex-math-face ((t nil)))
'(font-latex-sectioning-0-face ((t nil)))
'(font-latex-sectioning-1-face ((t nil)))
'(font-latex-sectioning-2-face ((t nil)))
'(font-latex-sectioning-3-face ((t nil)))
'(font-latex-sectioning-4-face ((t nil)))
'(font-latex-sectioning-5-face ((t nil)))
'(font-latex-sedate-face ((t nil)))
'(font-latex-slide-title-face ((t nil)))
'(font-latex-string-face ((t nil)))
'(font-latex-subscript-face ((t nil)))
'(font-latex-superscript-face ((t nil)))
'(font-latex-verbatim-face ((t nil)))
'(font-latex-warning-face ((t nil))))

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

emacsclient unable to load color "unspecified-bg"

I'm getting the error Unable to load color "unspecified-bg" [16 times] when using emacsclient -c. I've started up emacs using emacs --daemon. This seems to mean that my custom faces won't load.
When starting emacs as usual, and then using M-x server-start, then this problem doesn't happen at all. How can I get emacsclient -c to load the faces properly?
Here's the relevant code:
(custom-set-faces '(default ((t (:inherit nil :stipple nil :background "black" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :foundry "unknown" :family "Inconsolata")))))
I'm not 100% sure this would fix your problem, but you really should be using color-theme for syntax highlighting. Custom is meant for beginning emacs users, so I'd suggest you try out color-theme and see if it works. Here's how I have it set up on my machine:
Download the package from the color-theme homepage.
Put the color-theme folder somewhere like ~/.emacs.d/color-theme/.
Make sure this folder is in your load-path. I took the following code from a Steve Yegge post:
In your .emacs:
(defvar emacs-root "~/.emacs.d/")
(labels
((add-path
(p)
(add-to-list
'load-path
(concat emacs-root p))))
(add-path "lisp")
(add-path "color-theme-6.6.0")
(add-path "cedet-1.0"))
(require 'color-theme)
Then you define your color theme:
;; Color-theme
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
;; Set custom color theme
(defun color-theme-mine ()
"My custom color theme"
(interactive)
(set-cursor-color "#ffffff")
(color-theme-install
'(color-theme-mine
;; Super-light grey on Dark grey
((foreground-color . "#e0e0e0")
(background-color . "#151515")
(background-mode . dark))
(font-lock-comment-face ((t (:foreground "#106010")))) ;; Forest Green
;; More definitions below
;; ...
(color-theme-mine)) ;; end eval-after-load
This will load color-them-mine when you start emacs. You can see all available color themes by typing M-x color-theme <TAB>. To see the full list of faces available, use the command M-x list-faces-display.
Sounds like this might be bug #4776: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4776#5. If not, consider filing a bug report for this one, using M-x report-emacs-bug.