diff --git a/README.org b/README.org index c180f68..712afeb 100644 --- a/README.org +++ b/README.org @@ -524,17 +524,25 @@ Emacs]] for how to setup fonts properly. It boils down to two rules: 2. The heights of all other faces must be real numbers to scale those heights with respect to the height of the face (those heights default to 1.0 for no scaling). -The code in listing [[lst:configure-face-attributes]] source implements those rules. +The code in listing [[lst:configure-face-attributes]] implements those rules. Listing [[lst:set-default-face-height]] shows that font scaling is easy in case of -proper initialization of all face heigths. Listing -[[lst:fix-gtk-color-for-invert-default-face]], [[lst:shadow-org-font-lock-faces]], and -[[lst:shadow-org-font-lock-faces]] show a few tweaks to improve visibility without -theming: +proper initialization of all face heigths. To adjust the font size in the +current or future frames, invoke src_emacs-lisp{(set-default-face-height)}. To +adjust the font size in the current buffer, type: +1. {{{kbd(s-=)}}} which is bound to src_emacs-lisp{(text-scale-adjust +1)}. +2. {{{kbd(s--)}}} which is bound to src_emacs-lisp{(text-scale-adjust -1)}. +3. {{{kbd(s-0)}}} which is bound to src_emacs-lisp{(text-scale-adjust 0)}. +Listing [[lst:fix-gtk-color-for-invert-default-face]], +[[lst:shadow-org-font-lock-faces]], and [[lst:shadow-emacs-font-lock-faces]] show a few +tweaks to improve visibility without theming: 1. Fixing the =gtk= background color of the already loaded =region= face. 2. Toggling between a dark and light background by means of src_emacs-lisp{(invert-default-face)}. 3. Shadowing the definition of faces before loading. The last item in the page on [[https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html#org5c4406f][fontifying Org mode source code blocks]] describes this method. +Listing [[lst:use-buffer-face-mode-for-fixed-or-variable-pitch-face]] contains +functions to set a fixed or variable pitch face in the current buffer and +selects a fixed pitch face for =magit-mode= and =progmode= buffers. #+caption[Configure =face-attributes=]: #+caption: Configure =face-attributes=. @@ -577,28 +585,6 @@ Scale all other faces with a height that is a real number." (set-face-attribute 'default nil :height height)))) #+end_src -#+caption[Use =buffer-face-mode= to set fixed or variable pitch face]: -#+caption: Use =buffer-face-mode= to set fixed or variable pitch face. -#+name: lst:use-buffer-face-mode-for-fixed-or-variable-pitch-face -#+begin_src emacs-lisp -n -;; Use proportional font faces in current buffer -(defun set-buffer-variable-pitch-face () - "Set a variable width (proportional) font in current buffer." - (interactive) - (setq buffer-face-mode-face 'variable-pitch) - (buffer-face-mode)) - -;; Use monospaced font faces in current buffer -(defun set-buffer-fixed-pitch-face () - "Set a fixed width (monospace) font in current buffer." - (interactive) - (setq buffer-face-mode-face 'fixed-pitch) - (buffer-face-mode)) - -(add-hook 'magit-mode-hook #'set-buffer-fixed-pitch-face) -(add-hook 'prog-mode-hook #'set-buffer-fixed-pitch-face) -#+end_src - #+caption[Fix a `gtk' color and implement =invert-default-face=]: #+caption: Fix a `gtk' color and implement =invert-default-face=. #+name: lst:fix-gtk-color-for-invert-default-face @@ -683,6 +669,28 @@ verse and quote blocks are fontified using the `org-verse' and (require 'org) #+end_src +#+caption[Use =buffer-face-mode= to set fixed or variable pitch face]: +#+caption: Use =buffer-face-mode= to set fixed or variable pitch face. +#+name: lst:use-buffer-face-mode-for-fixed-or-variable-pitch-face +#+begin_src emacs-lisp -n +;; Use proportional font faces in current buffer +(defun set-buffer-variable-pitch-face () + "Set a variable width (proportional) font in current buffer." + (interactive) + (setq buffer-face-mode-face 'variable-pitch) + (buffer-face-mode)) + +;; Use monospaced font faces in current buffer +(defun set-buffer-fixed-pitch-face () + "Set a fixed width (monospace) font in current buffer." + (interactive) + (setq buffer-face-mode-face 'fixed-pitch) + (buffer-face-mode)) + +(add-hook 'magit-mode-hook #'set-buffer-fixed-pitch-face) +(add-hook 'prog-mode-hook #'set-buffer-fixed-pitch-face) +#+end_src + * [[info:emacs#Windows][Window management (info)]] :PROPERTIES: :CUSTOM_ID: sec:window-management