forked from colonelpanic/dotfiles
Improve font adjustment
This commit is contained in:
parent
6d99c14066
commit
9a16039965
@ -570,7 +570,7 @@ the ~:around~ keyword of advice-add.
|
||||
** Font Size
|
||||
This was taken from [[http://emacs.stackexchange.com/questions/7583/transiently-adjust-text-size-in-mode-line-and-minibuffer][here]]. It is primarily invoked from a hydra defined below. It would be cool if it got the default font size from whatever the default font was but it does not currently do that.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq imalison:default-font-size-pt 14)
|
||||
(setq imalison:default-font-size-pt 100)
|
||||
|
||||
(defun imalison:font-size-adj (&optional arg)
|
||||
"The default C-x C-0/-/= bindings do an excellent job of font resizing.
|
||||
@ -581,16 +581,18 @@ This was taken from [[http://emacs.stackexchange.com/questions/7583/transiently-
|
||||
decreases font size by NUM points if NUM is -ve
|
||||
resets font size if NUM is 0."
|
||||
(interactive "p")
|
||||
(if (= arg 0)
|
||||
(setq font-size-pt imalison:default-font-size-pt)
|
||||
(setq font-size-pt (+ font-size-pt arg)))
|
||||
;; The internal font size value is 10x the font size in points unit.
|
||||
;; So a 10pt font size is equal to 100 in internal font size value.
|
||||
(set-face-attribute 'default nil :height (* font-size-pt 10)))
|
||||
(let ((current-height
|
||||
(plist-get (custom-face-attributes-get 'default nil) :height)))
|
||||
(set-face-attribute 'default nil :height
|
||||
(+ current-height arg))))
|
||||
|
||||
(defun imalison:font-size-incr () (interactive) (imalison:font-size-adj +1))
|
||||
(defun imalison:font-size-decr () (interactive) (imalison:font-size-adj -1))
|
||||
(defun imalison:font-size-reset () (interactive) (imalison:font-size-adj 0))
|
||||
|
||||
|
||||
(defun imalison:font-size-incr () (interactive) (imalison:font-size-adj +10))
|
||||
(defun imalison:font-size-decr () (interactive) (imalison:font-size-adj -10))
|
||||
(defun imalison:font-size-reset () (interactive)
|
||||
(set-face-attribute 'default nil
|
||||
:height imalison:default-font-size-pt))
|
||||
#+END_SRC
|
||||
** 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.
|
||||
|
Loading…
Reference in New Issue
Block a user