[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adaptive Org faces in headings?
From: |
Ihor Radchenko |
Subject: |
Re: Adaptive Org faces in headings? |
Date: |
Sun, 26 Apr 2020 15:42:02 +0800 |
> Does the community know of a solution to this issue?
Not precisely answer to your question, but I use the code below to get
more complete fontification in agenda. The code does not consider
heading level, but can be easily modified to do so [ (insert "* ") ->
(insert (s-concat (make-string level ?*) " ")) ]
(define-advice org-agenda-format-item (:filter-args (&rest args) fontify-org)
"Force fontify ageda item. (hack)"
(cl-multiple-value-bind (extra txt level category tags dotime remove-re
habitp) (car args)
(with-temp-buffer
(cl-letf (((symbol-function 'yant/process-att-abbrev) #'identity)
((symbol-function 'yant/process-att-id-abbrev) #'identity)) ;;
expanding sometimes causes errors when attempting to access ancestors
(org-mode)
(insert "* "
txt
"\t"
(or (and tags (s-join ":" `(nil ,@(cl-remove-duplicates tags)
nil)))
"")
"\n")
(font-lock-fontify-buffer)
(goto-char (point-min))
(looking-at "^\\* \\(\\([^\t]+\\)[
]+\\(:\\([[:alnum:]_@#%:]+\\):\\)*\\)[ ]*$")
(setq txt (match-string 2))
(setq tags (and tags (s-split ":" (match-string 3) 't))))
(list extra txt level category tags dotime remove-re habitp)))
)
Protesilaos Stavrou <address@hidden> writes:
> Dear all,
>
> I have noticed that Org faces that combine with headings do not adapt to
> their context. This applies to keywords, priority cookies, links, and
> possibly other elements as well.
>
> For example, a "todo" keyword (`org-todo' face) will not scale in size
> to match that of the heading level (`org-level-N' face) if the latter
> uses a `:height' property. Same principle for keywords not inheriting
> the heading's background, overline, etc.
>
> My expectation is to allow `org-level-N' to pass its attributes to any
> element on the same line, unless that element has conflicting face
> attributes of its own. So, in my example, the heading could pass its
> height to the "todo" keyword when the `org-todo' face does not define a
> `:height' of its own. Otherwise it would refrain from overriding that
> attribute.
>
> Does the community know of a solution to this issue?
>
> I am running:
>
> * Org mode version 9.3.
>
> * GNU Emacs 27.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.17,
> cairo version 1.17.3) of 2020-04-20.
>
> Best regards,
> Protesilaos
>
>
> --
> Protesilaos Stavrou
> protesilaos.com
>
--
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong
University, Xi'an, China
Email: address@hidden, address@hidden