emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: StrawberryTea <look@strawberrytea.xyz>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Protesilaos Stavrou <info@protesilaos.com>,  emacs-orgmode@gnu.org
Subject: Re: [DISCUSSION] Face priority in Org fontification
Date: Sat, 30 Mar 2024 08:55:18 -0500	[thread overview]
Message-ID: <87v853vn7d.fsf@strawberrytea.xyz> (raw)
In-Reply-To: <87jzm0abrd.fsf@strawberrytea.xyz> (StrawberryTea's message of "Sun, 17 Mar 2024 14:39:34 -0500")

StrawberryTea <look@strawberrytea.xyz> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> Protesilaos Stavrou <info@protesilaos.com> writes:
>>
>>> Now the tricky part is to figure out which combinations can work this
>>> way. Headings and source blocks are two obvious ones. Maybe there are
>>> more, but I cannot think of one right now.
>>
>> This is relevant to any greater element that can contain markup inside
>> and where we apply the fontification to both markup and contents:
>>
>> - headlines
>> - tables
>> - descriptive lists
>> - commented headlines
>>
>> For headlines and tables, it /feels/ reasonable to apply the container
>> face first and then prepend the markup faces.
>> However, for descriptive lists and commented headlines, it is not so
>> clear. For commented headlines that should fade out compared to ordinary
>> headlines, prepending markup faces may lead to commented headlines
>> standing out.
> I do not know what you mean by commented headlines. Do you mean
> headlines with the COMMENT keyword? I think it's better that the COMMENT
> keyword blend in with the headline so that the headline does not look
> broken. In the descriptive list case, it also makes sense for all the
> themes I've tried because the result of `append` is that the date font
> is bolded, which makes it look more aesthetically pleasing.
>
> Also, here is an updated version of the patch that covers all the
> inline markup you said earlier except for inline source blocks:
>
> diff --git a/lisp/ol.el b/lisp/ol.el
> index fa16b5920..b4253685f 100644
> --- a/lisp/ol.el
> +++ b/lisp/ol.el
> @@ -2223,8 +2223,8 @@ Also refresh fontification if needed."
>     ;; Some languages, e.g., Chinese, do not use spaces to
>     ;; separate words.  Also allow to surround radio targets with
>     ;; line-breakable characters.
> -	(before-re "\\(?:^\\|[^[:alnum:]]\\|\\c|\\)\\(")
> -	(after-re "\\)\\(?:$\\|[^[:alnum:]]\\|\\c|\\)")
> +	(before-re "\\(?:^\\|[^[:alnum:]<]\\|\\c|\\)\\(")
> +	(after-re "\\)\\(?:$\\|[^[:alnum:]>]\\|\\c|\\)")
>     (targets
>      (org-with-wide-buffer
>       (goto-char (point-min))
> diff --git a/lisp/org.el b/lisp/org.el
> index 33d90506b..ac2cd2bc4 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -5631,9 +5631,10 @@ by a #."
>          (match-string 1))
>     (let ((end (match-end 1))
>           (closing-start (match-beginning 1)))
> -	  (add-text-properties
> -	   begin end
> -	   '(font-lock-multiline t font-lock-fontified t face org-macro))
> +          (add-text-properties
> +           begin end
> +           '(font-lock-multiline t font-lock-fontified t))
> +          (add-face-text-property begin end 'org-macro)
>       (org-remove-flyspell-overlays-in begin end)
>       (when org-hide-macro-markers
>         (add-text-properties begin opening-end '(invisible t))
> @@ -5678,14 +5679,14 @@ by a #."
>         (search-forward (or label "fn:"))
>         (org-remove-flyspell-overlays-in beg (match-end 0))))
>     (add-text-properties beg end
> -			     (list 'mouse-face 'highlight
> -				   'keymap org-mouse-map
> -				   'help-echo
> -				   (if referencep "Footnote reference"
> -				     "Footnote definition")
> -				   'font-lock-fontified t
> -				   'font-lock-multiline t
> -				   'face 'org-footnote))))))
> +	                     (list 'mouse-face 'highlight
> +	                           'keymap org-mouse-map
> +	                           'help-echo
> +	                           (if referencep "Footnote reference"
> +		                     "Footnote definition")
> +	                           'font-lock-fontified t
> +	                           'font-lock-multiline t))
> +        (add-face-text-property beg end 'org-footnote)))))
>
>  (defun org-activate-dates (limit)
>    "Add text properties for dates."
> @@ -5923,12 +5924,12 @@ needs to be inserted at a specific position in the font-lock sequence.")
>       ;; Link related fontification.
>       '(org-activate-links)
>       (when (memq 'tag org-highlight-links) '(org-activate-tags (1 'org-tag prepend)))
> -	  (when (memq 'radio org-highlight-links) '(org-activate-target-links (1 'org-link t)))
> -	  (when (memq 'date org-highlight-links) '(org-activate-dates (0 'org-date t)))
> +	  (when (memq 'radio org-highlight-links) '(org-activate-target-links (1 'org-link prepend)))
> +	  (when (memq 'date org-highlight-links) '(org-activate-dates (0 'org-date prepend)))
>       (when (memq 'footnote org-highlight-links) '(org-activate-footnote-links))
>            ;; Targets.
> -          (list org-radio-target-regexp '(0 'org-target t))
> -	  (list org-target-regexp '(0 'org-target t))
> +          (list org-radio-target-regexp '(0 'org-target prepend))
> +	  (list org-target-regexp '(0 'org-target prepend))
>       ;; Diary sexps.
>       '("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t))
>       ;; Macro
>
> The only nuance I have noticed so far is that to prevent the radio link
> from also inheriting the `org-link' face for itself, I had to modify the
> target link regexp to exclude the `<' and `>' characters.
>
> StrawberryTea

Hi. I'm following up on this thread as a friendly ping since I don't
want this issue to be forgotten. I think the patch is ready for review.

StrawberryTea


  parent reply	other threads:[~2024-03-30 13:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-03 21:13 [BUG] org dates, radio links, and special keywords override heading backgrounds [9.7 (9.7-??-902dacb @ /home/st/.config/emacs/.local/straight/build-30.0.50/org/)] StrawberryTea
2024-03-04 10:32 ` [DISCUSSION] Face priority in Org fontification (was: [BUG] org dates, radio links, and special keywords override heading backgrounds [9.7 (9.7-??-902dacb @ /home/st/.config/emacs/.local/straight/build-30.0.50/org/)]) Ihor Radchenko
2024-03-13  7:55   ` Protesilaos Stavrou
2024-03-13 14:27     ` Ihor Radchenko
2024-03-14  9:20       ` Protesilaos Stavrou
2024-03-15 13:58         ` Ihor Radchenko
     [not found]           ` <87jzm0abrd.fsf@strawberrytea.xyz>
2024-03-30 13:55             ` StrawberryTea [this message]
2024-03-31 11:48           ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v853vn7d.fsf@strawberrytea.xyz \
    --to=look@strawberrytea.xyz \
    --cc=emacs-orgmode@gnu.org \
    --cc=info@protesilaos.com \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).