[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-superstar db2e27d68a 049/162: Adding first draft of TO
From: |
Stefan Kangas |
Subject: |
[nongnu] elpa/org-superstar db2e27d68a 049/162: Adding first draft of TODO item support. |
Date: |
Fri, 31 Dec 2021 19:35:23 -0500 (EST) |
branch: elpa/org-superstar
commit db2e27d68ac2d431aa7501275797fe1a9e34c78a
Author: D. Williams <d.williams@posteo.net>
Commit: D. Williams <d.williams@posteo.net>
Adding first draft of TODO item support.
Added data structure org-superstar-todo-bullet-alist.
org-superstar-special-todo-items now controls new feature
(default: disabled).
renamed function to --get-TODO to lowercase.
Added save-match-data to --get-todo to stop side effects breaking
code.
Added accessor --todo-bullet for new bullet type.
---
org-superstar.el | 65 +++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 53 insertions(+), 12 deletions(-)
diff --git a/org-superstar.el b/org-superstar.el
index 65d91dba55..7958a8d532 100644
--- a/org-superstar.el
+++ b/org-superstar.el
@@ -119,6 +119,22 @@ variable for your changes to take effect."
(?+ (character))
(?- (character)))))
+
+(defcustom org-superstar-todo-bullet-alist
+ '(("TODO" . ?☐)
+ ("DONE" . ?☑))
+ "Alist of UTF-8 bullets for TODO items.
+
+Each key should be a TODO keyword, and each value should the UTF8
+character to be displayed.
+
+You should re-enable ‘\\[org-superstar-mode]’ after changing this
+variable for your changes to take effect."
+ :group 'org-superstar
+ :type '(alist :key-type (string :format "TODO keyword: %v")
+ :value-type (character :value ?◉
+ :format "Bullet character: %v\n")))
+
;;;###autoload
(put 'org-superstar-leading-bullet
'safe-local-variable
@@ -248,6 +264,15 @@ variable for your changes to take effect."
:type '(choice (const :tag "Enable item bullet fontification" t)
(const :tag "Disable item bullet fontification" nil)))
+(defcustom org-superstar-special-todo-items nil
+ "Non-nil means use special bullets for TODO items.
+
+Instead of displaying bullets corresponding to TODO items
+according to ‘org-superstar-headline-bullets-list’ (dependent on
+the headline’s level), display a bullet according to
+‘org-superstar-todo-bullet-alist’ (dependent on the TODO
+keyword).")
+
;;; Faces
@@ -295,23 +320,34 @@ you want.
This changes the following variables:
‘org-superstar-cycle-headline-bullets’: Enabled.
‘org-hide-leading-stars’: Enabled.
+‘org-superstar-special-todo-items’: Disabled.
You should re-enable ‘\\[org-superstar-mode]’ after calling this
function for your changes to take effect."
(setq org-superstar-cycle-headline-bullets t)
(setq org-hide-leading-stars t)
+ (setq org-superstar-special-todo-items nil)
nil)
;;; Accessor Functions
-(defun org-superstar--get-TODO (pom)
+(defun org-superstar--get-todo (pom)
"Return the TODO keyword at point or marker POM.
If no TODO property is found, return nil."
- (let ((todo-property
- (cdar (org-entry-properties pom "TODO"))))
- (when (stringp todo-property)
- todo-property)))
+ (save-match-data
+ (let ((todo-property
+ (cdar (org-entry-properties pom "TODO"))))
+ (when (stringp todo-property)
+ todo-property))))
+
+(defun org-superstar--todo-bullet ()
+ "Return the desired TODO item bullet, if defined.
+If no entry can be found in ‘org-superstar-todo-bullet-alist’ for
+the current keyword, return nil."
+ (cdr (assoc
+ (org-superstar--get-todo (match-beginning 0))
+ org-superstar-todo-bullet-alist)))
(defun org-superstar--hbullets ()
"Return the length of ‘org-superstar-headline-bullets-list’."
@@ -322,15 +358,20 @@ If no TODO property is found, return nil."
See also ‘org-superstar-cycle-headline-bullets’."
(let ((max-bullets org-superstar-cycle-headline-bullets)
- (n (if org-odd-levels-only (/ (1- level) 2) (1- level))))
- (string-to-char
- (cond ((integerp max-bullets)
+ (n (if org-odd-levels-only (/ (1- level) 2) (1- level)))
+ (todo-bullet (when org-superstar-special-todo-items
+ (org-superstar--todo-bullet))))
+ (cond (todo-bullet)
+ ((integerp max-bullets)
+ (string-to-char
(elt org-superstar-headline-bullets-list
- (% n max-bullets)))
- (max-bullets
+ (% n max-bullets))))
+ (max-bullets
+ (string-to-char
(elt org-superstar-headline-bullets-list
- (% n (org-superstar--hbullets))))
- (t
+ (% n (org-superstar--hbullets)))))
+ (t
+ (string-to-char
(elt org-superstar-headline-bullets-list
(min n (1- (org-superstar--hbullets)))))))))
- [nongnu] elpa/org-superstar d04eb018fd 060/162: Moved old announcements to the bottom of the README., (continued)
- [nongnu] elpa/org-superstar d04eb018fd 060/162: Moved old announcements to the bottom of the README., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 92336ba0fe 054/162: added a new variable for upcoming feature: remove-leading-stars, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar c9f1406645 067/162: forgot quote, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar bd36b34d93 066/162: further minimized test slomode.el, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 6fcf4b58fb 059/162: Treat org-hide-leading-stars-before-indent-mode like the base variable., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 377ad5af7b 051/162: Preparing documentation for new release, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar d2f03b9666 041/162: removed spurious whitespace, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 6089c47f8b 031/162: Major cleanup: fix fontification edge cases, remove redundant variables., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 212cf5821e 063/162: Version bump to signify patch., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar e59514a287 055/162: implementing first draft version of invisible leading bullets, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar db2e27d68a 049/162: Adding first draft of TODO item support.,
Stefan Kangas <=
- [nongnu] elpa/org-superstar 95ad994f82 072/162: fixed typo, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 2f9f9d6b21 070/162: version bump to 1.0.0, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 61bf289b42 073/162: Removed no longer needed temporary testing file., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 31c8dc54a9 082/162: updating README to reflect addition to MELPA, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 7a33a131a2 095/162: Removed MWE file issue-10.org, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 4659cfc120 103/162: Adding a helpful trick to the README., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar 9f86f5aa22 106/162: Add a new point to the FAQ discussing what remains of Issue #10., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar dd9e24efb2 116/162: Added a reference for bullet resources, addressing PR #18., Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar bf6ea02aa1 139/162: Update issue templates, Stefan Kangas, 2021/12/31
- [nongnu] elpa/org-superstar b13c994bca 144/162: Update README, Stefan Kangas, 2021/12/31