[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark 52eee18951 128/173: intrnl: refactor org-rem
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark 52eee18951 128/173: intrnl: refactor org-remark-next-or-prev |
Date: |
Fri, 28 Jan 2022 16:58:08 -0500 (EST) |
branch: externals/org-remark
commit 52eee189511c7b08e56c26240140155783f4c8e9
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
intrnl: refactor org-remark-next-or-prev
---
org-remark.el | 138 +++++++++++++++++++++++++++++-----------------------------
1 file changed, 69 insertions(+), 69 deletions(-)
diff --git a/org-remark.el b/org-remark.el
index 678eb0f985..3e8f426177 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -345,74 +345,6 @@ in the current buffer. Each highlight is represented by
an overlay."
;; Tracking
(org-remark-notes-track-file path)))
-(defun org-remark-next ()
- "Move to the next highlight, if any.
-If there is none below the point but there is a highlight in the
-buffer, cycle back to the first one.
-
-After the point has moved to the next highlight, this command
-lets you move further by re-entering only the last letter like
-this example:v
-
- C-n \] \] \] \] \] \(assuming this command is bound to C-n \]\)
-
-This is achieved by transient map with `set-transient-map'.
-
-If you have the same prefix for `org-remark-prev', you can combine it in
-the sequence like so:
-
- C-n \] \] \] \[ \["
- (interactive)
- (if (not org-remark-highlights)
- (progn (message "No highlights present in this buffer.") nil)
- (let ((p (org-remark-find-next-highlight)))
- (if p (progn
- (goto-char p)
- ;; Setup the overriding keymap.
- (unless overriding-terminal-local-map
- (let ((prefix-keys (substring (this-single-command-keys) 0 -1))
- (map (cdr org-remark-mode-map)))
- (when (< 0 (length prefix-keys))
- (mapc (lambda (k) (setq map (assq k map))) prefix-keys)
- (setq map (cdr-safe map))
- (when (keymapp map) (set-transient-map map t)))))
- t)
- (message "Nothing done. No more visible highlights exist") nil))))
-
-(defun org-remark-prev ()
- "Move to the previous highlight, if any.
-If there is none above the point, but there is a highlight in the
-buffer, cycle back to the last one.
-
-After the point has moved to the previous highlight, this command
-lets you move further by re-entering only the last letter like
-this example:
-
- C-n \[ \[ \[ \[ \[ \(assuming this command is bound to C-n \[\)
-
-This is achieved by transient map with `set-transient-map'.
-
-If you have the same prefix for `org-remark-next', you can combine it in
-the sequence like so:
-
- C-n \] \] \] \[ \["
- (interactive)
- (if (not org-remark-highlights)
- (progn (message "No highlights present in this buffer.") nil)
- (let ((p (org-remark-find-prev-highlight)))
- (if p (progn
- (goto-char p)
- ;; Setup the overriding keymap.
- (unless overriding-terminal-local-map
- (let ((prefix-keys (substring (this-single-command-keys) 0 -1))
- (map (cdr org-remark-mode-map)))
- (when (< 0 (length prefix-keys))
- (mapc (lambda (k) (setq map (assq k map))) prefix-keys)
- (setq map (cdr-safe map))
- (when (keymapp map) (set-transient-map map t)))))
- t)
- (message "Nothing done. No more visible highlights exist") nil))))
-
(defun org-remark-open (point &optional arg)
"Open marginal notes file for highlight at POINT.
The marginal notes will be narrowed to the relevant headline to
@@ -465,6 +397,46 @@ Also see the documentation of `org-remark-open'."
(interactive "d")
(org-remark-open point 'view))
+(defun org-remark-next ()
+ "Move to the next highlight, if any.
+If there is none below the point but there is a highlight in the
+buffer, cycle back to the first one.
+
+After the point has moved to the next highlight, this command
+lets you move further by re-entering only the last letter like
+this example:v
+
+ C-n \] \] \] \] \] \(assuming this command is bound to C-n \]\)
+
+This is achieved by transient map with `set-transient-map'.
+
+If you have the same prefix for `org-remark-prev', you can combine it in
+the sequence like so:
+
+ C-n \] \] \] \[ \["
+ (interactive)
+ (org-remark-next-or-prev :next))
+
+(defun org-remark-prev ()
+ "Move to the previous highlight, if any.
+If there is none above the point, but there is a highlight in the
+buffer, cycle back to the last one.
+
+After the point has moved to the previous highlight, this command
+lets you move further by re-entering only the last letter like
+this example:
+
+ C-n \[ \[ \[ \[ \[ \(assuming this command is bound to C-n \[\)
+
+This is achieved by transient map with `set-transient-map'.
+
+If you have the same prefix for `org-remark-next', you can combine it in
+the sequence like so:
+
+ C-n \] \] \] \[ \["
+ (interactive)
+ (org-remark-next-or-prev nil))
+
(defun org-remark-view-next ()
"Move the cursor to the next highlight and view its marginal notes."
(interactive)
@@ -541,6 +513,34 @@ and removing overlays are not part of the undo tree."
;;;; Internal Functions
+(defun org-remark-next-or-prev (next)
+ "Move cursor to the next or previous highlight if any.
+NEXT must be either non-nil or nil.
+When non-nil it's for the next; for nil, prev.
+
+This function is internal only and meant to be used by interctive
+commands such as `org-remark-next' and `org-remark-prev'.
+
+Return t if the cursor has moved to next/prev.
+Return nil if not after a message."
+ (if (not org-remark-highlights)
+ (progn (message "No highlights present in the buffer") nil)
+ (let ((p (if next (org-remark-find-next-highlight)
+ (org-remark-find-prev-highlight))))
+ (if p (progn
+ (goto-char p)
+ ;; Setup the overriding keymap.
+ (unless overriding-terminal-local-map
+ (let ((prefix-keys (substring (this-single-command-keys) 0 -1))
+ (map (cdr org-remark-mode-map)))
+ (when (< 0 (length prefix-keys))
+ (mapc (lambda (k) (setq map (assq k map))) prefix-keys)
+ (setq map (cdr-safe map))
+ (when (keymapp map) (set-transient-map map t)))))
+ t)
+ (message "No visible highlights present in the buffer")
+ nil))))
+
(defun org-remark-overlay-find ()
"Return one org-remark overlay at point.
If there are more than one, return CAR of the list."
@@ -933,7 +933,7 @@ path."
;; A place holder for enhancemnet after the release of v1.0.0
;; Potentially support relative path.
;; No capacity to test this properly at the moment.
- ;;
+ ;;
;; (if org-remark-notes-relative-directory
;; (funcall org-remark-notes-path-function path
org-remark-notes-relative-directory)
;; (funcall org-remark-notes-path-function path)))
- [elpa] externals/org-remark 0c6aad188a 106/173: doc:README minor change for grammar, (continued)
- [elpa] externals/org-remark 0c6aad188a 106/173: doc:README minor change for grammar, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark a98120b18c 107/173: add ::line-number to file line, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 366b169e55 108/173: add: pen-factory & available pens for change, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 8e558a3549 110/173: add browse-next/prev; open/visit; change open to side window, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 70cf67bc26 112/173: intrnl: refactor view, open, browse (view-next/prev), ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 84999b19c6 115/173: add: org-remark-convert-legacy-data as a standalone command, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark d2135790a7 114/173: intrnl: refactor empty-buffer-p, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark feb1dca006 118/173: intrnl: minor refactoring, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 424f5da60a 119/173: docs: major docstring updates; WIP for manual., ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 8e35852380 120/173: add: save notes on mark, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 52eee18951 128/173: intrnl: refactor org-remark-next-or-prev,
ELPA Syncer <=
- [elpa] externals/org-remark 42cbe6e18e 129/173: docs: manual, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 4554fc817a 132/173: rm: org-remark-pen-factory -> merged with org-remark-create, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 4042e9434f 137/173: doc: User Manual first draft, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark bee736f6e3 131/173: intrnl: refactor mark, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark a7de41bdfa 139/173: docs: NEWS and README (incomplete, WIP), ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 50bfb96d69 140/173: Merge branch 'dev/name-change', ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 0c7fd2d711 143/173: docs: README for Org-remark, update user manual and css, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 1b2db44fa7 145/173: docs: user manaul, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 69d0259e20 146/173: docs: user manaul, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 62cba0ec63 148/173: fix: change now updates the marginal notes, ELPA Syncer, 2022/01/28