mklsls · 2022-02-02 13:10
Hi all!
I am trying to do this on my \`org-agenda\`
[MY PROJECT]
↳ NEXT My next task :my-tag:
wherever it finds a sub-tree like this,
* MY PROJECT :my-tag:
** NEXT My next task
However, I want that the text `[MY PROJECT]` has a distinct face (`nano-strong`, for example).
I tried using a `propertize`, but it does not change the face that I want.
This is my best try,
(defun my/org-agenda-format-breadcrumbs ()
""
(let ((breadcrumb (org-format-outline-path (cdr (org-get-outline-path)))))
(if (string-empty-p breadcrumb)
(concat " ")
(concat "[" (propertize breadcrumb 'face 'nano-strong) "]\n ↳"))))
(setq org-agenda-prefix-format '((agenda . " %i %s")
(todo . "%i %-12:c")
(tags . "%(my/org-agenda-format-breadcrumbs)")
(search . "%i %-12:c")))
What am I doing wrong?
Thanks!
rguy84 · 2022-02-02 15:04
Have you tried taking out the `(propertize` part, running this agenda, then doing `describe-face`? The square brackets may also get the face though.
mklsls · 2022-02-02 17:20
I modified the `defun` and removed the `propertize` part just to test it out.
Using `describe-text-properties` over `[MY PROJECT]` I got this:
```
Text content at position 5691:
There is an overlay here:
From 5647 to 5696
face hl-line
priority -50
window nil
There are text properties here:
breadcrumbs nil
done-face org-agenda-done
dotime nil
duration nil
effort nil
effort-minutes nil
extra ""
face default
format [Show]
help-echo "mouse-2 or RET jump to Org file \"~/Dropbox/home/documents/org/gtd/actionable.org\""
level " "
mouse-face highlight
org-agenda-type tags
org-category "actionable"
org-complex-heading-regexp "^\\(\\*+\\)\\(?: +\\(CNCL\\|DONE\\|NEXT\\|TODO\\|WAIT\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(.*?\\)\\)??\\(?:[ ]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ ]*$"
org-hd-marker [Show]
org-last-args [Show]
org-marker [Show]
org-not-done-regexp "\\(NEXT\\|TODO\\|WAIT\\)"
org-priority-highest 65
org-priority-lowest 67
org-redo-cmd [Show]
org-series t
org-series-cmd [Show]
org-series-redo-cmd [Show]
org-todo-regexp "\\(CNCL\\|DONE\\|NEXT\\|TODO\\|WAIT\\)"
priority 2000
tags [Show]
time ""
time-of-day nil
todo-state [Show]
ts-date nil
txt [Show]
type "tagsmatch"
undone-face default
ws-butler-chg chg
```
rguy84 · 2022-02-02 17:22
I suggested `face` so you cocould narrow down what creates you [My Proj].
mklsls · 2022-02-02 18:09
If I click in the `face` property, I have this
[https://imgur.com/a/a6AVn3D](https://imgur.com/a/a6AVn3D)
mklsls · 2022-02-02 18:14
The problem is the `propertize` isn't respected.
Nicolas-Rougier · 2022-02-02 18:28
For doing something related, I use a hack with an advice around` org-agenda-highlight-todo`:
(defun my-org-agenda-highlight-todo (x)
(let* ((done (string-match-p (regexp-quote ":DONE:") x))
(x (replace-regexp-in-string ":TODO:" "[X] x))
(x (replace-regexp-in-string ":DONE:" "[ ]" x))
(x (if done (propertize x 'face 'nano-faded) x)))
x))
(advice-add 'org-agenda-highlight-todo
:filter-return #'my-org-agenda-highlight-todo)
rguy84 · 2022-02-02 20:00
Right. I am saying maybe drop that approach. I have `'(org-agenda-date ((t (:background "WhiteSmoke" :foreground "#00538b"))))` within `custom-set-faces` as an example.
mklsls · 2022-02-02 21:20
Oh right! Yes the problem is that I don't want to chage all the face, but only a portion of it.
In this case
```
[MY PROJECT]
... NEXT My task
```
has the same face, but I just want to change the color of the first line.