diff options
author | Alan Pearce | 2016-06-13 10:39:18 +0200 |
---|---|---|
committer | Alan Pearce | 2016-06-13 10:39:18 +0200 |
commit | c48b283fcc5fbbc083de41b8f15728b93a68f9af (patch) | |
tree | 2df5c0de17b7c66cb97cca84530f7397e320c0cf /tag-emacs | |
parent | f1b4cb4c26738b60892e44654cb1667ac006a5e7 (diff) | |
download | dotfiles-c48b283fcc5fbbc083de41b8f15728b93a68f9af.tar.lz dotfiles-c48b283fcc5fbbc083de41b8f15728b93a68f9af.tar.zst dotfiles-c48b283fcc5fbbc083de41b8f15728b93a68f9af.zip |
Emacs: Set OS X differently depending on displays
Diffstat (limited to 'tag-emacs')
-rw-r--r-- | tag-emacs/emacs.d/init.org | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8789372..af89161 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -152,31 +152,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 (concat mono-face "-" (number-to-string 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 (concat variable-face "-" - (number-to-string variable-font-size))))) - - (cond - ((eq window-system 'w32) - (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) - ((eq system-type 'darwin) - (setq ns-antialias-text nil) - (ap/set-fonts "Anonymous Pro" 11 "Lucida Grande" 12)) - ((eq window-system 'x) - (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10)))) + (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 antialias) + (when mono-face + (let ((default-font (concat mono-face "-" (number-to-string 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 (concat variable-face "-" + (number-to-string variable-font-size)))) + (when (boundp 'ns-antialias-text) + (setq ns-antialias-text antialias))) + + (defun ap/set-fonts-according-to-system () + (cond + ((eq window-system 'w32) + (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) + ((eq system-type 'darwin) + (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) + (if (eq displays 1) + (ap/set-fonts "PT Mono" 12 "Lucide Grande" 12 t) + (ap/set-fonts "Anonymous Pro" 11 "Lucida Grande" 12 nil)))) + ((eq window-system 'x) + (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10)))) + + (ap/set-fonts-according-to-system)) #+END_SRC Reduce font decoration. I’m trying to see whether this helps me focus |