Improve font adjustment
This commit is contained in:
parent
6d99c14066
commit
9a16039965
@ -570,7 +570,7 @@ the ~:around~ keyword of advice-add.
|
|||||||
** Font Size
|
** 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.
|
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
|
#+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)
|
(defun imalison:font-size-adj (&optional arg)
|
||||||
"The default C-x C-0/-/= bindings do an excellent job of font resizing.
|
"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
|
decreases font size by NUM points if NUM is -ve
|
||||||
resets font size if NUM is 0."
|
resets font size if NUM is 0."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(if (= arg 0)
|
(let ((current-height
|
||||||
(setq font-size-pt imalison:default-font-size-pt)
|
(plist-get (custom-face-attributes-get 'default nil) :height)))
|
||||||
(setq font-size-pt (+ font-size-pt arg)))
|
(set-face-attribute 'default nil :height
|
||||||
;; The internal font size value is 10x the font size in points unit.
|
(+ current-height arg))))
|
||||||
;; So a 10pt font size is equal to 100 in internal font size value.
|
|
||||||
(set-face-attribute 'default nil :height (* font-size-pt 10)))
|
|
||||||
|
|
||||||
(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
|
#+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.
|
||||||
|
Loading…
Reference in New Issue
Block a user