[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/boxy-headings 409fd73 4/7: Refactoring
From: |
ELPA Syncer |
Subject: |
[elpa] externals/boxy-headings 409fd73 4/7: Refactoring |
Date: |
Fri, 15 Oct 2021 10:57:19 -0400 (EDT) |
branch: externals/boxy-headings
commit 409fd73b0cefe95ef54baa67c90935175b4a4174
Author: Tyler Grinn <tylergrinn@gmail.com>
Commit: Tyler Grinn <tylergrinn@gmail.com>
Refactoring
---
boxy-headings.el | 47 +++++++++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 20 deletions(-)
diff --git a/boxy-headings.el b/boxy-headings.el
index 22992e4..6afcfd4 100644
--- a/boxy-headings.el
+++ b/boxy-headings.el
@@ -124,6 +124,20 @@
(t (:background "gainsboro" :foreground "dim gray")))
"Face for tooltips in a boxy diagram.")
+;;;; Variables
+
+(defvar boxy-headings-rel-alist
+ '(("on top of" . ("on.+top"))
+ ("in front of" . ("in.+front"))
+ ("behind" . ("behind"))
+ ("below" . ("below"))
+ ("to the left of" . ("to the left of"))
+ ("to the right of" . ("to the right of")))
+ "Mapping from a boxy relationship to a list of regexes.
+
+Each regex will be tested against the REL property of each
+heading.")
+
;;;; Pretty printing
(cl-defun boxy-headings-pp (box
@@ -310,26 +324,19 @@ diagram."
POS can be nil to use the heading at point.
The default relationship is 'in'."
- (let ((rel (org-entry-get pos "REL")))
- (cond
- ((not rel)
- "in")
- ((string-match-p "on.+top" rel)
- "on top of")
- ((string-match-p "in.+front" rel)
- "in front of")
- ((string-match-p "behind" rel)
- "behind")
- ((string-match-p "above" rel)
- "above")
- ((string-match-p "below" rel)
- "below")
- ((string-match-p "left" rel)
- "to the left of")
- ((string-match-p "right" rel)
- "to the right of")
- (t
- "in"))))
+ (let ((heading-rel (org-entry-get pos "REL")))
+ (if (not heading-rel)
+ "in"
+ (seq-find
+ (lambda (rel)
+ (seq-some
+ (lambda (pattern)
+ (message "Testing pattern %s" pattern)
+ (string-match-p pattern heading-rel))
+ (alist-get rel boxy-headings-rel-alist
+ nil nil #'equal)))
+ boxy-relationships
+ "in"))))
(provide 'boxy-headings)
- [elpa] externals/boxy-headings updated (832aa9b -> be3dac1), ELPA Syncer, 2021/10/15
- [elpa] externals/boxy-headings d88c47e 1/7: Added org 9.3 dependency for emacs 26, ELPA Syncer, 2021/10/15
- [elpa] externals/boxy-headings d54f3e1 2/7: Generalized REL property, ELPA Syncer, 2021/10/15
- [elpa] externals/boxy-headings 8a50fe8 3/7: Added max-visibility option, ELPA Syncer, 2021/10/15
- [elpa] externals/boxy-headings 409fd73 4/7: Refactoring,
ELPA Syncer <=
- [elpa] externals/boxy-headings 9c1d210 5/7: Updated deps, ELPA Syncer, 2021/10/15
- [elpa] externals/boxy-headings 5c40f1a 6/7: Bump version, ELPA Syncer, 2021/10/15
- [elpa] externals/boxy-headings be3dac1 7/7: Merge branch 'next' into 'main', ELPA Syncer, 2021/10/15