branch: externals/org-real commit d5ca314e5104be0e111b79daea8c963b9c57b2a2 Merge: 3618967 20e80af Author: Tyler Grinn <ty...@tygr.info> Commit: Tyler Grinn <ty...@tygr.info>
Merge branch 'next' into 'main' Bug fixes and improvements * Use buffer name instead of file name for `org-real-headlines` * Updated README * Updated color scheme to react to dark/light background See merge request tygrdev/org-real!10 --- README.org | 40 +++++++------- demo/apply-changes.gif | Bin 753884 -> 452777 bytes demo/edit-link.gif | Bin 791373 -> 476059 bytes demo/garage.org | 2 +- demo/headline-relationships.png | Bin 23455 -> 0 bytes demo/headlines.gif | Bin 0 -> 651736 bytes demo/insert-link-with-completion.gif | Bin 628057 -> 401659 bytes demo/insert-link.gif | Bin 1106614 -> 649381 bytes demo/org-real-mode.gif | Bin 435169 -> 535961 bytes demo/projects.org | 18 +++---- org-real.el | 100 +++++++++++++++++++---------------- 11 files changed, 86 insertions(+), 74 deletions(-) diff --git a/README.org b/README.org index 24edefc..950e0f2 100644 --- a/README.org +++ b/README.org @@ -130,23 +130,10 @@ Keep track of real things as org-mode links. =org-real-apply= with the cursor on top of the new link to apply changes from that link to the buffer. -** Org Real mode - +** Opening links To open a real link, place the cursor within the link and press =C-c C-o=. This will display a popup buffer in Org Real mode - showing the location of the link. Use =S-TAB= to cycle the - visibility level of all children or just =TAB= to toggle the - visibility of children for a single box. - - In the org real diagram, emacs movement keys will navigate by boxes - rather than characters. Each box in the diagram has these options: - - - =RET / mouse-1= Jump to first occurrence of link - - =o= Cycle occurrences of links in other window - - =M-RET= Open all occurences of links by splitting the current window - - =r= Jump to the box directly related to the current box - - [[file:demo/org-real-mode.gif]] + showing the location of the link. ** =org-real-world= @@ -178,11 +165,28 @@ Keep track of real things as org-mode links. - to the right of - to the left of - [[file:demo/headline-relationships.png]] - - The tooltip for each headline shows the values that would be displayed if the org file was in org columns view. + + [[file:demo/headlines.gif]] + +** Org Real mode + + Once in Org Real mode, you can cycle the visibility level of all + children with =S-TAB= or use =TAB= to toggle the visibility of + children for a single box. + + Emacs movement keys will navigate by boxes rather than + characters. Each box in the diagram has these keybindings: + + - =RET / mouse-1= Jump to first occurrence of link + - =o= Cycle occurrences of links in other window + - =M-RET= Open all occurences of links by splitting the current window + - =r= Jump to the box directly related to the current box + - =TAB= expand/collapse children boxes + + [[file:demo/org-real-mode.gif]] + * Development ** Setup diff --git a/demo/apply-changes.gif b/demo/apply-changes.gif index ca91af2..9053d06 100644 Binary files a/demo/apply-changes.gif and b/demo/apply-changes.gif differ diff --git a/demo/edit-link.gif b/demo/edit-link.gif index 2f7c258..e98b4dd 100644 Binary files a/demo/edit-link.gif and b/demo/edit-link.gif differ diff --git a/demo/garage.org b/demo/garage.org index 9cef143..ca2c554 100644 --- a/demo/garage.org +++ b/demo/garage.org @@ -12,6 +12,6 @@ - [[real://garage/workbench/nails?rel=on top of][nails]] - [[real://garage/east wall][East wall]] - [[real://garage/east wall/rake?rel=on/hoe?rel=to the left of/snowblower?rel=above][snowblower]] - - [[real://garage/workbench/hammer?rel=on/screws?rel=to the right of][screws]] + - [[real://garage/workbench/nails?rel=on top of/screws?rel=above][screws]] - [[real://garage/saw?rel=on][saw]] - [[real://garage/workbench/paintbrush?rel=in front of/wrench?rel=to the left of/pliers?rel=below][pliers]] diff --git a/demo/headline-relationships.png b/demo/headline-relationships.png deleted file mode 100644 index 00d22e8..0000000 Binary files a/demo/headline-relationships.png and /dev/null differ diff --git a/demo/headlines.gif b/demo/headlines.gif new file mode 100644 index 0000000..654b588 Binary files /dev/null and b/demo/headlines.gif differ diff --git a/demo/insert-link-with-completion.gif b/demo/insert-link-with-completion.gif index 19d489b..5919ccd 100644 Binary files a/demo/insert-link-with-completion.gif and b/demo/insert-link-with-completion.gif differ diff --git a/demo/insert-link.gif b/demo/insert-link.gif index f5bb53c..fce8ee1 100644 Binary files a/demo/insert-link.gif and b/demo/insert-link.gif differ diff --git a/demo/org-real-mode.gif b/demo/org-real-mode.gif index 9e5ca7e..0a2cc1d 100644 Binary files a/demo/org-real-mode.gif and b/demo/org-real-mode.gif differ diff --git a/demo/projects.org b/demo/projects.org index f5d06ee..7df05a3 100644 --- a/demo/projects.org +++ b/demo/projects.org @@ -1,17 +1,17 @@ #+TITLE: Projects -* Ideas -** Keyboard pants +* Ideas :leisure:tech: +** TODO [#A] Keyboard pants :PROPERTIES: :REL: on top of :END: -** Org real -* Personal -** Banking -** Healthcare -* Work -** Configure emacs -** Install adobe illustrator +** DONE [#B] Org real +* Personal :personal: +** TODO [#C] Banking +** TODO [#C] Healthcare +* Work :work: +** DONE [#A] Configure emacs :productivity: +** DONE [#C] Install adobe illustrator :PROPERTIES: :REL: in front of :END: diff --git a/org-real.el b/org-real.el index 0dd0b57..39e241c 100644 --- a/org-real.el +++ b/org-real.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2021 Free Software Foundation, Inc. ;; Author: Tyler Grinn <tylergr...@gmail.com> -;; Version: 0.4.3 +;; Version: 0.4.4 ;; File: org-real.el ;; Package-Requires: ((emacs "26.1")) ;; Keywords: tools @@ -170,7 +170,8 @@ (face-spec-set 'org-real-primary - '((t :foreground "light slate blue")) + '((((background dark)) (:foreground "turquoise")) + (t (:foreground "dark cyan"))) 'face-defface-spec) (defface org-real-selected nil @@ -1213,50 +1214,52 @@ If INCLUDE-ON-TOP is non-nil, also include height on top of box." (cl-defmethod org-real--create-cursor-function ((box org-real-box)) "Create cursor functions for entering and leaving BOX." - (with-slots (rel rel-box display-rel-box display-rel name metadata help-echo) box + (with-slots + ((actual-rel rel) + (actual-rel-box rel-box) + display-rel-box + display-rel + name + metadata + help-echo) + box (let (tooltip-timer) (lambda (_window _oldpos dir) - (let ((inhibit-read-only t)) - (save-excursion - (if (eq dir 'entered) - (progn - (if (slot-boundp box :help-echo) - (message help-echo)) - (if (slot-boundp box :metadata) - (setq tooltip-timer (org-real--tooltip metadata)) - (if (and (slot-boundp box :name) (slot-boundp box :rel)) - (with-slots ((rel-name name)) (if (slot-boundp box :display-rel-box) - display-rel-box - rel-box) - (setq tooltip-timer - (org-real--tooltip - (with-temp-buffer - (insert (format (concat "The %s " - (if (org-real--is-plural name) "are" "is") - " %s the %s.") - name - (if (slot-boundp box :display-rel) - display-rel - rel) - rel-name)) - (let ((fill-column org-real-tooltip-max-width)) - (fill-paragraph t)) - (buffer-string))))))) - (if (slot-boundp box :display-rel-box) - (if (org-real--is-visible display-rel-box t) - (org-real--draw display-rel-box 'rel)) - (if (and (slot-boundp box :rel-box) - (org-real--is-visible rel-box t)) - (org-real--draw rel-box 'rel))) - (org-real--draw box 'selected)) - (if tooltip-timer (cancel-timer tooltip-timer)) - (if (slot-boundp box :display-rel-box) - (if (org-real--is-visible display-rel-box t) - (org-real--draw display-rel-box t)) - (if (and (slot-boundp box :rel-box) - (org-real--is-visible rel-box t)) - (org-real--draw rel-box t))) - (org-real--draw box t)))))))) + (let* ((rel-box (and (slot-boundp box :rel-box) + (if (slot-boundp box :display-rel-box) + display-rel-box + actual-rel-box))) + (visible-rel-box rel-box)) + (while (and visible-rel-box (not (org-real--is-visible visible-rel-box t))) + (setq visible-rel-box (with-slots (parent) visible-rel-box parent))) + (when (eq dir 'entered) + (save-excursion + (let ((inhibit-read-only t)) + (if visible-rel-box (org-real--draw visible-rel-box 'rel)) + (org-real--draw box 'selected))) + (if (slot-boundp box :help-echo) (message help-echo)) + (if (slot-boundp box :metadata) + (setq tooltip-timer (org-real--tooltip metadata)) + (if (and (slot-boundp box :name) rel-box) + (let ((rel-name (with-slots (name) rel-box name)) + (rel (if (slot-boundp box :display-rel) display-rel actual-rel))) + (setq tooltip-timer + (org-real--tooltip + (with-temp-buffer + (insert (format + (concat "The %s " + (if (org-real--is-plural name) "are" "is") + " %s the %s.") + name rel rel-name)) + (let ((fill-column org-real-tooltip-max-width)) + (fill-paragraph t)) + (buffer-string)))))))) + (when (eq dir 'left) + (save-excursion + (let ((inhibit-read-only t)) + (if visible-rel-box (org-real--draw visible-rel-box t)) + (org-real--draw box t))) + (if tooltip-timer (cancel-timer tooltip-timer)))))))) (cl-defmethod org-real--jump-other-window ((box org-real-box)) "Jump to location of link for BOX in other window." @@ -1392,7 +1395,6 @@ If FORCE-VISIBLE, always make CHILD visible in PARENT." (if (slot-boundp box :height) (slot-makeunbound box :height)) (mapc 'org-real--make-dirty (org-real--get-children box 'all))) -;; TODO check if `eq' works (cl-defmethod org-real--next ((box org-real-box) &optional exclude-children) "Retrieve any boxes for which the :rel-box slot is BOX. @@ -1531,11 +1533,17 @@ NEXT." rel-box extra-data flex + display-rel-box (next-level level) (next-behind behind) (next-in-front in-front) (next-on-top on-top)) next + (if (slot-boundp next :display-rel-box) + (setq display-rel-box + (org-real--find-matching + display-rel-box + (org-real--get-world prev)))) (let* ((next-boxes (org-real--next next)) (partitioned (seq-group-by (lambda (next-next) @@ -1955,7 +1963,7 @@ set to the :loc slot of each box." "Create an org real box from the current buffer's headlines." (org-columns-get-format) (let* ((headlines (cddr (org-element-parse-buffer 'headline))) - (filename (buffer-file-name)) + (filename (buffer-name)) (title (or (concat (file-name-base filename) "." (file-name-extension filename)) "Document")) (world (org-real-box))