[Emacs] Refactor font size functions

This commit is contained in:
Ivan Malison 2016-10-18 12:11:41 -07:00
parent 44be3b5652
commit a605d68864
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -605,25 +605,29 @@ This was taken from [[http://emacs.stackexchange.com/questions/7583/transiently-
(cond ((eq system-type 'darwin) 120) (cond ((eq system-type 'darwin) 120)
((eq system-type 'gnu/linux) 105))) ((eq system-type 'gnu/linux) 105)))
(cl-defun imalison:set-font-size (&optional (arg 10)) (defvar imalison:huge-font-size 280)
(defun imalison:current-font-size ()
(plist-get (custom-face-attributes-get 'default nil) :height))
(defun imalison:set-font-size (size)
(set-face-attribute 'default nil :height size))
(cl-defun imalison:modify-font-size (&optional (arg 10))
(interactive "p") (interactive "p")
(let ((current-height (imalison:set-font-size (+ (imalison:current-font-size) arg)))
(plist-get (custom-face-attributes-get 'default nil) :height)))
(set-face-attribute 'default nil :height
(+ current-height arg))))
(defun imalison:font-size-incr () (defun imalison:font-size-incr ()
(interactive) (interactive)
(imalison:set-font-size +10)) (imalison:modify-font-size +10))
(defun imalison:font-size-decr () (defun imalison:font-size-decr ()
(interactive) (interactive)
(imalison:set-font-size -10)) (imalison:modify-font-size -10))
(defun imalison:font-size-reset () (defun imalison:font-size-reset ()
(interactive) (interactive)
(set-face-attribute 'default nil (imalison:set-font-size imalison:default-font-size-pt))
:height imalison:default-font-size-pt))
#+END_SRC #+END_SRC
** Message Result Builder ** Message Result Builder
This macro is useful when writing emacs-lisp. It creates a new interactive command that shows you the result of evaluating a function, with optionally provided arguments. This macro is useful when writing emacs-lisp. It creates a new interactive command that shows you the result of evaluating a function, with optionally provided arguments.