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
(setq ns-pop-up-frames nil)
(setq ns-antialias-text nil)
;; fix emacs PATH on OSX (GUI only)
(use-package exec-path-from-shell
:if (memq window-system '(mac ns))

View file

@ -1,20 +1,20 @@
;; User interface layout & behavior
(provide 'core-ui)
;;; core-ui.el -- User interface layout & behavior
;;;; Load Theme ;;;;;;;;;;;;;;;;;;;;;;;;
(when window-system
;; No transparency!
(set-frame-parameter nil 'alpha 96)
(set-frame-parameter nil 'alpha '(94 70))
(unless (member *default-font (font-family-list))
(defconst *default-font *alt-font))
(unless (member *default-font (font-family-list))
(error "Font %s isn't installed" *default-font))
(let ((font-str (concat *default-font "-" (number-to-string *default-font-size))))
(let* ((font (nth 0 *fonts))
(font-name (nth 0 font))
(font-size (nth 1 font))
(font-aa (nth 2 font)))
(unless (member font-name (font-family-list))
(error "Font %s isn't installed" font-name))
(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 '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)
(load-dark-theme)
@ -53,8 +53,8 @@
(blink-cursor-mode 1))
;; Show full path in window title
(setq frame-title-format
'(:eval (if (buffer-file-name) (abbreviate-file-name (buffer-file-name)) "%b")))
;; (setq frame-title-format
;; '(:eval (if (buffer-file-name) (abbreviate-file-name (buffer-file-name)) "%b")))
;;;; Modeline ;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -129,3 +129,7 @@
(setq mode-line-position -linepo)
(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))
(defvar my/dark-theme-p t)
(defvar my/presentation-mode-p nil)
(defvar my/cycle-font-i 0)
;;;###autoload
(defun load-dark-theme()
@ -39,9 +39,14 @@
(load-dark-theme)))
;;;###autoload
(defun toggle-presentation-mode ()
(defun cycle-font ()
(interactive)
(if my/presentation-mode-p
(load-font *default-font *default-font-size)
(load-font *presentation-font *presentation-font-size))
(setq my/presentation-mode-p (not my/presentation-mode-p)))
(if (>= my/cycle-font-i (1- (length *fonts)))
(setq my/cycle-font-i 0)
(cl-incf my/cycle-font-i))
(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 *light-theme 'github) ; wtb better light theme...
(defconst *default-font "Terminus (TTF)")
(defconst *default-font-size (if (eq system-name "ganymede.local") 9 12))
(defconst *alt-font "Terminus")
(defconst *presentation-font "Panic Sans")
(defconst *presentation-font-size 22)
(defconst *fonts `(("Terminus (TTF)" ,(if (eq system-name "ganymede.local") 9 12) nil)
("Inconsolata" 22 t)))
(add-to-list 'load-path my-core-dir)
(add-to-list 'load-path my-modules-dir)