[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-real 5fb78c3 108/160: Skip adding box if it already
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-real 5fb78c3 108/160: Skip adding box if it already exists |
Date: |
Wed, 6 Oct 2021 16:58:26 -0400 (EDT) |
branch: externals/org-real
commit 5fb78c3a7916760f8123b3b842b357bbb43afb5c
Author: Tyler Grinn <tylergrinn@gmail.com>
Commit: Tyler Grinn <tylergrinn@gmail.com>
Skip adding box if it already exists
---
org-real.el | 183 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 92 insertions(+), 91 deletions(-)
diff --git a/org-real.el b/org-real.el
index 6fcceaa..f5cba37 100644
--- a/org-real.el
+++ b/org-real.el
@@ -518,24 +518,22 @@ visibility."
(box (org-real--make-instance 'org-real-box (copy-tree containers))))
(if org-real-include-context
(let* ((primary-name (plist-get (car (reverse containers)) :name))
- (context (mapcar
- (lambda (containers)
- (org-real--make-instance 'org-real-box containers
t))
- (cl-delete-duplicates
- (seq-filter
- (lambda (containers)
- (let ((rel-containers (reverse containers)))
- (pop rel-containers) ;; Exclude copies of the
same thing
- (seq-some
- (lambda (rel-container)
- (string= primary-name (plist-get
rel-container :name)))
- rel-containers)))
- (org-real--parse-buffer))
- :test #'string=
- :key (lambda (containers) (plist-get (nth (- (length
containers) 1)
- containers)
- :name))))))
- (setq box (org-real--merge (push box context)))))
+ (container-matrix (seq-filter
+ (lambda (containers)
+ (let ((rel-containers (reverse
containers)))
+ (pop rel-containers) ;; Exclude copies
of the same thing
+ (seq-some
+ (lambda (rel-container)
+ (string= primary-name (plist-get
rel-container :name)))
+ rel-containers)))
+ (org-real--parse-buffer)))
+ (context-boxes (mapcar
+ (lambda (containers)
+ (org-real--make-instance 'org-real-box
containers t))
+ container-matrix)))
+ (mapc
+ (lambda (context) (org-real--merge-into context box))
+ context-boxes)))
(org-real--pp box (copy-tree containers) nil nil 0)))
(defun org-real-complete (&optional existing)
@@ -1237,7 +1235,7 @@ If FORCE-VISIBLE, always make CHILD visible in PARENT."
(cl-defmethod org-real--expand ((box org-real-box))
"Get a list of all boxes, including BOX, that are children of BOX."
(if (slot-boundp box :parent)
- (apply 'append (list box) (mapcar 'org-real--expand
(org-real--get-children box 'all)))
+ (apply 'append (list box) (mapcar 'org-real--expand (org-real--next
box)))
(apply 'append (mapcar 'org-real--expand (org-real--get-children box
'all)))))
(cl-defmethod org-real--make-dirty ((box org-real-box))
@@ -1397,9 +1395,7 @@ PREV must already exist in PARENT."
(with-slots (locations) box locations)))
(let ((world (org-real--get-world match)))
(mapc
- (lambda (next)
- (if (not (org-real--find-matching next world))
- (org-real--add-next next match)))
+ (lambda (next) (org-real--add-next next match))
(org-real--next box))))
(cl-defmethod org-real--merge-into ((from org-real-box) (to org-real-box))
@@ -1462,76 +1458,81 @@ If FORCE-VISIBLE, show the box regardless of
next-boxes))
(children-boxes (alist-get 'children partitioned))
(sibling-boxes (alist-get 'siblings partitioned)))
- (setq extra-data partitioned)
- (cond
- ((member rel '("to the left of" "to the right of"))
- (setq next-level prev-level)
- (setq next-y prev-y)
- (setq next-behind prev-behind)
- (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)))
- (org-real--get-children parent 'all))))
+ (if-let ((match (org-real--find-matching next prev)))
(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 prev-x)
- (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))))
- (org-real--get-children parent 'all)))))
- (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
- (mapcar
- (lambda (child) (with-slots (x-order)
child x-order))
- (seq-filter
- (lambda (child)
- (with-slots (in-front on-top) child
- (and (eq next-in-front in-front)
- (eq next-on-top on-top))))
- (org-real--get-children prev 'all))))))
- (setq next-behind prev-behind))
- ((member rel '("in" "on" "behind"))
- (setq next-level (+ 1 prev-level))
- (setq next-behind prev-behind)))
- (if (not (slot-boundp next :name)) (setq next-level 0))
- (oset next :rel-box prev)
- (if (member rel org-real-children-prepositions)
- (if (member rel org-real-flex-prepositions)
- (org-real--flex-add next prev)
- (org-real--add-child prev next force-visible))
- (org-real--add-child parent next force-visible))
- (if children-boxes
- (oset next :expand-children
- '(lambda (box)
- (mapc
- (lambda (child) (org-real--add-next child box))
- (alist-get 'children (oref box :extra-data))))))
- (if sibling-boxes
- (oset next :expand-siblings
- '(lambda (box)
- (mapc
- (lambda (sibling) (org-real--add-next sibling box t))
- (alist-get 'siblings (oref box :extra-data))))))))))
+ (lambda (next-next)
+ (org-real--add-next next-next match))
+ (org-real--next next))
+ (setq extra-data partitioned)
+ (cond
+ ((member rel '("to the left of" "to the right of"))
+ (setq next-level prev-level)
+ (setq next-y prev-y)
+ (setq next-behind prev-behind)
+ (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)))
+ (org-real--get-children parent 'all))))
+ (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 prev-x)
+ (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))))
+ (org-real--get-children parent 'all)))))
+ (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
+ (mapcar
+ (lambda (child) (with-slots (x-order)
child x-order))
+ (seq-filter
+ (lambda (child)
+ (with-slots (in-front on-top) child
+ (and (eq next-in-front in-front)
+ (eq next-on-top on-top))))
+ (org-real--get-children prev 'all))))))
+ (setq next-behind prev-behind))
+ ((member rel '("in" "on" "behind"))
+ (setq next-level (+ 1 prev-level))
+ (setq next-behind prev-behind)))
+ (if (not (slot-boundp next :name)) (setq next-level 0))
+ (oset next :rel-box prev)
+ (if (member rel org-real-children-prepositions)
+ (if (member rel org-real-flex-prepositions)
+ (org-real--flex-add next prev)
+ (org-real--add-child prev next force-visible))
+ (org-real--add-child parent next force-visible))
+ (if children-boxes
+ (oset next :expand-children
+ '(lambda (box)
+ (mapc
+ (lambda (child) (org-real--add-next child box))
+ (alist-get 'children (oref box :extra-data))))))
+ (if sibling-boxes
+ (oset next :expand-siblings
+ '(lambda (box)
+ (mapc
+ (lambda (sibling) (org-real--add-next sibling box t))
+ (alist-get 'siblings (oref box :extra-data)))))))))))
(cl-defmethod org-real--flex-add ((box org-real-box)
(parent org-real-box))
- [elpa] externals/org-real 19711cb 159/160: Updated elpaignore, (continued)
- [elpa] externals/org-real 19711cb 159/160: Updated elpaignore, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real af8744b 151/160: Removed `org-real-headlines`, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real d95d469 156/160: Changed cl-defmethod to defun; linting, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 80799f6 150/160: Linting, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 791ed99 157/160: Added url-parse, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 0d25274 084/160: Passing edge cases, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 8f7ef62 085/160: Updated readme, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 87dfecc 081/160: Org real headlines switched to add-next, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real e0d81ab 098/160: Bump version, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real a8e336d 095/160: Typo in flex-adjust, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 5fb78c3 108/160: Skip adding box if it already exists,
ELPA Syncer <=
- [elpa] externals/org-real 900f96a 129/160: Added is-plural, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real fb056dc 078/160: Reuse window if org real diagram already visible, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 4cc110c 086/160: Added document container to org-real-headlines, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 4246089 096/160: Rotate locations of box when cycling, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 193f14d 138/160: Refactoring, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 7e51167 128/160: Linting/documentation, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 0c93bd8 141/160: Updated readme, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 186830b 060/160: Detect return and backspace without gui, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real f80251e 116/160: Merge branch 'next' into 'main', ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 20d9631 147/160: Added boxy dependency, ELPA Syncer, 2021/10/06