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 #+begin_src emacs-lisp -n :results silent
;; To use different Org git repositories (org or gro): ;; 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-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. ;; Postpone (require 'org) after shadowing Org and sh-script faces below.
;; Enable `package-install-upgrade-built-in' to upgrade Org and transient. ;; 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 with respect to the height of the face (those heights default to 1.0 for no
scaling). scaling).
The code in listing [[lst:configure-face-attributes]] 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 Listing [[lst:face-setting-functions]] shows that font scaling is easy in case of
proper initialization of all face heights. To adjust the font size in the proper initialization of all face heights in a frame. To adjust the font size
current or future frames, invoke src_emacs-lisp{(set-default-face-height)}. To in windows, invoke src_emacs-lisp{(set-default-face-height)}. To adjust the
adjust the font size in the current buffer, type: font size in the current buffer, type:
1. {{{kbd(s-=)}}} to invoke src_emacs-lisp[:results silent]{(text-scale-adjust 1. {{{kbd(s-=)}}} to invoke src_emacs-lisp[:results silent]{(text-scale-adjust
+1)}. +1)}.
2. {{{kbd(s--)}}} to invoke src_emacs-lisp[:results silent]{(text-scale-adjust 2. {{{kbd(s--)}}} to invoke src_emacs-lisp[:results silent]{(text-scale-adjust
-1)}. -1)}.
3. {{{kbd(s-0)}}} to invoke src_emacs-lisp[:results silent]{(text-scale-adjust 3. {{{kbd(s-0)}}} to invoke src_emacs-lisp[:results silent]{(text-scale-adjust
0)}. 0)}.
Listing [[lst:fix-gtk-color-for-invert-default-face]], Listing [[lst:face-setting-functions]], [[lst:shadow-org-font-lock-faces]], and
[[lst:shadow-org-font-lock-faces]], and [[lst:shadow-emacs-font-lock-faces]] show a [[lst:shadow-emacs-font-lock-faces]] show tweaks to improve visibility without
tweaks to improve visibility without theming: theming:
1. Fixing the =gtk= background color of the already loaded =region= face. 1. Fixing the =gtk= background color of the already loaded =region= face.
2. Toggling between a dark and light background by means of 2. Toggling between a dark and light background by means of
src_emacs-lisp{(invert-default-face)}. 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")))) (set-face-attribute 'variable-pitch nil :family "DejaVu Sans"))))
#+end_src #+end_src
#+caption[Implement =set-default-face-height=]: #+caption[Implement =face= setting functions]:
#+caption: Implement =set-default-face-height=. #+caption: Implement =face= setting functions.
#+name: lst:set-default-face-height #+name: lst:face-setting-functions
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs (with-eval-after-load 'emacs
;; Neither `set-default-face-height' nor `text-scale-adjust' work well.
(defun set-default-face-height () (defun set-default-face-height ()
"Set the default face height in all current and future frames. "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 (height (string-to-number
(completing-read prompt choices nil 'require-match)))) (completing-read prompt choices nil 'require-match))))
(message "Setting the height of the default face to %s" height) (message "Setting the height of the default face to %s" height)
(set-face-attribute 'default nil :height 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")))))))
(defun invert-default-face () (defun invert-default-face ()
"Invert the default face." "Invert the default face."
(interactive) (interactive)
(invert-face 'default) (invert-face 'default)))
(fix-gtk-region-face-background-color))
(fix-gtk-region-face-background-color))
#+end_src #+end_src
#+caption[Shadow Org font-lock faces to improve the readability]: #+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 () (defun set-buffer-variable-pitch-face ()
"Set a variable width (proportional) font in current buffer." "Set a variable width (proportional) font in current buffer."
(interactive) (interactive)
(setq buffer-face-mode-face 'variable-pitch) (let ((buffer-face-mode-face 'variable-pitch))
(buffer-face-mode)) (buffer-face-mode)))
;; Use monospaced font faces in current buffer ;; Use monospaced font faces in current buffer
(defun set-buffer-fixed-pitch-face () (defun set-buffer-fixed-pitch-face ()
"Set a fixed width (monospace) font in current buffer." "Set a fixed width (monospace) font in current buffer."
(interactive) (interactive)
(setq buffer-face-mode-face 'fixed-pitch) (let ((buffer-face-mode-face 'fixed-pitch))
(buffer-face-mode)) (buffer-face-mode)))
(add-hook 'magit-mode-hook #'set-buffer-fixed-pitch-face) (add-hook 'magit-mode-hook #'set-buffer-fixed-pitch-face)
(add-hook 'prog-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-doi
ol-eww ol-eww
ol-info ol-info
org-collector
org-id org-id
org-protocol org-protocol
org-tempo) org-tempo)