[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-real 378806b 092/160: Improved efficiency
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-real 378806b 092/160: Improved efficiency |
Date: |
Wed, 6 Oct 2021 16:58:23 -0400 (EDT) |
branch: externals/org-real
commit 378806be287bc328d2c9432399a69f190629b91b
Author: Tyler Grinn <tylergrinn@gmail.com>
Commit: Tyler Grinn <tylergrinn@gmail.com>
Improved efficiency
---
org-real.el | 235 +++++++++++++++++++++++++++++-------------------------------
1 file changed, 112 insertions(+), 123 deletions(-)
diff --git a/org-real.el b/org-real.el
index 58df93d..0e99900 100644
--- a/org-real.el
+++ b/org-real.el
@@ -1006,98 +1006,97 @@ PREV must already exist in PARENT."
(prev-in-front in-front))
prev
(with-slots ((siblings children) (hidden-siblings hidden-children))
parent
- (let (sibling-y-orders row-siblings)
+ (cond
+ ((or (string= rel "in") (string= rel "on"))
+ (setq cur-level (+ 1 prev-level))
+ (setq cur-behind prev-behind))
+ ((string= rel "behind")
+ (setq cur-level (+ 1 prev-level))
+ (setq cur-behind t))
+ ((string= rel "in front of")
+ (setq cur-level (+ 1 prev-level))
+ (setq cur-y 1.0e+INF)
+ (setq cur-behind prev-behind)
+ (setq cur-in-front t))
+ ((string= rel "on top of")
+ (setq cur-level (+ 1 prev-level))
+ (setq cur-y -1.0e+INF)
+ (setq cur-behind prev-behind)
+ (setq cur-on-top t))
+ ((member rel '("above" "below"))
+ (setq cur-behind prev-behind)
+ (setq cur-x prev-x)
(cond
- ((or (string= rel "in") (string= rel "on"))
- (setq cur-level (+ 1 prev-level))
- (setq cur-behind prev-behind))
- ((string= rel "behind")
- (setq cur-level (+ 1 prev-level))
- (setq cur-behind t))
- ((string= rel "in front of")
- (setq cur-level (+ 1 prev-level))
- (setq cur-y 1.0e+INF)
- (setq cur-behind prev-behind)
- (setq cur-in-front t))
- ((string= rel "on top of")
- (setq cur-level (+ 1 prev-level))
- (setq cur-y -1.0e+INF)
- (setq cur-behind prev-behind)
- (setq cur-on-top t))
- ((member rel '("above" "below"))
- (setq cur-behind prev-behind)
- (setq cur-x prev-x)
- (cond
- ((and prev-in-front (string= rel "below"))
- (while (with-slots (in-front) prev in-front)
- (setq prev (with-slots (parent) prev parent)))
- (setq parent (with-slots (parent) prev parent)))
- ((and prev-on-top (string= rel "above"))
- (while (with-slots (on-top) prev on-top)
- (setq prev (with-slots (parent) prev parent)))
- (setq parent (with-slots (parent) prev parent)))
- ((and prev-on-top (string= rel "below"))
- (setq rel "in")
- (setq prev parent)))
- (setq cur-level (+ 1 (with-slots (level) parent level)))
- (setq sibling-y-orders
- (with-slots ((siblings children) (hidden-siblings
hidden-children)) parent
- (mapcar
- (lambda (sibling) (with-slots (y-order) sibling
y-order))
- (seq-filter
- (lambda (sibling)
- (with-slots (in-front on-top) sibling
- (not (or in-front on-top))))
- (append (org-real--get-all siblings)
- (org-real--get-all hidden-siblings))))))
+ ((and prev-in-front (string= rel "below"))
+ (while (with-slots (in-front) prev in-front)
+ (setq prev (with-slots (parent) prev parent)))
+ (setq parent (with-slots (parent) prev parent)))
+ ((and prev-on-top (string= rel "above"))
+ (while (with-slots (on-top) prev on-top)
+ (setq prev (with-slots (parent) prev parent)))
+ (setq parent (with-slots (parent) prev parent)))
+ ((and prev-on-top (string= rel "below"))
+ (setq rel "in")
+ (setq prev parent)))
+ (setq cur-level (+ 1 (with-slots (level) parent level)))
+ (let ((sibling-y-orders
+ (with-slots ((siblings children) (hidden-siblings
hidden-children)) parent
+ (mapcar
+ (lambda (sibling) (with-slots (y-order) sibling
y-order))
+ (seq-filter
+ (lambda (sibling)
+ (with-slots (in-front on-top) sibling
+ (not (or in-front on-top))))
+ (append (org-real--get-all siblings)
+ (org-real--get-all hidden-siblings)))))))
(if (or prev-on-top (string= rel "above"))
(setq cur-y (- (apply 'min 0 sibling-y-orders) 1))
- (setq cur-y (+ 1 (apply 'max 0 sibling-y-orders)))))
- ((member rel '("to the left of" "to the right of"))
- (setq row-siblings (seq-filter
- (lambda (sibling)
- (with-slots (y-order) sibling
- (= prev-y y-order)))
- (append (org-real--get-all siblings)
- (org-real--get-all
hidden-siblings))))
- (setq cur-level prev-level)
- (setq cur-y prev-y)
- (setq cur-behind prev-behind)
- (setq cur-on-top prev-on-top)
- (setq cur-in-front prev-in-front)
- (if (string= rel "to the left of")
- (setq cur-x prev-x)
- (setq cur-x (+ 1 prev-x)))
+ (setq cur-y (+ 1 (apply 'max 0 sibling-y-orders))))))
+ ((member rel '("to the left of" "to the right of"))
+ (setq cur-level prev-level)
+ (setq cur-y prev-y)
+ (setq cur-behind prev-behind)
+ (setq cur-on-top prev-on-top)
+ (setq cur-in-front prev-in-front)
+ (if (string= rel "to the left of")
+ (setq cur-x prev-x)
+ (setq cur-x (+ 1 prev-x)))
+ (let ((row-siblings (seq-filter
+ (lambda (sibling)
+ (with-slots (y-order) sibling
+ (= prev-y y-order)))
+ (append (org-real--get-all siblings)
+ (org-real--get-all
hidden-siblings)))))
(mapc
(lambda (sibling)
(with-slots (x-order) sibling
(if (>= x-order cur-x)
(setq x-order (+ 1 x-order)))))
- row-siblings)))
- (oset box :rel-box prev)
- (oset box :rel rel)
- (if (not (slot-boundp box :name)) (setq cur-level 0))
- (let ((visible (or (= 0 org-real--visibility) (<= cur-level
org-real--visibility))))
- (if (and prev (member rel '("in" "on" "behind" "in front of"
"on top of")))
- (progn
- (oset box :parent prev)
- (if visible
- (with-slots (children) prev
- (setq children (org-real--push children box)))
- (with-slots (hidden-children) prev
- (setq hidden-children (org-real--push
hidden-children box))))
+ row-siblings))))
+ (oset box :rel-box prev)
+ (oset box :rel rel)
+ (if (not (slot-boundp box :name)) (setq cur-level 0))
+ (let ((visible (or (= 0 org-real--visibility) (<= cur-level
org-real--visibility))))
+ (if (and prev (member rel '("in" "on" "behind" "in front of" "on
top of")))
+ (progn
+ (oset box :parent prev)
+ (if visible
+ (with-slots (children) prev
+ (setq children (org-real--push children box)))
+ (with-slots (hidden-children) prev
+ (setq hidden-children (org-real--push hidden-children
box))))
(if containers
(org-real--make-instance-helper containers prev box
skip-primary)
(unless skip-primary (oset box :primary t))))
- (oset box :parent parent)
- (if visible
- (with-slots (children) parent
- (setq children (org-real--push children box)))
- (with-slots (hidden-children) parent
- (setq hidden-children (org-real--push hidden-children
box))))
- (if containers
- (org-real--make-instance-helper containers parent box
skip-primary)
- (unless skip-primary (oset box :primary t)))))))))))
+ (oset box :parent parent)
+ (if visible
+ (with-slots (children) parent
+ (setq children (org-real--push children box)))
+ (with-slots (hidden-children) parent
+ (setq hidden-children (org-real--push hidden-children
box))))
+ (if containers
+ (org-real--make-instance-helper containers parent box
skip-primary)
+ (unless skip-primary (oset box :primary t))))))))))
(cl-defmethod org-real--get-world ((box org-real-box))
"Get the top most box related to BOX."
@@ -1210,54 +1209,44 @@ of BOX."
(next-in-front in-front)
(next-on-top on-top))
next
- (let* ((next-boxes (org-real--next next))
- (all-siblings (append (org-real--get-all siblings)
- (org-real--get-all hidden-siblings)))
- (row-siblings (seq-filter
- (lambda (sibling)
- (with-slots (y-order) sibling
- (= y-order prev-y)))
- all-siblings))
- (sibling-y-orders (mapcar
- (lambda (sibling) (with-slots (y-order)
sibling y-order))
- (seq-filter
- (lambda (sibling)
- (with-slots (in-front on-top) sibling
- (not (or in-front on-top))))
- all-siblings))))
+ (let ((next-boxes (org-real--next next)))
(cond
- ((string= rel "to the left of")
+ ((member rel '("to the left of" "to the right of"))
(setq next-level prev-level)
- (setq next-x prev-x)
(setq next-y prev-y)
(setq next-behind prev-behind)
- (mapc
- (lambda (sibling)
- (with-slots (x-order) sibling
- (if (>= x-order next-x)
- (setq x-order (+ 1 x-order)))))
- row-siblings))
- ((string= rel "to the right of")
+ (setq next-in-front prev-in-front)
+ (setq next-on-top prev-on-top)
+ (if (string= rel "to the left of")
+ (setq next-x prev-x)
+ (setq next-x (+ 1 prev-x)))
+ (let ((row-siblings (seq-filter
+ (lambda (sibling)
+ (with-slots (y-order) sibling
+ (= y-order prev-y)))
+ (append (org-real--get-all siblings)
+ (org-real--get-all
hidden-siblings)))))
+ (mapc
+ (lambda (sibling)
+ (with-slots (x-order) sibling
+ (if (>= x-order next-x)
+ (setq x-order (+ 1 x-order)))))
+ row-siblings)))
+ ((member rel '("above" "below"))
(setq next-level prev-level)
- (setq next-x (+ 1 prev-x))
- (setq next-y prev-y)
- (setq next-behind prev-behind)
- (mapc
- (lambda (sibling)
- (with-slots (x-order) sibling
- (if (>= x-order next-x)
- (setq x-order (+ 1 x-order)))))
- row-siblings))
- ((string= rel "above")
- (setq next-level prev-level)
- (setq next-y (- (apply 'min 0 sibling-y-orders) 1))
- (setq next-x prev-x)
- (setq next-behind prev-behind))
- ((string= rel "below")
- (setq next-level prev-level)
- (setq next-y (+ 1 (apply 'max 0 sibling-y-orders)))
(setq next-x prev-x)
- (setq next-behind prev-behind))
+ (setq next-behind prev-behind)
+ (let ((sibling-y-orders (mapcar
+ (lambda (sibling) (with-slots (y-order)
sibling y-order))
+ (seq-filter
+ (lambda (sibling)
+ (with-slots (in-front on-top) sibling
+ (not (or in-front on-top))))
+ (append (org-real--get-all siblings)
+ (org-real--get-all
hidden-siblings))))))
+ (if (string= rel "above")
+ (setq next-y (- (apply 'min 0 sibling-y-orders) 1))
+ (setq next-y (+ 1 (apply 'max 0 sibling-y-orders))))))
((or next-on-top next-in-front)
(setq next-level (+ 1 prev-level))
(setq next-x (+ 1 (apply 'max 0
- [elpa] externals/org-real 91b96a1 057/160: Renamed org-real-include-children to org-real-include-context, (continued)
- [elpa] externals/org-real 91b96a1 057/160: Renamed org-real-include-children to org-real-include-context, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 35aa1c1 062/160: Updated readme, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 43f349e 067/160: Typos, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real baf5c9b 072/160: Updated documentation, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real bc2c7ea 068/160: Using infinity, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real c37d17c 073/160: Bump version, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real e0109e8 079/160: Typo, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 106063e 077/160: Complete redesign, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 573df43 087/160: Removed reference to org-collect-keywords, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 0cb9745 082/160: Satisfying elc compiler, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 378806b 092/160: Improved efficiency,
ELPA Syncer <=
- [elpa] externals/org-real a30638a 097/160: Show all containers while completing, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 7f89820 094/160: Added expansion slots to speed up initial rendering, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real f3b5fc7 099/160: More edge cases, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 009dd3e 107/160: Added popup library, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 9554940 135/160: Typo in jumping to rel box, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 878480b 134/160: Merge branch 'main' into next, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 26ade6a 136/160: Bump version, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 44e82f9 120/160: Added calculate functionality to is-visible, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real c916d88 142/160: Draw selected box last, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 3618967 137/160: Merge branch 'next' into 'main', ELPA Syncer, 2021/10/06