Rewrote global-scale

This commit is contained in:
Lars Tveito 2016-03-16 00:11:47 +01:00
parent 98bb09cf8e
commit 3c7624d8f5

View File

@ -891,22 +891,30 @@
generalized (or maybe be substituted by a package if it's out there). generalized (or maybe be substituted by a package if it's out there).
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun global-scale-default () (lexical-let* ((default (face-attribute 'default :height))
(interactive) (size default))
(set-face-attribute 'default nil :font "Inconsolata-14"))
(defun global-scale-default ()
(interactive)
(setq size default)
(global-scale-internal size))
(lexical-let ((size 14))
(defun global-scale-up () (defun global-scale-up ()
(interactive) (interactive)
(set-face-attribute (global-scale-internal (incf size 20)))
'default nil
:font (concat "Inconsolata-" (number-to-string (incf size)))))
(defun global-scale-down () (defun global-scale-down ()
(interactive) (interactive)
(set-face-attribute (global-scale-internal (decf size 20)))
'default nil
:font (concat "Inconsolata-" (number-to-string (decf size)))))) (defun global-scale-internal (arg)
(set-face-attribute 'default nil :height arg)
(set-temporary-overlay-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-=") 'global-scale-up)
(define-key map (kbd "C-+") 'global-scale-up)
(define-key map (kbd "C--") 'global-scale-down)
(define-key map (kbd "C-0") 'global-scale-default) map))))
#+END_SRC #+END_SRC
* Mode specific * Mode specific