[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-real 9ea4553 018/160: Modified logic to allow multi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-real 9ea4553 018/160: Modified logic to allow multiple children |
Date: |
Wed, 6 Oct 2021 16:58:06 -0400 (EDT) |
branch: externals/org-real
commit 9ea4553ebc79c5333e4fe6f6a3ed7af9df922455
Author: Tyler Grinn <tylergrinn@gmail.com>
Commit: Tyler Grinn <tylergrinn@gmail.com>
Modified logic to allow multiple children
---
README.org | 6 ++--
garage.org | 1 +
org-real.el | 102 +++++++++++++++++++++++++++++++++++-------------------------
3 files changed, 62 insertions(+), 47 deletions(-)
diff --git a/README.org b/README.org
index 0d44bce..4a000e3 100644
--- a/README.org
+++ b/README.org
@@ -7,9 +7,7 @@ Keep track of real things as org links.
:straight (org-real :type git :host gitlab :repo "tygrdev/org-real"))
#+end_src
-* Status *PARTIALLY WORKING*
- - TODO Allow things to have multiple children with the same preposition
- - TODO =org-real-world= flex layout sometimes draws over existing boxes
+* Status *ALPHA*
- TODO Ask to replace all occurences after editing a link
* Usage
@@ -78,7 +76,7 @@ Keep track of real things as org links.
[[file:demo/open-link.gif]]
-** =org-real-world= (expirimental)
+** =org-real-world=
To view all real links in the current buffer in a combined diagram,
use the interactive function =org-real-world=
diff --git a/garage.org b/garage.org
index f7d1775..c165c46 100644
--- a/garage.org
+++ b/garage.org
@@ -8,3 +8,4 @@
-
[[real://garage/workbench?rel=in/wrench?rel=on/paintbrush?rel=above][paintbrush]]
- [[real://garage/workbench?rel=in/ratchet?rel=on/hammer?rel=to the right
of][hammer]]
- [[real://garage/workbench?rel=in/ratchet?rel=on/nails?rel=to the right
of][nails]]
+ - [[real://garage/car?rel=in/air freshener?rel=in][air freshener]]
diff --git a/org-real.el b/org-real.el
index be394f6..d207afb 100644
--- a/org-real.el
+++ b/org-real.el
@@ -557,52 +557,60 @@ OFFSET is the starting line to start insertion."
(children (oref box :children)))
(if (not children)
width
- (let ((rows '()))
- (mapc
- (lambda (child)
- (add-to-list 'rows (oref child :y-order)))
- children)
- (let ((child-widths (mapcar
- (lambda (row)
- (+ base-width
- (seq-reduce
- (lambda (sum child) (+ sum
- (car
org-real--padding)
- (org-real--get-width
child)))
- (seq-filter
- (lambda (child) (= row (oref child
:y-order)))
- children)
- (* -1 (car org-real--padding)))))
- rows)))
- (apply 'max width child-widths))))))
+ (let* ((column-indices (seq-reduce
+ (lambda (columns child)
+ (add-to-list 'columns (oref child :x-order)))
+ children
+ '()))
+ (columns (mapcar
+ (lambda (c)
+ (seq-filter
+ (lambda (child)
+ (= c (oref child :x-order)))
+ children))
+ column-indices))
+ (column-widths (mapcar
+ (lambda (column)
+ (apply 'max (mapcar 'org-real--get-width
column)))
+ columns))
+ (children-width (seq-reduce
+ (lambda (total width)
+ (+ total (car org-real--margin) width))
+ column-widths
+ (* -1 (car org-real--margin)))))
+ (if (> width children-width)
+ width
+ (+ base-width children-width))))))
(defun org-real--get-height (box)
"Get the height of BOX."
- (let ((height (+ (if (oref box :in-front)
- (* -1 (cdr org-real--margin))
- 0)
- 2 ; box walls
- (* 2 (cdr org-real--padding))
- (cdr org-real--margin)))
- (children (oref box :children))
- (in-front (oref box :in-front)))
+ (let* ((in-front (oref box :in-front))
+ (height (+ (if in-front
+ (* -1 (cdr org-real--margin))
+ 0)
+ 2 ; box walls
+ (* 2 (cdr org-real--padding))
+ (cdr org-real--margin)))
+ (children (oref box :children)))
(if (not children)
height
- (let ((columns '()))
- (mapc
- (lambda (child) (add-to-list 'columns (oref child :x-order)))
- children)
- (let ((child-heights (mapcar
- (lambda (col)
- (+ height
- (seq-reduce
- (lambda (sum child) (+ sum
(org-real--get-height child)))
- (seq-filter
- (lambda (child) (= col (oref child
:x-order)))
- children)
- 0)))
- columns)))
- (apply 'max height child-heights))))))
+ (let* ((row-indices (seq-reduce
+ (lambda (rows child)
+ (add-to-list 'rows (oref child :y-order)))
+ children
+ '()))
+ (rows (mapcar
+ (lambda (r)
+ (seq-filter
+ (lambda (child)
+ (= r (oref child :y-order)))
+ children))
+ row-indices))
+ (row-heights (mapcar
+ (lambda (row)
+ (apply 'max (mapcar 'org-real--get-height row)))
+ rows)))
+ (+ height (seq-reduce '+ row-heights 0))))))
(defun org-real--get-top (box)
"Get the top row index of BOX."
@@ -623,10 +631,18 @@ OFFSET is the starting line to start insertion."
child
max))
above
- (org-real--box :y-order -9999)))))
+ (org-real--box :y-order -9999))))
+ (above-height (and directly-above (apply 'max
+ (mapcar
+ 'org-real--get-height
+ (seq-filter
+ (lambda (child)
+ (= (oref
directly-above :y-order)
+ (oref child
:y-order)))
+ (oref parent
:children)))))))
(if directly-above
(+ (org-real--get-top directly-above)
- (org-real--get-height directly-above))
+ above-height)
(if (and (slot-boundp box :rel)
(or (string= "to the left of" (oref box :rel))
(string= "to the right of" (oref box :rel))))
- [elpa] externals/org-real d5ca314 146/160: Merge branch 'next' into 'main', (continued)
- [elpa] externals/org-real d5ca314 146/160: Merge branch 'next' into 'main', ELPA Syncer, 2021/10/06
- [elpa] externals/org-real dab4fc9 154/160: Updated readme, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 497ea6c 152/160: Added license, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 2ee4b19 006/160: More edge cases, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 8b3b5c2 005/160: org-real--merge and org-real-world, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 883497d 009/160: Use .el file instead of .tar in release job, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real e039322 012/160: Add new line after pp text, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real d557262 011/160: Switched to before and after advice for advising `org-insert-link', ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 1fa4417 015/160: Updated README, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real dfcddef 013/160: Added more documentation, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 9ea4553 018/160: Modified logic to allow multiple children,
ELPA Syncer <=
- [elpa] externals/org-real a909323 017/160: Shift other things to the right or below when merging, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 6fcc3b9 031/160: Updated md5 command to see tar files, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real d07bf14 020/160: find-last index returns nil if no match, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real a16fed2 032/160: Linting, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 9608f53 030/160: Satisfying elc compiler, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real dbd7b45 037/160: Check for compiler warnings in CI/CD pipeline, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 463da8b 029/160: Refactoring, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 6d8351f 038/160: Renamed org-real--box to org-real-box, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 4a569a1 039/160: Merge branch 'next' into 'main', ELPA Syncer, 2021/10/06
- [elpa] externals/org-real d161250 041/160: Removed reference to org-real-box, ELPA Syncer, 2021/10/06