branch: externals/org-modern commit a37053e995c8ad37d9bfc05e3b2e579e7b3b1c06 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
More elegant progress indicator --- example.org | 2 +- org-modern.el | 21 ++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/example.org b/example.org index 676f7cd653..6a59ff3428 100644 --- a/example.org +++ b/example.org @@ -12,7 +12,7 @@ which are styled by =org-modern=. **** Fourth level ***** Fifth level -* Task Lists [1/3] +* Task Lists [1/3] [33%] - [X] Write =org-modern= - [-] Publish =org-modern= - [ ] Fix all the bugs diff --git a/org-modern.el b/org-modern.el index a002f40d3b..acfb6f91b7 100644 --- a/org-modern.el +++ b/org-modern.el @@ -138,10 +138,10 @@ Set to nil to disable styling checkboxes." "Prettify todo statistics." :type 'boolean) -(defcustom org-modern-progress " ▁▂▃▄▅▆▇█" - "Add a progress bar to the todo statistics. -Set to nil to disable the progress bar." - :type '(choice (const nil) string)) +(defcustom org-modern-progress ["○""◔""◐""◕""●"] + "Add a progress indicator to the todo statistics. +Set to nil to disable the indicator." + :type '(choice (const nil) (vector string))) (defgroup org-modern-faces nil "Faces used by `org-modern'." @@ -183,11 +183,6 @@ Set to nil to disable the progress bar." '((t :inherit org-modern-done)) "Face used for todo statistics labels.") -(defface org-modern-progress - '((((background light)) :foreground "gray40") - (t :foreground "gray60")) - "Face used for todo statistics progress bar.") - (defface org-modern-date-active '((t :inherit org-modern-done)) "Face used for active date labels.") @@ -241,7 +236,7 @@ Set to nil to disable the progress bar." "Prettify headline todo statistics." (let ((label (propertize (match-string 1) 'face 'org-modern-statistics))) (when org-modern-progress - (let ((idx (ceiling + (let ((idx (floor (* (1- (length org-modern-progress)) (if (match-beginning 2) (* 0.01 (string-to-number (match-string 2))) @@ -249,11 +244,7 @@ Set to nil to disable the progress bar." (if (= q 0) 1.0 (/ (* 1.0 (string-to-number (match-string 3))) q)))))))) - (setq label (concat - (propertize (char-to-string (aref org-modern-progress idx)) - 'face 'org-modern-progress) - " " - label)))) + (setq label (concat (aref org-modern-progress idx) " " label)))) (setq label (concat " " label " ")) (add-face-text-property 0 (length label) 'org-modern-statistics 'append label)