Ihor Radchenko wrote:

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

Of course. My apologies for this.

+(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.

This would seem better, but we would need to determine whether point is inside the block element's :value contents. The org-element block types do not currently expose :contents-begin and :contents-end. Should they?

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

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

They could be. org-indent is virtual and org-indentation is literal; but they both exist to convey outline structure. Ideally, I would probably name the literal face org-indent and have org-indent-virtual inherit from org-indent; but that would technically be a breaking change (though I doubt org-indent is frequently customized). Alternately, we could create two new faces, org-indent-literal and org-indent-virtual and have them both inherit from org-indent. This would be the most flexible and also fully backward compatible. Any preference?

+          ;; 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.

The pattern returned by org-item-re groups indentation and bullets together; we need the latter isolated. I like the idea of keeping one canonical pattern source. As long as no current usage of org-item-re relies on its match group numbering, we could update the pattern's grouping. Does this sound reasonable?

Also, org-plain-list-indicator is a strange name. What about org-list-bullet?

Sounds good.

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

Sounds good here too.

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.

We already have faces for different levels, and hence customization in the that dimension. This enables customization of level markers regardless of level. It's intended to be orthogonal; the two together compose.





Reply via email to