Replace toggle-presentation with cycle-font

This commit is contained in:
Henrik Lissner 2015-01-20 03:17:50 -05:00
parent 8cff2e5580
commit 1181d4ba72
4 changed files with 31 additions and 28 deletions

View file

@ -7,8 +7,6 @@
;; Don't open files from the workspace in a new frame ;; Don't open files from the workspace in a new frame
(setq ns-pop-up-frames nil) (setq ns-pop-up-frames nil)
(setq ns-antialias-text nil)
;; fix emacs PATH on OSX (GUI only) ;; fix emacs PATH on OSX (GUI only)
(use-package exec-path-from-shell (use-package exec-path-from-shell
:if (memq window-system '(mac ns)) :if (memq window-system '(mac ns))

View file

@ -1,20 +1,20 @@
;; User interface layout & behavior ;;; core-ui.el -- User interface layout & behavior
(provide 'core-ui)
;;;; Load Theme ;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Load Theme ;;;;;;;;;;;;;;;;;;;;;;;;
(when window-system (when window-system
;; No transparency! ;; No transparency!
(set-frame-parameter nil 'alpha 96) (set-frame-parameter nil 'alpha '(94 70))
(unless (member *default-font (font-family-list)) (let* ((font (nth 0 *fonts))
(defconst *default-font *alt-font)) (font-name (nth 0 font))
(font-size (nth 1 font))
(unless (member *default-font (font-family-list)) (font-aa (nth 2 font)))
(error "Font %s isn't installed" *default-font)) (unless (member font-name (font-family-list))
(error "Font %s isn't installed" font-name))
(let ((font-str (concat *default-font "-" (number-to-string *default-font-size)))) (let ((font-str (concat font-name "-" (number-to-string font-size))))
(setq ns-antialias-text font-aa)
(add-to-list 'default-frame-alist `(font . ,font-str)) (add-to-list 'default-frame-alist `(font . ,font-str))
(add-to-list 'initial-frame-alist `(font . ,font-str)))) (add-to-list 'initial-frame-alist `(font . ,font-str)))))
(add-to-list 'custom-theme-load-path my-themes-dir) (add-to-list 'custom-theme-load-path my-themes-dir)
(load-dark-theme) (load-dark-theme)
@ -53,8 +53,8 @@
(blink-cursor-mode 1)) (blink-cursor-mode 1))
;; Show full path in window title ;; Show full path in window title
(setq frame-title-format ;; (setq frame-title-format
'(:eval (if (buffer-file-name) (abbreviate-file-name (buffer-file-name)) "%b"))) ;; '(:eval (if (buffer-file-name) (abbreviate-file-name (buffer-file-name)) "%b")))
;;;; Modeline ;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Modeline ;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -129,3 +129,7 @@
(setq mode-line-position -linepo) (setq mode-line-position -linepo)
(sml/filter-mode-line-list 'mode-line-position)))) (sml/filter-mode-line-list 'mode-line-position))))
(provide 'core-ui)
;;; core-ui.el ends here

View file

@ -1,7 +1,7 @@
(eval-when-compile (require 'cl)) (eval-when-compile (require 'cl))
(defvar my/dark-theme-p t) (defvar my/dark-theme-p t)
(defvar my/presentation-mode-p nil) (defvar my/cycle-font-i 0)
;;;###autoload ;;;###autoload
(defun load-dark-theme() (defun load-dark-theme()
@ -39,9 +39,14 @@
(load-dark-theme))) (load-dark-theme)))
;;;###autoload ;;;###autoload
(defun toggle-presentation-mode () (defun cycle-font ()
(interactive) (interactive)
(if my/presentation-mode-p (if (>= my/cycle-font-i (1- (length *fonts)))
(load-font *default-font *default-font-size) (setq my/cycle-font-i 0)
(load-font *presentation-font *presentation-font-size)) (cl-incf my/cycle-font-i))
(setq my/presentation-mode-p (not my/presentation-mode-p))) (let* ((font (nth my/cycle-font-i *fonts))
(font-name (nth 0 font))
(font-size (nth 1 font))
(font-aa (nth 2 font)))
(load-font font-name font-size)
(setq ns-antialias-text font-aa)))

View file

@ -30,12 +30,8 @@
(defconst *dark-theme 'brin) (defconst *dark-theme 'brin)
(defconst *light-theme 'github) ; wtb better light theme... (defconst *light-theme 'github) ; wtb better light theme...
(defconst *default-font "Terminus (TTF)") (defconst *fonts `(("Terminus (TTF)" ,(if (eq system-name "ganymede.local") 9 12) nil)
(defconst *default-font-size (if (eq system-name "ganymede.local") 9 12)) ("Inconsolata" 22 t)))
(defconst *alt-font "Terminus")
(defconst *presentation-font "Panic Sans")
(defconst *presentation-font-size 22)
(add-to-list 'load-path my-core-dir) (add-to-list 'load-path my-core-dir)
(add-to-list 'load-path my-modules-dir) (add-to-list 'load-path my-modules-dir)