Move `defface' forms to toplevel

This commit is contained in:
Gerard Vermeulen 2024-06-09 11:54:44 +02:00
parent cbbc3cf3aa
commit 686ac23749

View File

@ -506,20 +506,19 @@ Scale all other faces with a height that is a real number."
#+caption: Shadow Org font-lock faces to improve the readability. #+caption: Shadow Org font-lock faces to improve the readability.
#+name: lst:shadow-org-font-lock-faces #+name: lst:shadow-org-font-lock-faces
#+begin_src emacs-lisp -n #+begin_src emacs-lisp -n
(with-eval-after-load 'emacs ;; Shadow two definitions in org-faces.el:
;; Shadow two definitions in org-faces.el: (defface org-block
(defface org-block ;; https://emacs.stackexchange.com/a/9604 answers:
;; https://emacs.stackexchange.com/a/9604 answers: ;; How to override a defined face for light and dark backgrounds?
;; How to override a defined face for light and dark backgrounds? `((((background dark))
`((((background dark)) :inherit (fixed-pitch)
:inherit (fixed-pitch) ,@(and (>= emacs-major-version 27) '(:extend t))
,@(and (>= emacs-major-version 27) '(:extend t)) :background "#444444")
:background "#444444") (t
(t :inherit (fixed-pitch)
:inherit (fixed-pitch) ,@(and (>= emacs-major-version 27) '(:extend t))
,@(and (>= emacs-major-version 27) '(:extend t)) :background "#FFFFD0"))
:background "#FFFFD0")) "My face used for text inside blocks.
"My face used for text inside blocks.
It is always used for source blocks. You can refine what face It is always used for source blocks. You can refine what face
should be used depending on the source block language by setting, should be used depending on the source block language by setting,
@ -528,38 +527,37 @@ should be used depending on the source block language by setting,
When `org-fontify-quote-and-verse-blocks' is not nil, text inside When `org-fontify-quote-and-verse-blocks' is not nil, text inside
verse and quote blocks are fontified using the `org-verse' and verse and quote blocks are fontified using the `org-verse' and
`org-quote' faces, which inherit from `org-block'." `org-quote' faces, which inherit from `org-block'."
:group 'org-faces) :group 'org-faces)
(defface org-table (defface org-table
;; https://emacs.stackexchange.com/a/9604 answers: ;; https://emacs.stackexchange.com/a/9604 answers:
;; How to override a defined face for light and dark backgrounds? ;; How to override a defined face for light and dark backgrounds?
`((((background dark)) `((((background dark))
:inherit (fixed-pitch) :inherit (fixed-pitch)
,@(and (>= emacs-major-version 27) '(:extend t)) ,@(and (>= emacs-major-version 27) '(:extend t))
:background "#444444") :background "#444444")
(t (t
:inherit (fixed-pitch) :inherit (fixed-pitch)
,@(and (>= emacs-major-version 27) '(:extend t)) ,@(and (>= emacs-major-version 27) '(:extend t))
:background "#FFFFD0")) :background "#FFFFD0"))
"My face for tables." "My face for tables."
:group 'org-faces)) :group 'org-faces)
#+end_src #+end_src
#+caption[Shadow Emacs font-lock faces to improve the readability]: #+caption[Shadow Emacs font-lock faces to improve the readability]:
#+caption: Shadow Emacs font-lock faces to improve the readability. #+caption: Shadow Emacs font-lock faces to improve the readability.
#+name: lst:shadow-emacs-font-lock-faces #+name: lst:shadow-emacs-font-lock-faces
#+begin_src emacs-lisp -n #+begin_src emacs-lisp -n
(with-eval-after-load 'emacs ;; Shadow one definition in sh-script.el:
;; Shadow one definition in sh-script.el: (defface sh-heredoc
(defface sh-heredoc '((((class color) (background dark))
'((((class color) (background dark)) (:foreground "yellow"))
(:foreground "yellow")) (((class color) (background light))
(((class color) (background light)) (:foreground "magenta"))
(:foreground "magenta")) (t
(t (:weight bold)))
(:weight bold))) "My face to show a here-document."
"My face to show a here-document." :group 'sh-indentation)
:group 'sh-indentation))
(require 'org) (require 'org)
#+end_src #+end_src