emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/org-superstar da32880de2 047/162: Honor org-odd-levels-onl


From: Stefan Kangas
Subject: [nongnu] elpa/org-superstar da32880de2 047/162: Honor org-odd-levels-only when computing heading levels.
Date: Fri, 31 Dec 2021 19:35:23 -0500 (EST)

branch: elpa/org-superstar
commit da32880de2ba5aecea1ade9b37de7379f19db4fe
Author: D. Williams <d.williams@posteo.net>
Commit: D. Williams <d.williams@posteo.net>

    Honor org-odd-levels-only when computing heading levels.
    
    Idea taken from org-bullets (c19b13b).
    
    Added new function --get-TODO to access org TODO keywords.
    Added a simple sample file for odd levels.
---
 org-superstar.el     | 14 ++++++++++----
 tests/sample-odd.org |  9 +++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/org-superstar.el b/org-superstar.el
index db75f9dff6..65d91dba55 100644
--- a/org-superstar.el
+++ b/org-superstar.el
@@ -5,7 +5,7 @@
 ;; Author: D. Williams <d.williams@posteo.net>
 ;; Maintainer: D. Williams <d.williams@posteo.net>
 ;; Keywords: faces, outlines
-;; Version: 0.2.0
+;; Version: 0.3.0
 ;; Homepage: https://github.com/dw-github-mirror/org-superstar-mode
 ;; Package-Requires: ((org "9.1.9") (emacs "26.2"))
 
@@ -305,6 +305,14 @@ function for your changes to take effect."
 
 ;;; Accessor Functions
 
+(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)))
+
 (defun org-superstar--hbullets ()
   "Return the length of ‘org-superstar-headline-bullets-list’."
   (length org-superstar-headline-bullets-list))
@@ -314,7 +322,7 @@ function for your changes to take effect."
 
 See also ‘org-superstar-cycle-headline-bullets’."
   (let ((max-bullets org-superstar-cycle-headline-bullets)
-        (n (1- level)))
+        (n (if org-odd-levels-only (/ (1- level) 2) (1- level))))
     (string-to-char
      (cond ((integerp max-bullets)
             (elt org-superstar-headline-bullets-list
@@ -463,8 +471,6 @@ prettifying bullets in (for example) source blocks."
                         (org-superstar--lbullet)))
       'org-superstar-leading)))
 
-
-
 (defun org-superstar--unprettify-hbullets ()
   "Revert visual tweaks made to header bullets in current buffer."
   (save-excursion
diff --git a/tests/sample-odd.org b/tests/sample-odd.org
new file mode 100644
index 0000000000..7a280c5157
--- /dev/null
+++ b/tests/sample-odd.org
@@ -0,0 +1,9 @@
+#+TITLE: Sample File
+#+STARTUP: odd
+#+STARTUP: showeverything
+* 1
+*** 2
+***** 3
+******* 4
+********* 5
+*********** 6



reply via email to

[Prev in Thread] Current Thread [Next in Thread]