mirror of
https://github.com/larstvei/dot-emacs.git
synced 2024-11-26 07:28:31 +00:00
Replaced global-text-scale-mode.
It's replaced with functions to increase/decrease the font.
This commit is contained in:
parent
d28a3a9e61
commit
edf83961b9
41
init.el
41
init.el
@ -707,27 +707,29 @@ given, the duplicated region will be commented out."
|
|||||||
|
|
||||||
;; Presentation-mode
|
;; Presentation-mode
|
||||||
|
|
||||||
;; When giving talks it's nice to be able to scale the text
|
;; When giving talks it's nice to be able to adjust the size of everything
|
||||||
;; globally. =text-scale-mode= works great for a single buffer, this advice
|
;; (not just a buffer like ~text-scale-mode~ provides). This is not a
|
||||||
;; makes this work globally.
|
;; particularly neat solution, but it works OK. It simply
|
||||||
|
;; increases/decreases the size of the font. It assumes that your using
|
||||||
|
;; Inconsolata with size 14 by default. This should be probably be
|
||||||
|
;; generalized (or maybe be substituted by a package if it's out there).
|
||||||
|
|
||||||
(defadvice text-scale-mode (around all-buffers (arg) activate)
|
(defun global-scale-default ()
|
||||||
(if (not global-text-scale-mode)
|
(interactive)
|
||||||
ad-do-it
|
(set-face-attribute 'default nil :font "Inconsolata-14"))
|
||||||
(setq-default text-scale-mode-amount text-scale-mode-amount)
|
|
||||||
(dolist (buffer (buffer-list))
|
|
||||||
(with-current-buffer buffer
|
|
||||||
ad-do-it))))
|
|
||||||
|
|
||||||
;; We don't want this to be default behavior, so we can make a global mode
|
(lexical-let ((size 14))
|
||||||
;; from the =text-scale-mode=, using =define-globalized-minor-mode=.
|
(defun global-scale-up ()
|
||||||
|
(interactive)
|
||||||
|
(set-face-attribute
|
||||||
|
'default nil
|
||||||
|
:font (concat "Inconsolata-" (number-to-string (incf size)))))
|
||||||
|
|
||||||
(require 'face-remap)
|
(defun global-scale-down ()
|
||||||
|
(interactive)
|
||||||
(define-globalized-minor-mode
|
(set-face-attribute
|
||||||
global-text-scale-mode
|
'default nil
|
||||||
text-scale-mode
|
:font (concat "Inconsolata-" (number-to-string (decf size))))))
|
||||||
(lambda () (text-scale-mode 1)))
|
|
||||||
|
|
||||||
;; Shell
|
;; Shell
|
||||||
|
|
||||||
@ -1042,6 +1044,9 @@ math-block around the region."
|
|||||||
(define-key custom-bindings-map (kbd "M-.") 'jump-to-next-like-this)
|
(define-key custom-bindings-map (kbd "M-.") 'jump-to-next-like-this)
|
||||||
(define-key custom-bindings-map (kbd "C-c .") (cycle-themes))
|
(define-key custom-bindings-map (kbd "C-c .") (cycle-themes))
|
||||||
(define-key custom-bindings-map (kbd "C-x k") 'kill-this-buffer-unless-scratch)
|
(define-key custom-bindings-map (kbd "C-x k") 'kill-this-buffer-unless-scratch)
|
||||||
|
(define-key custom-bindings-map (kbd "C-c C-0") 'global-scale-default)
|
||||||
|
(define-key custom-bindings-map (kbd "C-c C-=") 'global-scale-up)
|
||||||
|
(define-key custom-bindings-map (kbd "C-c C--") 'global-scale-down)
|
||||||
(define-key custom-bindings-map (kbd "C-x t") 'toggle-shell)
|
(define-key custom-bindings-map (kbd "C-x t") 'toggle-shell)
|
||||||
(define-key custom-bindings-map (kbd "C-c j") 'cycle-spacing-delete-newlines)
|
(define-key custom-bindings-map (kbd "C-c j") 'cycle-spacing-delete-newlines)
|
||||||
(define-key custom-bindings-map (kbd "C-c d") 'duplicate-thing)
|
(define-key custom-bindings-map (kbd "C-c d") 'duplicate-thing)
|
||||||
|
43
init.org
43
init.org
@ -893,30 +893,30 @@
|
|||||||
|
|
||||||
** Presentation-mode
|
** Presentation-mode
|
||||||
|
|
||||||
When giving talks it's nice to be able to scale the text
|
When giving talks it's nice to be able to adjust the size of everything
|
||||||
globally. =text-scale-mode= works great for a single buffer, this advice
|
(not just a buffer like ~text-scale-mode~ provides). This is not a
|
||||||
makes this work globally.
|
particularly neat solution, but it works OK. It simply
|
||||||
|
increases/decreases the size of the font. It assumes that your using
|
||||||
|
Inconsolata with size 14 by default. This should be probably be
|
||||||
|
generalized (or maybe be substituted by a package if it's out there).
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defadvice text-scale-mode (around all-buffers (arg) activate)
|
(defun global-scale-default ()
|
||||||
(if (not global-text-scale-mode)
|
(interactive)
|
||||||
ad-do-it
|
(set-face-attribute 'default nil :font "Inconsolata-14"))
|
||||||
(setq-default text-scale-mode-amount text-scale-mode-amount)
|
|
||||||
(dolist (buffer (buffer-list))
|
|
||||||
(with-current-buffer buffer
|
|
||||||
ad-do-it))))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
We don't want this to be default behavior, so we can make a global mode
|
(lexical-let ((size 14))
|
||||||
from the =text-scale-mode=, using =define-globalized-minor-mode=.
|
(defun global-scale-up ()
|
||||||
|
(interactive)
|
||||||
|
(set-face-attribute
|
||||||
|
'default nil
|
||||||
|
:font (concat "Inconsolata-" (number-to-string (incf size)))))
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
(defun global-scale-down ()
|
||||||
(require 'face-remap)
|
(interactive)
|
||||||
|
(set-face-attribute
|
||||||
(define-globalized-minor-mode
|
'default nil
|
||||||
global-text-scale-mode
|
:font (concat "Inconsolata-" (number-to-string (decf size))))))
|
||||||
text-scale-mode
|
|
||||||
(lambda () (text-scale-mode 1)))
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Mode specific
|
* Mode specific
|
||||||
@ -1318,6 +1318,9 @@
|
|||||||
(define-key custom-bindings-map (kbd "M-.") 'jump-to-next-like-this)
|
(define-key custom-bindings-map (kbd "M-.") 'jump-to-next-like-this)
|
||||||
(define-key custom-bindings-map (kbd "C-c .") (cycle-themes))
|
(define-key custom-bindings-map (kbd "C-c .") (cycle-themes))
|
||||||
(define-key custom-bindings-map (kbd "C-x k") 'kill-this-buffer-unless-scratch)
|
(define-key custom-bindings-map (kbd "C-x k") 'kill-this-buffer-unless-scratch)
|
||||||
|
(define-key custom-bindings-map (kbd "C-c C-0") 'global-scale-default)
|
||||||
|
(define-key custom-bindings-map (kbd "C-c C-=") 'global-scale-up)
|
||||||
|
(define-key custom-bindings-map (kbd "C-c C--") 'global-scale-down)
|
||||||
(define-key custom-bindings-map (kbd "C-x t") 'toggle-shell)
|
(define-key custom-bindings-map (kbd "C-x t") 'toggle-shell)
|
||||||
(define-key custom-bindings-map (kbd "C-c j") 'cycle-spacing-delete-newlines)
|
(define-key custom-bindings-map (kbd "C-c j") 'cycle-spacing-delete-newlines)
|
||||||
(define-key custom-bindings-map (kbd "C-c d") 'duplicate-thing)
|
(define-key custom-bindings-map (kbd "C-c d") 'duplicate-thing)
|
||||||
|
Loading…
Reference in New Issue
Block a user