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

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

[nongnu] elpa/dslide e02862a177 5/8: Introducing Breadcrumb appending op


From: ELPA Syncer
Subject: [nongnu] elpa/dslide e02862a177 5/8: Introducing Breadcrumb appending options
Date: Thu, 28 Nov 2024 06:59:38 -0500 (EST)

branch: elpa/dslide
commit e02862a17763e7c7bb6f513300ed2ff7d072b0a9
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>

    Introducing Breadcrumb appending options
---
 dslide.el | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/dslide.el b/dslide.el
index 416815355c..2f271e2478 100644
--- a/dslide.el
+++ b/dslide.el
@@ -223,6 +223,11 @@ properties remain unless shadowed."
   :type '(choice (const :tag "Don't display breadcrumbs" nil)
                  (string :tag "Delimiter")))
 
+(defcustom dslide-breadcrumb-separator-style 'append
+  "Where breadcrumb separators will be used.
+This helps distinguish the breadcrumbs from the slide headline."
+  :type '(choice (const :tag "After each breadcrumb" append)
+                 (const :tag "Only between breadcrumbs" separate)))
 
 (defcustom dslide-breadcrumb-hide-todo-state t
   "If non-nil, hide TODO states in the breadcrumbs."
@@ -2564,10 +2569,22 @@ from existing state cleanup."
 
 (defun dslide--breadcrumbs-reducer (delim)
   (lambda (previous next)
-    (if (not previous) next
-      (let ((props (text-properties-at (1- (length previous)) previous)))
-        (concat previous (apply #'propertize delim props)
-                next)))))
+    (let* ((props (pcase dslide-breadcrumb-separator-style
+                    ('append (text-properties-at (1- (length next))
+                                                 next))
+                    ('separate (when previous
+                                 (text-properties-at
+                                  (1- (length previous)) previous)))
+                    (_ (display-warning '(dslide dslide-breadcrumb)
+                                        "Uknown separators style"))))
+           (delim (apply #'propertize delim props)))
+      (pcase dslide-breadcrumb-separator-style
+        ('append
+         (if (not previous) (concat next delim)
+           (concat previous next delim)))
+        ('separate
+         (if (not previous) next
+           (concat previous delim next)))))))
 
 ;; TODO use element API
 (defun dslide--get-parents (delim)



reply via email to

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