[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark 70cf67bc26 112/173: intrnl: refactor view, o
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark 70cf67bc26 112/173: intrnl: refactor view, open, browse (view-next/prev) |
Date: |
Fri, 28 Jan 2022 16:58:06 -0500 (EST) |
branch: externals/org-remark
commit 70cf67bc265717c712e88b9a41ede249fb5227c9
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
intrnl: refactor view, open, browse (view-next/prev)
---
org-remark.el | 72 +++++++++++++++++++++++++++++------------------------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/org-remark.el b/org-remark.el
index b42826d61d..ffa100ba71 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -5,7 +5,7 @@
;; Author: Noboru Ota <me@nobiot.com>
;; URL: https://github.com/nobiot/org-remark
;; Version: 0.0.7
-;; Last modified: 11 January 2022
+;; Last modified: 12 January 2022
;; Package-Requires: ((emacs "27.1") (org "9.4"))
;; Keywords: org-mode, annotation, writing, note-taking, marginal-notes
@@ -38,6 +38,7 @@
(require 'org-remark-global-tracking)
(declare-function org-collect-keywords "org")
+
;;;; Customization
(defgroup org-remark nil
@@ -65,8 +66,7 @@ file."
"Define if Org-remark use Org-ID to link back to the main note."
:type 'boolean)
-
-(defcustom org-remark-notes-buffer-alist
+(defcustom org-remark-notes-display-buffer-action
`((display-buffer-in-side-window)
(side . left)
(slot . 1)
@@ -74,6 +74,7 @@ file."
"."
:type display-buffer--action-custom-type)
+
;;;; Variables
(defvar-local org-remark-loaded nil
@@ -100,6 +101,7 @@ It is meant to exist only one of these in each Emacs
session.")
(defconst org-remark-prop-source-beg "org-remark-beg")
(defconst org-remark-prop-source-end "org-remark-end")
+
;;;; Commands
;;;###autoload
@@ -289,42 +291,38 @@ in the current buffer. Each highlight is represented by
an overlay."
(defun org-remark-open (point &optional arg)
"Open hightlight and annocation at POINT, narrowed to the relevant headline.
It creates a cloned indirect buffer of the notes file
-\(`org-remark-notes-file-path'\). You can edit notes file as a in
-a normal Org file. Once you have done editing, you can simply
-save and kill the buffer.
-
-You will stay in the current buffer.
+\(`org-remark-notes-file-path'\). You can edit notes file as a
+normal Org file. Once you have done editing, you can simply save
+and kill the buffer.
-You can visit the notes buffer opend for furhter editing when ARG
-is non-nil (e.g. by passing a universal argument with
-\\[universal-argument] \(ARG\).
+By default, the cursor will go to the notes buffer for furhter
+editing. When ARG is non-nil \(e.g. by passing a universal
+argument with \\[universal-argument]\), you can simply display
+the notes buffer and remain in the current buffer.
This package ensures that there is only one cloned buffer for
notes file by tracking it."
(interactive "d\nP")
(when (buffer-live-p org-remark-last-notes-buffer)
- (kill-buffer org-remark-last-notes-buffer))
+ (kill-buffer org-remark-last-notes-buffer))
(when-let ((id (get-char-property point 'org-remark-id))
- (cbuf (current-buffer))
(ibuf (make-indirect-buffer
(find-file-noselect org-remark-notes-file-path)
"*marginal notes*" 'clone)))
(setq org-remark-last-notes-buffer ibuf)
- (display-buffer ibuf org-remark-notes-buffer-alist)
- ;; Assuming the marginal-notes buffer is in another window
- (switch-to-buffer-other-window ibuf)
- (widen)(goto-char (point-min))
- (when-let (p (or (org-find-property org-remark-prop-id id)
- (org-find-property "marginalia-id" id)))
- (goto-char p)(org-narrow-to-subtree))
- ;; Assuming the marginal-notes buffer is in another window
- (unless arg (switch-to-buffer-other-window cbuf))))
-
-(defun org-remark-visit (point)
- "Visit notes for hightlight and annocation at POINT.
-The notes file get narrowed to the relevant headline."
+ (with-current-buffer ibuf
+ (when-let (p (or (org-find-property org-remark-prop-id id)
+ (org-find-property "marginalia-id" id)))
+ (widen)(goto-char p)(org-narrow-to-subtree)))
+ (display-buffer ibuf org-remark-notes-display-buffer-action)
+ (unless arg (select-window (get-buffer-window ibuf)))))
+
+(defun org-remark-view (point)
+ "View notes for hightlight and annocation at POINT.
+The notes file get narrowed to the relevant headline. The cursor
+remains in the current buffer."
(interactive "d")
- (org-remark-open point 'visit))
+ (org-remark-open point 'view))
(defun org-remark-remove (point &optional arg)
"Remove the highlight at POINT.
@@ -421,15 +419,15 @@ the sequence like so:
t)
(message "Nothing done. No more visible highlights exist") nil))))
-(defun org-remark-browse-next ()
+(defun org-remark-view-next ()
"."
(interactive)
- (org-remark-next)(org-remark-open (point)))
+ (org-remark-next)(org-remark-view (point)))
-(defun org-remark-browse-prev ()
+(defun org-remark-view-prev ()
"."
(interactive)
- (org-remark-prev)(org-remark-open (point)))
+ (org-remark-prev)(org-remark-view (point)))
(defun org-remark-toggle ()
"Toggle showing/hiding of highlights in current buffer.
@@ -462,9 +460,8 @@ are still recorded in the marginalia file."
(delete-overlay ov)
(funcall new-pen beg end id))))
-;;;; Functions
-
-;;;;; Private
+
+;;;; Internal Functions
(defun org-remark-overlay-find ()
"Return one org-remark overlay at point.
@@ -564,6 +561,8 @@ feature."
(org-id-get-create))
(org-with-wide-buffer
(let ((file-headline (or (org-find-property
+ "marginalia-source-file" path) ;; backward
compatiblility
+ (org-find-property
org-remark-prop-source-file path)
(progn
;; If file-headline does not exist, create
one at the bottom
@@ -665,9 +664,9 @@ Each highlight is a list in the following structure:
;; The `or' for backward compatibility.
;; "marginalia-xx" is no longer used in the current version
(let ((heading (or (org-find-property
- org-remark-prop-source-file source-path)
+ "marginalia-source-file" source-path)
(org-find-property
- "marginalia-source-file" source-path))))
+ org-remark-prop-source-file source-path))))
(if (not heading)
(message "No highlights or annotations found for %s."
source-path)
@@ -824,6 +823,7 @@ Case 2. The overlay points to no buffer
(provide 'org-remark)
+
;;; org-remark.el ends here
;; Local Variables:
- [elpa] externals/org-remark b3a8e3e2ec 097/173: add: Org-HANA: Org to Highlight & ANnotate Any text file (HANA), (continued)
- [elpa] externals/org-remark b3a8e3e2ec 097/173: add: Org-HANA: Org to Highlight & ANnotate Any text file (HANA), ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark f7e796cd6b 095/173: chg: don't update headline text; various refactors, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 4ee9e23e50 100/173: intrnl: refactor fn names, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark ecb82aebbe 101/173: intrnl correct some minor errors, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark fd5cab5ac2 102/173: rm: org-marginalia*.el, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 51b0c08f25 104/173: docs: NEWS, README etc. for name change, ELPA Syncer, 2022/01/28
- [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 <=
- [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, 2022/01/28
- [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