[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-real 13502c70e2 018/188: Modified logic to allow mu
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-real 13502c70e2 018/188: Modified logic to allow multiple children |
Date: |
Sun, 5 May 2024 22:55:49 -0400 (EDT) |
branch: externals/org-real
commit 13502c70e2f4428959d5a5feee8f505ea0ca0ef9
Author: Amy Grinn <grinn.amy@gmail.com>
Commit: Amy Grinn <grinn.amy@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 0d44bce543..4a000e3148 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 f7d1775fb8..c165c4626a 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 be394f6e81..d207afb148 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 7e6871d940 164/188: Add ol to autoloads, added autoload plugin to eldev, (continued)
- [elpa] externals/org-real 7e6871d940 164/188: Add ol to autoloads, added autoload plugin to eldev, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real c3c532f9ba 169/188: Added more autoloads, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real d9ec07c0e3 182/188: Updated version, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 2883415acc 185/188: Updated documentation, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 07215e49e7 015/188: Updated README, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 594cbce6d5 092/188: Improved efficiency, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 33b69e62e0 152/188: Added license, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real e7bf6e5089 157/188: Added url-parse, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 4d86ca8c44 160/188: Merge branch 'next' into 'main', ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 1fa40be2c7 006/188: More edge cases, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 13502c70e2 018/188: Modified logic to allow multiple children,
ELPA Syncer <=
- [elpa] externals/org-real e5b21825e3 019/188: Updated preposition list, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real ea82c415f2 003/188: Added primary slot to color last element in url, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 5ae3174c55 001/188: initial commit, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 51bbcc313a 028/188: Cleaned up hooks, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 101d6c9899 034/188: Added org-real-pkg for multifile package, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real d84a2a83f8 046/188: Updated readme, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real b0f741198d 044/188: Rearranging, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 6edfdeca01 049/188: Whitespace cleanup, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real c49cce501d 037/188: Check for compiler warnings in CI/CD pipeline, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real de8dc5a6c9 051/188: Added children when following a link, ELPA Syncer, 2024/05/05