JV <[email protected]> writes:

> Ihor Radchenko wrote:
>
>> Sorry for the late reply.
>
> And likewise for mine!
>
> I've attached a patch that adds faces for headline indicators, plain 
> list indicators, and leading whitespace significant to plain list structure.

Thanks!

> Subject: [PATCH] Add faces for structural syntax elements
>
> This adds an identifying face and fontification for each of the
> following syntax elements that convey document structure:
>
> - headline indicators (stars)
> - plain list item indicators (bullets or numerals)
> - leading whitespace, significant for plain list depth
>
> These faces are defined without any properties. This adds useful
> semantic information, but reserves any visual customization to the
> user.

Could you please format the commit message following out conventions?
See https://orgmode.org/worg/org-contribute.html#commit-messages

> +(defun org-fontify-leading-spaces (limit)
> +  "Fontify leading whitespace."
> +  (when (re-search-forward "^[ \t]+" limit t)
> +    (let* ((beg (match-beginning 0))
> +           (end (match-end 0)))
> +      ;; Indentation is significant for plain list items and their
> +      ;; paragraphs, which lack bullet or numeral indicators.
> +      ;; Fontify, skipping quoted block types. See `org-protecting-blocks'.
> +      (unless (memq 'org-block (ensure-list (get-text-property beg 'face)))

This is not reliable and depends on the fontification order.
I suggest using org-element-at-point instead.

> +        (add-face-text-property beg end 'org-indentation)))
> +    t))

org-indentation sounds very similar to org-indent.
Should they be linked somehow?

>  (defun org-fontify-extend-region (beg end _old-len)
>    (let ((end (if (progn (goto-char end) (looking-at-p "^[*#]"))
>                   (min (point-max) (1+ end))
> @@ -6099,7 +6111,14 @@ needs to be inserted at a specific position in the 
> font-lock sequence.")
>              "^\\(\\**\\)\\(\\* \\)\\(.*\\)")
>           (1 (org-get-level-face 1))
>           (2 (org-get-level-face 2))
> -         (3 (org-get-level-face 3)))
> +            (3 (org-get-level-face 3)))
> +          ;; Plain lists
> +          `(,(if org-list-allow-alphabetical
> +                 "^[ \t]*\\(\\([-+]\\|[0-9]+[.)]\\|[a-zA-Z][.)]\\)[ 
> \t\r\n]\\)"
> +               "^[ \t]*\\(\\([-+]\\|[0-9]+[.)]\\)[ \t\r\n]\\)")
> +            (1 'org-plain-list-indicator))
> +          '("^[ \t]+\\(\\*[ \t\r\n]\\)" ; star as bullet requires indentation
> +            (1 'org-plain-list-indicator))

Why do you need to produce a custom regexp here?
Can just use org-item-re.
Also, org-plain-list-indicator is a strange name. What about org-list-bullet?

>        (org-l (if org-odd-levels-only (1+ (/ org-l0 2)) org-l0))
>        (org-f (if org-cycle-level-faces
>                   (nth (% (1- org-l) org-n-level-faces) org-level-faces)
> -               (nth (1- (min org-l org-n-level-faces)) org-level-faces))))
> +               (nth (1- (min org-l org-n-level-faces)) org-level-faces)))
> +         (org-f-stars (list 'org-headline-indicator org-f)))
>      (cond
> -     ((eq n 1) (if org-hide-leading-stars 'org-hide org-f))
> -     ((eq n 2) org-f)
> +     ((eq n 1) (if org-hide-leading-stars 'org-hide org-f-stars))
> +     ((eq n 2) org-f-stars)
>       (t (unless org-level-color-stars-only org-f)))))

What about org-headline-stars face name? indicator is too generic.
Also, we have org-level-faces for different levels. Why not creating the
equivalent customization for stars? It is awkward to have just one face
for all levels for stars, but elaborate customization for everything else.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to