Add: Faces

This commit is contained in:
Adam Porter 2022-03-20 18:50:12 -05:00
parent 58ae883856
commit d11edbc132

View file

@ -53,6 +53,37 @@ example, setting to -1 prevents indentation of the first and
second levels." second levels."
:type 'integer) :type 'integer)
;;;;; Faces
(defgroup org-ql-view-faces nil
"Faces for Org QL View buffers."
:group 'org-ql-view-taxy)
(defface org-ql-view-header-line
'((t (:inherit header-line :weight bold)))
"Header line.")
(defface org-ql-view-query-heading
'((t (:inherit header-line :height 1.3)))
"Query headings.")
(defface org-ql-view-heading
`((t (:inherit magit-section-heading :weight bold)))
"Group headings.
Inherited by level-specific faces.")
(defface org-ql-view-heading-1
`((t (:inherit org-ql-view-heading
:height 1.2 :overline t
:background ,(face-background 'header-line))))
"Level-1 group headings.")
(defface org-ql-view-heading-2
`((t (:inherit org-ql-view-heading
:height 1.1 :overline t
:background ,(face-background 'header-line))))
"Level-2 group headings.")
;;;;; Columns ;;;;; Columns
(taxy-magit-section-define-column-definer "org-ql-view") (taxy-magit-section-define-column-definer "org-ql-view")
@ -337,14 +368,15 @@ Searches in ELEMENT's buffer."
(propertize string (propertize string
'org-hd-marker marker 'org-hd-marker marker
'org-marker marker))) 'org-marker marker)))
(heading-face (depth) (heading-face
;; TODO: Make customizeable. (depth) (pcase depth
(let ((height (pcase depth (-1 'org-ql-view-query-heading)
((pred (> 0)) 1.3) ;; NOTE: Faces count from 1 (like
(0 1.2) ;; `outline-` faces), but depth from 0 (or
(1 1.1) ;; -1 for query headings).
(_ 1.0)))) (0 'org-ql-view-heading-1)
(list :inherit 'magit-section-heading :height height))) (1 'org-ql-view-heading-2)
(_ 'org-ql-view-heading)))
(make-fn (&rest args) (make-fn (&rest args)
(apply #'make-taxy-magit-section (apply #'make-taxy-magit-section
:make #'make-fn :make #'make-fn
@ -374,6 +406,8 @@ Searches in ELEMENT's buffer."
column-sizes (cdr format-cons) column-sizes (cdr format-cons)
header-line-format (taxy-magit-section-format-header header-line-format (taxy-magit-section-format-header
column-sizes org-ql-view-column-formatters)) column-sizes org-ql-view-column-formatters))
(add-face-text-property 0 (length header-line-format) 'org-ql-view-header-line
nil header-line-format)
(let ((inhibit-read-only t)) (let ((inhibit-read-only t))
(save-excursion (save-excursion
(goto-char (point-max)) (goto-char (point-max))