Compare commits

..

2 Commits

View File

@ -314,6 +314,8 @@ of [[info:emacs#Saving Customizations][saving customizations (info)]].
#+begin_src emacs-lisp -n :results silent
;; To use different Org git repositories (org or gro):
(push (expand-file-name "~/VCS/org-mode/lisp") load-path)
(push (expand-file-name "~/VCS/org-contrib/lisp") load-path)
;; (byte-recompile-directory "~/VCS/org-contrib/lisp" 0)
;; Postpone (require 'org) after shadowing Org and sh-script faces below.
;; Enable `package-install-upgrade-built-in' to upgrade Org and transient.
@ -481,19 +483,19 @@ Emacs]] for how to setup fonts properly. It boils down to two rules:
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]] implements those rules.
Listing [[lst:set-default-face-height]] shows that font scaling is easy in case of
proper initialization of all face heights. 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:
Listing [[lst:face-setting-functions]] shows that font scaling is easy in case of
proper initialization of all face heights in a frame. To adjust the font size
in windows, invoke src_emacs-lisp{(set-default-face-height)}. To adjust the
font size in the current buffer, type:
1. {{{kbd(s-=)}}} to invoke src_emacs-lisp[:results silent]{(text-scale-adjust
+1)}.
2. {{{kbd(s--)}}} to invoke src_emacs-lisp[:results silent]{(text-scale-adjust
-1)}.
3. {{{kbd(s-0)}}} to invoke src_emacs-lisp[:results silent]{(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
tweaks to improve visibility without theming:
Listing [[lst:face-setting-functions]], [[lst:shadow-org-font-lock-faces]], and
[[lst:shadow-emacs-font-lock-faces]] show 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)}.
@ -524,11 +526,12 @@ selects a fixed pitch face for =magit-mode= and =progmode= buffers.
(set-face-attribute 'variable-pitch nil :family "DejaVu Sans"))))
#+end_src
#+caption[Implement =set-default-face-height=]:
#+caption: Implement =set-default-face-height=.
#+name: lst:set-default-face-height
#+caption[Implement =face= setting functions]:
#+caption: Implement =face= setting functions.
#+name: lst:face-setting-functions
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; Neither `set-default-face-height' nor `text-scale-adjust' work well.
(defun set-default-face-height ()
"Set the default face height in all current and future frames.
@ -541,29 +544,12 @@ Scale all other faces with a height that is a real number."
(height (string-to-number
(completing-read prompt choices nil 'require-match))))
(message "Setting the height of the default face to %s" height)
(set-face-attribute 'default nil :height height))))
#+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
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defun fix-gtk-region-face-background-color ()
(when (featurep 'gtk)
(set-face-attribute
'region nil
:background (cdr (assoc (face-attribute 'default :background)
'(("white" . "LightGoldenrod2")
("black" . "blue3")))))))
(set-face-attribute 'default nil :height height)))
(defun invert-default-face ()
"Invert the default face."
(interactive)
(invert-face 'default)
(fix-gtk-region-face-background-color))
(fix-gtk-region-face-background-color))
(invert-face 'default)))
#+end_src
#+caption[Shadow Org font-lock faces to improve the readability]:
@ -636,15 +622,15 @@ verse and quote blocks are fontified using the `org-verse' and
(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))
(let ((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))
(let ((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)
@ -2311,6 +2297,7 @@ list detailing and motivating each listing:
ol-doi
ol-eww
ol-info
org-collector
org-id
org-protocol
org-tempo)