[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-real 623103b507 108/188: Skip adding box if it alre
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-real 623103b507 108/188: Skip adding box if it already exists |
Date: |
Sun, 5 May 2024 22:55:59 -0400 (EDT) |
branch: externals/org-real
commit 623103b50739be11855de2c660a3e1a2298161eb
Author: Amy Grinn <grinn.amy@gmail.com>
Commit: Amy Grinn <grinn.amy@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 6fcceaabfe..f5cba37a3f 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 1d6e6054db 032/188: Linting, (continued)
- [elpa] externals/org-real 1d6e6054db 032/188: Linting, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 3a43ff3d2f 063/188: Satisfy elc compiler, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real b776aa7f67 064/188: Updated readme, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 902b7a6c08 068/188: Using infinity, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 36cdd58d63 070/188: Created buttons that link back to the location of the link, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real dbecf17555 075/188: Added ability to cycle children of a box, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 930333911f 080/188: Updated readme, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 00e4a4c595 096/188: Rotate locations of box when cycling, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 59236092f7 097/188: Show all containers while completing, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real c93e380141 101/188: Merge branch 'next' into 'main', ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 623103b507 108/188: Skip adding box if it already exists,
ELPA Syncer <=
- [elpa] externals/org-real badabb5c40 100/188: Added org mode keybindings suggestions, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 25cad71080 114/188: Removed popup.el dependency, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 3e372c02d7 121/188: Use cartesian distance for cycle up/down, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 11ed5a92a5 109/188: Linting, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 31a19bb0d5 113/188: Added more customization vars, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 115f7024f1 120/188: Added calculate functionality to is-visible, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 641dead241 135/188: Typo in jumping to rel box, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real f589e667d6 143/188: Use buffer name instead of buffer-file-name for org-real-headlines, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 5acd2b0a28 150/188: Linting, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real ecaee4809a 147/188: Added boxy dependency, ELPA Syncer, 2024/05/05