Function: org-modern--tag

org-modern--tag is a natively compiled function defined in org-modern.el.

Signature

(org-modern--tag)

Documentation

Prettify headline tags.

Source Code

;; Defined in /nix/store/0fwir9vccqq0yiqnswyf22ip3sl68f49-emacs-packages-deps/share/emacs/site-lisp/elpa/org-modern-20260722.1411/org-modern.el
(defun org-modern--tag ()
  "Prettify headline tags."
  (save-excursion
    (let* ((default-face (get-text-property (match-beginning 1) 'face))
           (colon-props `(display " " face ,default-face))
           (beg (match-beginning 2))
           (end (match-end 2))
           colon-beg colon-end)
      (goto-char beg)
      (while (re-search-forward "::?" end 'noerror)
        (let ((cbeg (match-beginning 0))
              (cend (match-end 0)))
          (when colon-beg
            (put-text-property colon-end (1+ colon-end) 'display
                               (format #(" %c" 1 3 (cursor t)) (char-after colon-end)))
            (put-text-property (1- cbeg) cbeg 'display
                               (string (char-before cbeg) ?\s))
            (put-text-property
             colon-end cbeg 'face
             (if-let* ((faces org-modern-tag-faces)
                       (face (or (cdr (assoc (buffer-substring-no-properties colon-end cbeg) faces))
                                 (cdr (assq t faces)))))
                 `(,face org-modern-tag)
               'org-modern-tag)))
          (add-text-properties cbeg cend colon-props)
          (setq colon-beg cbeg colon-end cend))))))