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