;;; global-text-scale.el -- Scale all buffers at once -*- lexical-binding:t -*- ;;; Commentary: ;; Taken from https://www.emacswiki.org/emacs/GlobalTextScaleMode. ;;; Code: (require 'face-remap) (defgroup global-text-scale () "Scale all buffers at once." :group 'display) (defvar global-text-scale-mode-map (let ((map (make-sparse-keymap))) (define-key map [remap text-scale-adjust] #'global-text-scale-adjust) map)) ;;;###autoload (define-globalized-minor-mode global-text-scale-mode text-scale-mode (lambda () (text-scale-mode 1))) (defun global-text-scale-adjust (scale) "Set the text scale to SCALE in all buffers." (interactive (let ((echo-keystrokes nil)) (list (+ (pcase (event-basic-type last-command-event) ((or ?+ ?=) (1+ text-scale-mode-amount)) ((or ?- ?_) (1- text-scale-mode-amount)) (_ 0)))))) (text-scale-set 1) (kill-local-variable 'text-scale-mode-amount) (setq-default text-scale-mode-amount scale) (global-text-scale-mode 1) (set-transient-map (let ((map (make-sparse-keymap))) (dolist (mods '(() (control))) (dolist (key '(?- ?_ ?+ ?= ?0)) (define-key map `[(,@mods ,key)] #'global-text-scale-adjust))) map)) (message "Use +,-,0 for further adjustment")) (provide 'global-text-scale) ;;; global-text-scale.el ends here