[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-real 00e4a4c595 096/188: Rotate locations of box wh
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-real 00e4a4c595 096/188: Rotate locations of box when cycling |
Date: |
Sun, 5 May 2024 22:55:57 -0400 (EDT) |
branch: externals/org-real
commit 00e4a4c5953c75c68ec8d83df4ddb21e8a3aa318
Author: Amy Grinn <grinn.amy@gmail.com>
Commit: Amy Grinn <grinn.amy@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 f3f16358f8..7980f24965 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 bcd3cb2c14 045/188: Refactoring, (continued)
- [elpa] externals/org-real bcd3cb2c14 045/188: Refactoring, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real b6df63b9c8 187/188: Updated version, ELPA Syncer, 2024/05/05
- [elpa] externals/org-real 6e70f678b7 056/188: Don't highlight children when following link, ELPA Syncer, 2024/05/05
- [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 <=
- [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, 2024/05/05
- [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