branch: externals/org
commit 1e6cedd8a2485480e4cd50fe6138bb88180da048
Author: Slawomir Grochowski <[email protected]>
Commit: Slawomir Grochowski <[email protected]>

    ; org-colview: Extract tag text propertizing
    
    * lisp/org-colview.el (org-columns--propertize-tags): New function.
    (org-columns--overlay-text): Use it.
    
    Refactoring: Extract Function.
    
    No behavior change.
---
 lisp/org-colview.el | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index a843c1d1bb..50735d6a40 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -402,6 +402,15 @@ non-nil, omit the trailing space after the separator, 
since no
 further column follows."
   (format (if lastp "%%-%d.%ds |" "%%-%d.%ds | ") width width))
 
+(defun org-columns--propertize-tags (tag-text)
+  "Apply Org tag faces to TAG-TEXT."
+  (if (not org-tags-special-faces-re)
+      (propertize tag-text 'face 'org-tag)
+    (replace-regexp-in-string
+     org-tags-special-faces-re
+     (lambda (tag) (propertize tag 'face (org-get-tag-face tag)))
+     tag-text nil nil 1)))
+
 (defun org-columns--overlay-text
     (displayed-value cell-format-string width property value)
   "Return decorated DISPLAYED-VALUE string for column overlay display.
@@ -415,13 +424,7 @@ by `org-columns--displayed-value'."
               ("PRIORITY"
                (propertize cell-text 'face (org-get-priority-face value)))
               ("TAGS"
-               (if (not org-tags-special-faces-re)
-                   (propertize cell-text 'face 'org-tag)
-                 (replace-regexp-in-string
-                  org-tags-special-faces-re
-                  (lambda (tag)
-                   (propertize tag 'face (org-get-tag-face tag)))
-                  cell-text nil nil 1)))
+               (org-columns--propertize-tags cell-text))
               ("TODO" (propertize cell-text 'face (org-get-todo-face value)))
               (_ cell-text)))))
 

Reply via email to