From 1aa802999dc54ca0c34764f3950635685cdc5fc5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Nov 2016 15:24:29 +0100 Subject: Emacs: Fix font setting for new frames --- tag-emacs/emacs.d/init.org | 63 +++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'tag-emacs') diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index afce66b4..d5a6a21a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -148,37 +148,38 @@ When possible, set up fonts. I don’t have any settings here for X11, because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresources/main][XResources file]]. #+BEGIN_SRC emacs-lisp (when (or (display-graphic-p) - (daemonp)) - - (defun use-variable-fonts () - (interactive) - (variable-pitch-mode) - (setq cursor-type 'bar)) - - (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size) - (when mono-face - (let ((default-font (font-spec :name mono-face :size mono-font-size))) - (add-to-list 'default-frame-alist `(font . ,default-font)) - (set-face-font 'fixed-pitch default-font) - (set-frame-font default-font t t))) - (when variable-face - (set-face-font 'variable-pitch (font-spec :name variable-face :size variable-font-size)))) - - (defun ap/set-fonts-according-to-system () - (interactive) - (cond - ((eq window-system 'w32) - (ap/set-fonts "Liberation Mono" 11 "Segoe UI" 11)) - ((eq window-system 'ns) - (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) - (if (eq displays 1) - (ap/set-fonts "SF Mono" 12 "Lucida Grande" 12) - (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12)))) - ((eq window-system 'x) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 12)) - (ap/set-fonts "Terminus" 12 "Lucida" 10)))) - - (ap/set-fonts-according-to-system)) + (daemonp)) + + (defun use-variable-fonts () + (interactive) + (variable-pitch-mode) + (setq cursor-type 'bar)) + + (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size) + (when mono-face + (font-spec :family "ProggyTiny" :size 11) + (let ((default-font (font-spec :family mono-face :size mono-font-size))) + (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) + (set-face-font 'fixed-pitch default-font) + (set-frame-font default-font t t))) + (when variable-face + (set-face-font 'variable-pitch (font-spec :name variable-face :size variable-font-size)))) + + (defun ap/set-fonts-according-to-system () + (interactive) + (cond + ((eq window-system 'w32) + (ap/set-fonts "Liberation Mono" 11 "Segoe UI" 11)) + ((eq window-system 'ns) + (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) + (if (eq displays 1) + (ap/set-fonts "SF Mono" 12 "Lucida Grande" 12) + (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12)))) + ((eq window-system 'x) + (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 12)) + (ap/set-fonts "Terminus" 12 "Lucida" 10)))) + + (ap/set-fonts-according-to-system)) #+END_SRC Reduce font decoration. I’m trying to see whether this helps me focus -- cgit 1.4.1