RE: [PATCH] Adaptive Org faces in headings?

2020-10-28 Thread Rob Davenport
That's OK - some more searching and I believe I found the info I was asking 
for:  https://orgmode.org/worg/org-maintenance.html
Thanks anyway.

Rob

—
Rob Davenport
Consulting R Engineer
ABB Cleveland
“Don’t look the other way. Make good architecture happen.”



-Original Message-
From: Emacs-orgmode  On 
Behalf Of Rob Davenport
Sent: Tuesday, October 27, 2020 2:31
To: Ihor Radchenko 
Cc: Org-mode 
Subject: RE: [PATCH] Adaptive Org faces in headings?

Thank you very much for this patch, Ihor.   It fixes the issue on my system.   
I've only recently been getting org from the code.orgmode.org repo so Bastien 
kindly answered my first question as to why I wasn't seeing that patch yet. 
(The package I'm updating is coming from maint and not master.)   I see the fix 
in master but it is yet to be merged into maint so I don't expect to see it 
(just have to keep re-applying it).

I assume at some point commits in master will be merged into maint, correct?   
Is there a basic plan on when such merges might happen?  
Or am I doing something wrong?  I can wait - just curious about the process.  
(If it's documented somewhere I've missed, if someone can point me to it, I'll 
be quiet and go RTFM.  )

Regards,

Rob

—
Rob Davenport
Consulting R Engineer
ABB Cleveland
“Don’t look the other way. Make good architecture happen.”



-Original Message-
From: Emacs-orgmode  On 
Behalf Of Protesilaos Stavrou
Sent: Friday, September 18, 2020 5:53
To: Ihor Radchenko 
Cc: Bastien ; Protesilaos Stavrou ; 
Org-mode ; Diego Zamboni 
Subject: Re: [PATCH] Adaptive Org faces in headings?

This email originated from outside of your organization. Please do not click on 
links or open attachments unless you recognize the sender and know the content 
is safe.


Ihor Radchenko  [2020-09-17, 16:25 +0800]:

> The attached patch seems to fix the issue.
> Can anyone test?

I just tried this using the standard faces of 'emacs -Q' as well as custom 
themes.

In short, the patch fixes the issue on my side.  I tested whether faces on the 
headline would correctly inherit any of the following properties:

+ :height
+ :weight
+ :background
+ :overline

I also tested it with 'variable-pitch' headlines and, again, every construct 
that does not have a font family explicitly assigned to it will adapt to the 
underlying heading.  Excellent!

This is the kind of headline I tried:

 * TODO [#A] This is a test ~scaling-elements~ =faces-adapt= :good-stuff:

Also added links to confirm my findings.  Again, all good.

--
Protesilaos Stavrou
protesilaos.com



RE: [PATCH] Adaptive Org faces in headings?

2020-10-27 Thread Rob Davenport
Thank you very much for this patch, Ihor.   It fixes the issue on my system.   
I've only recently been getting org from the code.orgmode.org repo so Bastien 
kindly answered my first question as to why I wasn't seeing that patch yet. 
(The package I'm updating is coming from maint and not master.)   I see the fix 
in master but it is yet to be merged into maint so I don't expect to see it 
(just have to keep re-applying it).

I assume at some point commits in master will be merged into maint, correct?   
Is there a basic plan on when such merges might happen?  
Or am I doing something wrong?  I can wait - just curious about the process.  
(If it's documented somewhere I've missed, if someone can point me to it, I'll 
be quiet and go RTFM.  )

Regards,

Rob

—
Rob Davenport
Consulting R Engineer
ABB Cleveland
“Don’t look the other way. Make good architecture happen.”



-Original Message-
From: Emacs-orgmode  On 
Behalf Of Protesilaos Stavrou
Sent: Friday, September 18, 2020 5:53
To: Ihor Radchenko 
Cc: Bastien ; Protesilaos Stavrou ; 
Org-mode ; Diego Zamboni 
Subject: Re: [PATCH] Adaptive Org faces in headings?

This email originated from outside of your organization. Please do not click on 
links or open attachments unless you recognize the sender and know the content 
is safe.


Ihor Radchenko  [2020-09-17, 16:25 +0800]:

> The attached patch seems to fix the issue.
> Can anyone test?

I just tried this using the standard faces of 'emacs -Q' as well as custom 
themes.

In short, the patch fixes the issue on my side.  I tested whether faces on the 
headline would correctly inherit any of the following properties:

+ :height
+ :weight
+ :background
+ :overline

I also tested it with 'variable-pitch' headlines and, again, every construct 
that does not have a font family explicitly assigned to it will adapt to the 
underlying heading.  Excellent!

This is the kind of headline I tried:

 * TODO [#A] This is a test ~scaling-elements~ =faces-adapt= :good-stuff:

Also added links to confirm my findings.  Again, all good.

--
Protesilaos Stavrou
protesilaos.com



Re: [PATCH] Adaptive Org faces in headings?

2020-10-07 Thread Kyle Meyer
Protesilaos Stavrou writes:

> Tried to format the patch.  Please see the attached file.  If it does
> not work, feel free to dismiss it and just apply the change yourself.

Looks good.  Applied (23f9415c6).

Thanks.



Re: [PATCH] Adaptive Org faces in headings?

2020-10-06 Thread Protesilaos Stavrou
On 2020-10-07, 00:20 -0400, Kyle Meyer  wrote:

> Protesilaos Stavrou writes:
>
>> Sorry to re-open this issue.  The following change extends Ihor's patch
>> to also cover checkbox statistics.  Seems to work just fine on my end.
>> Thanks again!
>
> Thanks for the patch.  Looks good on my end too.
>
> Would you mind adding a commit message and sending the git-format-patch
> output (details at )?

Tried to format the patch.  Please see the attached file.  If it does
not work, feel free to dismiss it and just apply the change yourself.

-- 
Protesilaos Stavrou
protesilaos.com
>From 6fc8c6f2c5c81402e2d4a5416b68d8d595f7aaee Mon Sep 17 00:00:00 2001
From: Protesilaos Stavrou 
Date: Wed, 7 Oct 2020 08:04:24 +0300
Subject: [PATCH] Make headline faces precede checkbox statistics

* lisp/org.el (org-set-font-lock-defaults): Apply `prepend' to
checkbox statistics.  Affects `org-checkbox-statistics-done' and
`org-checkbox-statistics-todo'.

This builds on commit 979e82fc3: org-level-N faces are no longer
overridden by elements placed on top of them.
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 425e9391b..23c86ba0c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5684,7 +5684,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
 	 1 'org-checkbox prepend)
 	   (when (cdr (assq 'checkbox org-list-automatic-rules))
 	 '("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]"
-	   (0 (org-get-checkbox-statistics-face) t)))
+	   (0 (org-get-checkbox-statistics-face) prepend)))
 	   ;; Description list items
 	   '("^[ \t]*[-+*][ \t]+\\(.*?[ \t]+::\\)\\([ \t]+\\|$\\)"
 	 1 'org-list-dt prepend)
-- 
2.28.0



Re: [PATCH] Adaptive Org faces in headings?

2020-10-06 Thread Kyle Meyer
Protesilaos Stavrou writes:

> Sorry to re-open this issue.  The following change extends Ihor's patch
> to also cover checkbox statistics.  Seems to work just fine on my end.
> Thanks again!

Thanks for the patch.  Looks good on my end too.

Would you mind adding a commit message and sending the git-format-patch
output (details at )?



Re: [PATCH] Adaptive Org faces in headings?

2020-10-05 Thread Protesilaos Stavrou
On 2020-09-26, 08:31 +0200, Bastien  wrote:

> Bastien  writes:
>
>> Ihor Radchenko  writes:
>>
>>> The attached patch seems to fix the issue.
>>
>> Applied as 979e82fc3, thanks a lot!
>
> Also, marking the initial bug report as closed, thanks again.

Sorry to re-open this issue.  The following change extends Ihor's patch
to also cover checkbox statistics.  Seems to work just fine on my end.
Thanks again!


#+begin_src diff
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 425e9391b..23c86ba0c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5684,7 +5684,7 @@ needs to be inserted at a specific position in the 
font-lock sequence.")
 1 'org-checkbox prepend)
   (when (cdr (assq 'checkbox org-list-automatic-rules))
 '("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]"
-  (0 (org-get-checkbox-statistics-face) t)))
+  (0 (org-get-checkbox-statistics-face) prepend)))
   ;; Description list items
   '("^[ \t]*[-+*][ \t]+\\(.*?[ \t]+::\\)\\([ \t]+\\|$\\)"
 1 'org-list-dt prepend)
#+end_src

-- 
Protesilaos Stavrou
protesilaos.com



Re: [PATCH] Adaptive Org faces in headings?

2020-09-26 Thread Bastien
Bastien  writes:

> Ihor Radchenko  writes:
>
>> The attached patch seems to fix the issue.
>
> Applied as 979e82fc3, thanks a lot!

Also, marking the initial bug report as closed, thanks again.

-- 
 Bastien



Re: [PATCH] Adaptive Org faces in headings?

2020-09-23 Thread Protesilaos Stavrou
Bastien  [2020-09-23, 14:25 +0200]:

> Ihor Radchenko  writes:
>
>> The attached patch seems to fix the issue.
>
> Applied as 979e82fc3, thanks a lot!

Good news!  Thanks to everyone for their contributions!

-- 
Protesilaos Stavrou
protesilaos.com



Re: [PATCH] Adaptive Org faces in headings?

2020-09-23 Thread Bastien
Ihor Radchenko  writes:

> The attached patch seems to fix the issue.

Applied as 979e82fc3, thanks a lot!

-- 
 Bastien



Re: [PATCH] Adaptive Org faces in headings?

2020-09-21 Thread Mikhail Skorzhinskii
Hi,

I've also tried to apply this patch and see if it will work on my, heavily 
customized in terms of theming, setup. It didn't spot any new issues. Instead 
it fixed face inheritance bugs with following elements:

1. Tags with customised faces;
2. Links;
3. Ellipsis;
4. TODO keywords;
5. Priority cookies;

Thank you all for you work!

Mikhail Skorzhinskii

On Thursday, September 17, 2020 10:25:17 AM CEST Ihor Radchenko wrote:
> The attached patch seems to fix the issue.
> Can anyone test?
> 
> Best,
> Ihor







Re: [PATCH] Adaptive Org faces in headings?

2020-09-19 Thread Sheng Yang
Thanks for the patch!
I noticed the patch also works for org-link, which had been a headache for me.

On Fri, Sep 18, 2020, at 04:52, Protesilaos Stavrou wrote:
> Ihor Radchenko  [2020-09-17, 16:25 +0800]:
> 
> > The attached patch seems to fix the issue.
> > Can anyone test?

I also tested, with the following org file. Works well with one exception: the 
underline for org-link, which remains the color of itself. The reason is that 
face org-link inherits face link, which has :underline t in its setting. 
Therefore, it should be the expected behavior.
> * test ~code~ =verb= [[link]]
>   #+begin_src emacs-lisp
> (set-face-attribute 'org-level-1 nil :height 3.0 :weight 'normal)
> (set-face-attribute 'org-level-1 nil :weight 'bold)
> (set-face-attribute 'org-level-1 nil :background "white")
> (set-face-attribute 'org-level-1 nil :overline "yellow")
> (set-face-attribute 'org-level-1 nil :underline "red")
>   #+end_src


Sheng Yang(杨圣), PhD student
Computer Science Department
University of Maryland, College Park
E-mail: sty...@fastmail.com
E-mail (old but still used): yangsheng6...@gmail.com



Re: [PATCH] Adaptive Org faces in headings?

2020-09-18 Thread Protesilaos Stavrou
Ihor Radchenko  [2020-09-17, 16:25 +0800]:

> The attached patch seems to fix the issue.
> Can anyone test?

I just tried this using the standard faces of 'emacs -Q' as well as
custom themes.

In short, the patch fixes the issue on my side.  I tested whether faces
on the headline would correctly inherit any of the following properties:

+ :height
+ :weight
+ :background
+ :overline

I also tested it with 'variable-pitch' headlines and, again, every
construct that does not have a font family explicitly assigned to it
will adapt to the underlying heading.  Excellent!

This is the kind of headline I tried:

 * TODO [#A] This is a test ~scaling-elements~ =faces-adapt= :good-stuff:

Also added links to confirm my findings.  Again, all good.

-- 
Protesilaos Stavrou
protesilaos.com



[PATCH] Adaptive Org faces in headings?

2020-09-17 Thread Ihor Radchenko
The attached patch seems to fix the issue.
Can anyone test?

Best,
Ihor

>From 7a5bfe2f514af1f6af48652155732dbcb9fe22d0 Mon Sep 17 00:00:00 2001
From: Ihor Radchenko 
Date: Thu, 17 Sep 2020 16:14:11 +0800
Subject: [PATCH] Make sure that headline faces take precedence

* lisp/org.el (org-activate-links): Prepend instead of overriding
existing face.
(org-set-font-lock-defaults): Prepend keyword, `org-headline-todo', and
`org-headline-done' faces instead of overriding.
(org-font-lock-add-priority-faces): Prepend priority face instead of
overriding.
(org-font-lock-add-tag-faces): Prepend tag faces instead of
overriding.

Fix bug when org-level-N headline face is overridden while fontifying
smaller elements within headline.  Prepend the element faces instead.
---
 lisp/org.el | 62 ++---
 1 file changed, 35 insertions(+), 27 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index bc74cedc7..69040a540 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5142,30 +5142,31 @@ This includes angle, plain, and bracket links."
 		 (link (org-element-property :raw-link link-object))
 		 (type (org-element-property :type link-object))
 		 (path (org-element-property :path link-object))
+ (face-property (pcase (org-link-get-parameter type :face)
+  ((and (pred functionp) face) (funcall face path))
+  ((and (pred facep) face) face)
+  ((and (pred consp) face) face) ;anonymous
+  (_ 'org-link)))
 		 (properties		;for link's visible part
-		  (list
-		   'face (pcase (org-link-get-parameter type :face)
-			   ((and (pred functionp) face) (funcall face path))
-			   ((and (pred facep) face) face)
-			   ((and (pred consp) face) face) ;anonymous
-			   (_ 'org-link))
-		   'mouse-face (or (org-link-get-parameter type :mouse-face)
-   'highlight)
-		   'keymap (or (org-link-get-parameter type :keymap)
-			   org-mouse-map)
-		   'help-echo (pcase (org-link-get-parameter type :help-echo)
-((and (pred stringp) echo) echo)
-((and (pred functionp) echo) echo)
-(_ (concat "LINK: " link)))
-		   'htmlize-link (pcase (org-link-get-parameter type
-:htmlize-link)
-   ((and (pred functionp) f) (funcall f))
-   (_ `(:uri ,link)))
-		   'font-lock-multiline t)))
+		  (list 'mouse-face (or (org-link-get-parameter type :mouse-face)
+	'highlight)
+			'keymap (or (org-link-get-parameter type :keymap)
+org-mouse-map)
+			'help-echo (pcase (org-link-get-parameter type :help-echo)
+ ((and (pred stringp) echo) echo)
+ ((and (pred functionp) echo) echo)
+ (_ (concat "LINK: " link)))
+			'htmlize-link (pcase (org-link-get-parameter type
+  :htmlize-link)
+	((and (pred functionp) f) (funcall f))
+	(_ `(:uri ,link)))
+			'font-lock-multiline t)))
 	(org-remove-flyspell-overlays-in start end)
 	(org-rear-nonsticky-at end)
 	(if (not (eq 'bracket style))
-		(add-text-properties start end properties)
+		(progn
+  (add-face-text-property start end face-property)
+		  (add-text-properties start end properties))
 	  ;; Handle invisible parts in bracket links.
 	  (remove-text-properties start end '(invisible nil))
 	  (let ((hidden
@@ -5174,6 +5175,7 @@ This includes angle, plain, and bracket links."
 'org-link))
 			 properties)))
 		(add-text-properties start visible-start hidden)
+(add-face-text-property visible-start visible-end face-property)
 		(add-text-properties visible-start visible-end properties)
 		(add-text-properties visible-end end hidden)
 		(org-rear-nonsticky-at visible-start)
@@ -5641,7 +5643,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
 	   ;; TODO keyword
 	   (list (format org-heading-keyword-regexp-format
 			 org-todo-regexp)
-		 '(2 (org-get-todo-face 2) t))
+		 '(2 (org-get-todo-face 2) prepend))
 	   ;; TODO
 	   (when org-fontify-todo-headline
 	 (list (format org-heading-keyword-regexp-format
@@ -5649,7 +5651,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
 			"\\(?:"
 			(mapconcat 'regexp-quote org-not-done-keywords "\\|")
 			"\\)"))
-		   '(2 'org-headline-todo t)))
+		   '(2 'org-headline-todo prepend)))
 	   ;; DONE
 	   (when org-fontify-done-headline
 	 (list (format org-heading-keyword-regexp-format
@@ -5657,7 +5659,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
 			"\\(?:"
 			(mapconcat 'regexp-quote org-done-keywords "\\|")
 			"\\)"))
-		   '(2 'org-headline-done t)))
+		   '(2 'org-headline-done prepend)))
 	   ;; Priorities
 	   '(org-font-lock-add-priority-faces)
 	   ;; Tags
@@ -5841,18 +5843,24 @@ If TAG is a number, get the corresponding match group."
 (defun org-font-lock-add-priority-faces (limit)
   "Add the special priority faces."
   (while (re-search-forward org-priority-regexp limit t)
+(add-face-text-property
+ (match-beginning 1)
+ 

Re: Adaptive Org faces in headings?

2020-09-12 Thread Protesilaos Stavrou
Bastien  [2020-09-09, 10:49 +0200]:

> Protesilaos Stavrou  writes:
>
>> Diego Zamboni  [2020-09-05, 23:39 +0200]:
>>
>>> I had seen the same in my setup. I recently started using Doom Emacs
>>> (https://github.com/hlissner/doom-emacs/) and was pleasantly surprised
>>> to discover that todo and tag faces scale according to the headline in
>>> which they are. I don't know precisely how this is done, but there are
>>> some hints here, you might use it as a starting point:
>>> https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/config.el#L146-L175
>>
>> I noticed that the doom-themes have some extra code to fontify Org.[0]
>> It also has some opinionated extras that do not belong to the issue I
>> raised.  I am curious whether this was ever shared/discussed on this
>> mailing list.
>
> I can't remember any such discussion.
>
> (In general, it would be good if downstream enhancements like these
> could be shared upstream, we are generally quite grateful for help!)
>
> In any case, thanks for reporting this issue, I confirm we should
> work on it for a future release.
>
> Patches welcome,

Hello again!

I am not sure I can help with the patch, but at least I can share some
more user feedback.

Please see the attached screenshots that could help improve our
understanding of the issue.  The gist is that Org already has working
code that adapts some faces to the underlying heading style (in this
case font height and weight).

To reproduce this demo on emacs -Q:

+ Open an org-mode file, e.g. C-x C-f /tmp/test.org
+ Insert a level 1 heading:

  * TODO [#A] Do they adapt ~test-heading-faces~ and =another-test=?

+ Evaluate each of the expressions in the code block and notice how the
  heading's faces adapt to it:

#+begin_src emacs-lisp
(set-face-attribute 'org-level-1 nil :height 3.0 :weight 'normal)
(set-face-attribute 'org-level-1 nil :weight 'bold)
#+end_src

This is in addition to what I noted in a previous message:
https://lists.gnu.org/archive/html/emacs-orgmode/2020-09/msg00331.html

Best regards,
Protesilaos

-- 
Protesilaos Stavrou
protesilaos.com



Re: Adaptive Org faces in headings?

2020-09-09 Thread Bastien
Hi Timothy,

TEC  writes:

> From memory, Doom actually has a number of rather nice Org patches that
> it hoards :P IIRC simply to avoid the effort of going through the patch
> process, and have more flexibility (using Doom convenience macros, etc.).
>
> See 
> https://github.com/hlissner/doom-macs/blob/develop/modules/lang/org/config.el
> for nice features like lazy loading babel language support.
>
> There are a number of contributors, but if you look at the blame
> (https://github.com/hlissner/doom-emacs/blame/develop/modules/lang/org/config.el)
> you can see that it looks like everyone other than Henrik (hlissner) has
> only made what we'd call TINYCHANGEs.

We do encourage early upstream contributions exactly because of this
issue: when downstream (or distinct) projects accumulate changes made 
with no clear copyright assignment, we cannot integrate these changes
upstream, because of these copyright uncertainty.

-- 
 Bastien



Re: Adaptive Org faces in headings?

2020-09-09 Thread TEC


Bastien  writes:

> (In general, it would be good if downstream enhancements like these
> could be shared upstream, we are generally quite grateful for help!)

>From memory, Doom actually has a number of rather nice Org patches that
it hoards :P IIRC simply to avoid the effort of going through the patch
process, and have more flexibility (using Doom convenience macros, etc.).

See 
https://github.com/hlissner/doom-macs/blob/develop/modules/lang/org/config.el
for nice features like lazy loading babel language support.

There are a number of contributors, but if you look at the blame
(https://github.com/hlissner/doom-emacs/blame/develop/modules/lang/org/config.el)
you can see that it looks like everyone other than Henrik (hlissner) has
only made what we'd call TINYCHANGEs.

--
 Timothy.



Re: Adaptive Org faces in headings?

2020-09-09 Thread Bastien
Hi Protesilaos,

Protesilaos Stavrou  writes:

> Diego Zamboni  [2020-09-05, 23:39 +0200]:
>
>> I had seen the same in my setup. I recently started using Doom Emacs
>> (https://github.com/hlissner/doom-emacs/) and was pleasantly surprised
>> to discover that todo and tag faces scale according to the headline in
>> which they are. I don't know precisely how this is done, but there are
>> some hints here, you might use it as a starting point:
>> https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/config.el#L146-L175
>
> I noticed that the doom-themes have some extra code to fontify Org.[0]
> It also has some opinionated extras that do not belong to the issue I
> raised.  I am curious whether this was ever shared/discussed on this
> mailing list.

I can't remember any such discussion.

(In general, it would be good if downstream enhancements like these
could be shared upstream, we are generally quite grateful for help!)

In any case, thanks for reporting this issue, I confirm we should
work on it for a future release.

Patches welcome,

-- 
 Bastien



Re: Adaptive Org faces in headings?

2020-09-06 Thread Protesilaos Stavrou
Hello Diego,

Diego Zamboni  [2020-09-05, 23:39 +0200]:

> I had seen the same in my setup. I recently started using Doom Emacs
> (https://github.com/hlissner/doom-emacs/) and was pleasantly surprised
> to discover that todo and tag faces scale according to the headline in
> which they are. I don't know precisely how this is done, but there are
> some hints here, you might use it as a starting point:
> https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/config.el#L146-L175

I noticed that the doom-themes have some extra code to fontify Org.[0]
It also has some opinionated extras that do not belong to the issue I
raised.  I am curious whether this was ever shared/discussed on this
mailing list.  It does not seem specific to Doom, so it be nice to have
it for the benefit of every user mutatis mutandis.

[0]: 
https://github.com/hlissner/emacs-doom-themes/blob/master/doom-themes-ext-org.el

-- 
Protesilaos Stavrou
protesilaos.com



Re: Adaptive Org faces in headings?

2020-09-06 Thread Protesilaos Stavrou
Hello Bastien!

Bastien  [2020-09-05, 16:47 +0200]:

>  Could you insert a small picture showing where faces customization
> don't interact nicely, e.g. when using different heights for org-todo
> org-level-1?

Please see attached.  This is on 'emacs -Q'.  What I did:

- C-x C-f test.org
- C-x 2
- C-x b *scratch*
- Insert and then evaluate each of:
  + (set-face-attribute 'org-level-1 nil :height 2.0)
  + (set-face-attribute 'org-level-2 nil :background "#e0e0e0" :height 1.5)
- C-x o
- Insert some headings:
  + * TODO [#A] This is a test  
:tag:
  + ** TODO [#A] This is a test 
:tag:
  + * [[https://www.gnu.org/][links also]] This is a test   
:tag:

> It would help deciding whether this is an issue for Org or for
> Emacs in general regarding faces interaction.

The feedback I have received thus far suggests that it may have to do
with how Org configures its font locking in org-set-font-lock-defaults.

In particular:

1. The org-tag has an OVERRIDE argument in the form of 'prepend'
   
https://code.orgmode.org/bzg/org-mode/src/5417e384ebab58e560fe6a80eee7bc58b1ef8645/lisp/org.el#L5625

   So it is merged with the underlying face, as shown in the screenshot.

2. While keywords have a 't' argument which overrules the underlying
   face (it would behave the same as tags with 'prepend'):
   
https://code.orgmode.org/bzg/org-mode/src/5417e384ebab58e560fe6a80eee7bc58b1ef8645/lisp/org.el#L5647

Not sure about priority cookies and links.

This is what I have for now.  Thank you for looking into this!

My system details:

- GNU Emacs 27.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.22,
  cairo version 1.17.3) of 2020-08-14

- Org mode version 9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)

Best regards
Protesilaos

-- 
Protesilaos Stavrou
protesilaos.com


Re: Adaptive Org faces in headings?

2020-09-05 Thread Diego Zamboni
Hi Protesilaos,

I had seen the same in my setup. I recently started using Doom Emacs (
https://github.com/hlissner/doom-emacs/) and was pleasantly surprised to
discover that todo and tag faces scale according to the headline in which
they are. I don't know precisely how this is done, but there are some hints
here, you might use it as a starting point:
https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/config.el#L146-L175

(tangentially: I am very happy with Doom Emacs. After 30+ years of
handcrafting my Emacs config, I decided to give it a try and I can highly
recommend it).

--Diego


On Sun, Apr 26, 2020 at 9:01 AM Protesilaos Stavrou 
wrote:

> 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
>
>


Re: Adaptive Org faces in headings?

2020-09-05 Thread Bastien
Dear Protesilaos,

thank you very much for your feedback.  Could you insert a small
picture showing where faces customization don't interact nicely,
e.g. when using different heights for org-todo org-level-1?

It would help deciding whether this is an issue for Org or for
Emacs in general regarding faces interaction.

Thanks in advance!

-- 
 Bastien



Re: Adaptive Org faces in headings?

2020-04-26 Thread Ihor Radchenko
> 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 ( 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  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: yanta...@gmail.com, ihor_radche...@alumni.sutd.edu.sg



Adaptive Org faces in headings?

2020-04-26 Thread Protesilaos Stavrou
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