From 88dfabb335bbf1b20e69a37635a3736b04a5d831 Mon Sep 17 00:00:00 2001 From: Rich Alesi Date: Wed, 25 Mar 2015 22:51:29 -0700 Subject: [PATCH] make scale font microstate use spacemacs microstate maco --- spacemacs/funcs.el | 25 +++---------------------- spacemacs/keybindings.el | 11 ++++++++--- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/spacemacs/funcs.el b/spacemacs/funcs.el index 799ec929f..329b109aa 100644 --- a/spacemacs/funcs.el +++ b/spacemacs/funcs.el @@ -652,24 +652,7 @@ toggling fullscreen." 'maximized) 'fullboth))))) -;;; begin scale font micro-state - -(defun spacemacs/scale-font-size-overlay-map () - "Set a temporary overlay map to easily change the font size." - (set-temporary-overlay-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "+") 'spacemacs/scale-up-font) - (define-key map (kbd "-") 'spacemacs/scale-down-font) - (define-key map (kbd "=") 'spacemacs/reset-font-size) - map) t)) - -(defun spacemacs/font-scaling-micro-state-doc () - "Display a short documentation in the mini buffer." - (echo "Scale Font micro-state: - + to scale up - - to scale down - = to reset -Press any other key to exit.")) +;;; begin scale font functions (defun spacemacs/scale-up-or-down-font-size (direction) "Scale the font. If DIRECTION is positive or zero the font is scaled up, @@ -680,9 +663,7 @@ otherwise it is scaled down." (text-scale-set 0) (if (< direction 0) (text-scale-decrease scale) - (text-scale-increase scale)))) - (spacemacs/scale-font-size-overlay-map) - (spacemacs/font-scaling-micro-state-doc)) + (text-scale-increase scale))))) (defun spacemacs/scale-up-font () "Scale up the font." @@ -699,7 +680,7 @@ otherwise it is scaled down." (interactive) (spacemacs/scale-up-or-down-font-size 0)) -;;; end scale font micro-state +;;; end scale font microstate (defmacro spacemacs|diminish (mode unicode &optional ascii) "Diminish MODE name in mode line to UNICODE or ASCII depending on the value diff --git a/spacemacs/keybindings.el b/spacemacs/keybindings.el index 873614bf7..3b76dd0df 100644 --- a/spacemacs/keybindings.el +++ b/spacemacs/keybindings.el @@ -283,10 +283,15 @@ Ensure that helm is required before calling FUNC." "w/" 'split-window-right "w=" 'balance-windows) ;; text ----------------------------------------------------------------------- +(spacemacs|define-micro-state scale-font + :doc "Scale Font [+] scale up [-] scale down [=] reset font" + :evil-leader "zx" + :use-minibuffer t + :bindings + ("+" spacemacs/scale-up-font) + ("-" spacemacs/scale-down-font) + ("=" spacemacs/reset-font-size)) (evil-leader/set-key - "zx=" 'spacemacs/reset-font-size - "zx+" 'spacemacs/scale-up-font - "zx-" 'spacemacs/scale-down-font "xdw" 'delete-trailing-whitespace "xtc" 'transpose-chars "xtl" 'transpose-lines