[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-real 4246089 096/160: Rotate locations of box when
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-real 4246089 096/160: Rotate locations of box when cycling |
Date: |
Wed, 6 Oct 2021 16:58:23 -0400 (EDT) |
branch: externals/org-real
commit 42460896ae2b8aeeda2895ddaff22873a4e60965
Author: Tyler Grinn <tylergrinn@gmail.com>
Commit: Tyler Grinn <tylergrinn@gmail.com>
Rotate locations of box when cycling
Now, pressing enter on a box will take you to the last location that
was cycled using `o`
---
org-real.el | 71 +++++++++++++++++++++++++++++++------------------------------
1 file changed, 36 insertions(+), 35 deletions(-)
diff --git a/org-real.el b/org-real.el
index f3f1635..7980f24 100644
--- a/org-real.el
+++ b/org-real.el
@@ -1531,48 +1531,49 @@ characters if possible."
;;;; Org real mode buttons
-(defun org-real--jump-other-window (markers)
- "Jump to location of link in other window.
-
-MARKERS is a list of locations of each button in the buffer."
- (let ((i 0))
+(defun org-real--jump-other-window (box)
+ "Jump to location of link for BOX in other window."
+ (with-slots (locations) box
(lambda ()
(interactive)
- (let* ((marker (nth i markers))
+ (let ((first (car locations)))
+ (object-remove-from-list box :locations first)
+ (object-add-to-list box :locations first t))
+ (let* ((marker (car locations))
(buffer (marker-buffer marker))
(pos (marker-position marker)))
(save-selected-window
(switch-to-buffer-other-window buffer)
- (goto-char pos))
- (setq i (mod (+ 1 i) (length markers)))))))
-
-(defun org-real--jump-to (marker)
- "Jump to the first occurrence of a link in the same window.
+ (goto-char pos))))))
-MARKER is the position of the first occurrence of the link."
- (let ((buffer (marker-buffer marker)))
+(defun org-real--jump-to (box)
+ "Jump to the first occurrence of a link for BOX in the same window."
+ (with-slots (locations) box
(lambda ()
(interactive)
- (if-let ((window (get-buffer-window buffer)))
- (select-window window)
- (switch-to-buffer buffer))
- (goto-char (marker-position marker)))))
-
-(defun org-real--jump-all (markers)
- "View all occurrences of a link in the same window.
+ (let* ((marker (car locations))
+ (buffer (marker-buffer marker))
+ (pos (marker-position marker)))
+ (if-let ((window (get-buffer-window buffer)))
+ (select-window window)
+ (switch-to-buffer buffer))
+ (goto-char pos)))))
-MARKERS is the list of positions of the link."
- (lambda ()
- (interactive)
- (let ((size (/ (window-height) (length markers))))
- (or (<= window-min-height size)
- (error "To many buffers to visit simultaneously"))
- (switch-to-buffer (marker-buffer (car markers)))
- (goto-char (marker-position (car markers)))
- (dolist (marker (cdr markers))
- (select-window (split-window nil size))
+(defun org-real--jump-all (box)
+ "View all occurrences of links from BOX in the same window."
+ (with-slots (locations) box
+ (lambda ()
+ (interactive)
+ (let* ((size (/ (window-height) (length locations)))
+ (marker (car locations)))
+ (or (<= window-min-height size)
+ (error "To many buffers to visit simultaneously"))
(switch-to-buffer (marker-buffer marker))
- (goto-char (marker-position marker))))))
+ (goto-char (marker-position marker))
+ (dolist (marker (cdr locations))
+ (select-window (split-window nil size))
+ (switch-to-buffer (marker-buffer marker))
+ (goto-char (marker-position marker)))))))
(cl-defmethod org-real--create-button-keymap ((box org-real-box))
"Create a keymap for a button in Org Real mode.
@@ -1583,10 +1584,10 @@ BOX is the box the button is being made for."
(mapcar
(lambda (key) (cons (kbd (car key)) (cdr key)))
`(("TAB" . ,(org-real--cycle-children box))
- ("o" . ,(org-real--jump-other-window locations))
- ("<mouse-1>" . ,(org-real--jump-to (car locations)))
- ("RET" . ,(org-real--jump-to (car locations)))
- ("M-RET" . ,(org-real--jump-all locations)))))))
+ ("o" . ,(org-real--jump-other-window box))
+ ("<mouse-1>" . ,(org-real--jump-to box))
+ ("RET" . ,(org-real--jump-to box))
+ ("M-RET" . ,(org-real--jump-all box)))))))
;;;; Utility expressions
- [elpa] externals/org-real 791ed99 157/160: Added url-parse, (continued)
- [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, 2021/10/06
- [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 <=
- [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
- [elpa] externals/org-real 639ee73 069/160: Using save-excursion when applying changes, ELPA Syncer, 2021/10/06