emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DISCUSSION] Face priority in Org fontification


From: StrawberryTea
Subject: Re: [DISCUSSION] Face priority in Org fontification
Date: Sat, 30 Mar 2024 08:55:18 -0500
User-agent: mu4e 1.12.2; emacs 30.0.50

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]