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

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

[nongnu] elpa/org-superstar 772719da34 074/162: Streamlined headline pre


From: Stefan Kangas
Subject: [nongnu] elpa/org-superstar 772719da34 074/162: Streamlined headline predicates.
Date: Fri, 31 Dec 2021 19:35:27 -0500 (EST)

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

    Streamlined headline predicates.
    
    Since leading stars *must* be escaped, it makes no sense to use
    a heavyweight org-element call.
    
    The new implementation has been suggested by ngz from the #org-mode
    IRC channel.
---
 org-superstar.el | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/org-superstar.el b/org-superstar.el
index e8f99584b8..daf6cdf551 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: 1.0.0
+;; Version: 1.0.1
 ;; Homepage: https://github.com/integral-dw/org-superstar-mode
 ;; Package-Requires: ((org "9.1.9") (emacs "26.2"))
 
@@ -434,25 +434,20 @@ replaced by their corresponding entry in 
‘org-superstar-item-bullet-alist’."
 (defun org-superstar-headline-or-inlinetask-p ()
   "Return t if the current match is a proper headline or inlinetask."
   (save-match-data
-    (when (org-element-lineage (org-element-at-point)
-                               '(headline inlinetask) t)
-      t)))
+    (and (org-at-heading-p) t)))
 
 (defun org-superstar-headline-p ()
   "Return t if the current match is a proper headline."
   (interactive)
   (save-match-data
-    (when (org-element-lineage (org-element-at-point)
-                               '(headline) t)
-      t)))
+    (org-with-limited-levels
+     (and (org-at-heading-p) t))))
 
 (defun org-superstar-inlinetask-p ()
   "Return t if the current match is a proper inlinetask."
   (and (featurep 'org-inlinetask)
-       (save-match-data
-         (when (org-element-lineage (org-element-at-point)
-                                    '(inlinetask) t)
-           t))))
+       (org-superstar-headline-or-inlinetask-p)
+       (not (org-superstar-headline-p))))
 
 (defun org-superstar-graphic-p ()
   "Return t if the current display supports proper composing."



reply via email to

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