[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark 8e35852380 120/173: add: save notes on mark
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark 8e35852380 120/173: add: save notes on mark |
Date: |
Fri, 28 Jan 2022 16:58:07 -0500 (EST) |
branch: externals/org-remark
commit 8e358523800163220d45d78bf8ebc53827cf74e1
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
add: save notes on mark
---
org-remark.el | 40 ++++++++++++++++++++++++++++------------
1 file changed, 28 insertions(+), 12 deletions(-)
diff --git a/org-remark.el b/org-remark.el
index 85e2ac151a..69edbbe62a 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -6,7 +6,7 @@
;; URL: https://github.com/nobiot/org-remark
;; Version: 1.0.0-rc
;; Created: 22 December 2020
-;; Last modified: 14 January 2022
+;; Last modified: 15 January 2022
;; Package-Requires: ((emacs "27.1") (org "9.4"))
;; Keywords: org-mode, annotation, writing, note-taking, marginal-notes
@@ -162,9 +162,9 @@ ID, always assuming it is a new highlighted text region, and
Org-remark will start tracking the highlight's location in the
current buffer.
-It will not create a marginal notes entry yet. Save the current
-buffer or call `org-remark-save' to create a new entry in the
-notes file.
+The entry for the highlght will be created in the marginal notes
+file specified by `org-remark-notes-file-path'. If the file does
+not exist yet, it will be created.
When this function is called from Elisp, ID can be optionally
passed. If so, no new ID gets generated."
@@ -322,14 +322,11 @@ in the current buffer. Each highlight is represented by
an overlay."
(interactive)
(let* ((filename (buffer-file-name))
(source-path (abbreviate-file-name filename))
- (title (or (cadr (assoc "TITLE" (org-collect-keywords '("TITLE"))))
- (file-name-sans-extension
- (file-name-nondirectory (buffer-file-name))))))
+ (title (org-remark-single-highlight-get-title)))
(org-remark-housekeep)
(org-remark-highlights-sort)
(dolist (h org-remark-highlights)
- (let ((orgid (and org-remark-use-org-id
- (org-entry-get (overlay-start h) "ID" 'INHERIT))))
+ (let ((orgid (org-remark-single-highlight-get-org-id h)))
(org-remark-single-highlight-save h title source-path orgid)))
;; Tracking
(when org-remark-global-tracking-mode
@@ -606,7 +603,7 @@ If there are more than one, return CAR of the list."
(beg end label face properties &optional id)
"Highlight the selected region between BEG and END.
This function performs the main work for the command created via
-`org-remark-create-pen'.
+`org-remark-create'.
Create a user-defined highlighter pen function.
LABEL is the name of the highlighter pen. The function will be called
@@ -619,6 +616,10 @@ nil, this macro uses the default face
`org-remark-highlight'.
PROPERTIES is a list of pairs of a symbol and value. This
function adds them as overlay properties.
+This function also saves the entry for the highlght in the
+marginal notes file specified by `org-remark-notes-file-path'.
+If the file does not exist yet, it will be created.
+
When this function is called from Elisp, ID can be optionally
passed. If so, no new ID gets generated."
;; Ensure to turn on the local minor mode
@@ -641,11 +642,26 @@ passed. If so, no new ID gets generated."
(push ov org-remark-highlights)
;; Adding overlay to the buffer does not set the buffer modified. You
;; cannot use `undo' to undo highlights, either.
- (deactivate-mark)
- (unless (buffer-modified-p) (restore-buffer-modified-p t))))
+ (org-remark-single-highlight-save ov
+ (org-remark-single-highlight-get-title)
+ (abbreviate-file-name
(buffer-file-name))
+ (org-remark-single-highlight-get-org-id
ov))
+ (deactivate-mark)))
(org-remark-housekeep)
(org-remark-highlights-sort))
+(defun org-remark-single-highlight-get-title ()
+ "Return the title of the current buffer.
+Utility function to work with a single highlight overlay."
+ (or (cadr (assoc "TITLE" (org-collect-keywords '("TITLE"))))
+ (file-name-sans-extension
+ (file-name-nondirectory (buffer-file-name)))))
+
+(defun org-remark-single-highlight-get-org-id (highlight)
+ "."
+ (and org-remark-use-org-id
+ (org-entry-get (overlay-start highlight) "ID" 'INHERIT)))
+
(defun org-remark-single-highlight-save (highlight title path orgid)
"Save a single HIGHLIGHT in the marginal notes file.
The marginal notes file is specified by PATH.
- [elpa] externals/org-remark 51b0c08f25 104/173: docs: NEWS, README etc. for name change, (continued)
- [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, 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 <=
- [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
- [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