[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark 62cba0ec63 148/173: fix: change now updates
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark 62cba0ec63 148/173: fix: change now updates the marginal notes |
Date: |
Fri, 28 Jan 2022 16:58:10 -0500 (EST) |
branch: externals/org-remark
commit 62cba0ec630a4d39fd5822de21cf81e82f525f6f
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
fix: change now updates the marginal notes
It was broken. ID only cannot determine if it is a change or create
---
org-remark.el | 75 +++++++++++++++++++++++++++++++----------------------------
1 file changed, 40 insertions(+), 35 deletions(-)
diff --git a/org-remark.el b/org-remark.el
index 0aeeebdd46..d706491d16 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -141,7 +141,7 @@ property names with \"org-remark-\" or use \"CATEGORY\"."
`(progn
;; Define custom pen function
(defun ,(intern (format "org-remark-mark-%s" label))
- (beg end &optional id)
+ (beg end &optional id mode)
,(format "Apply the following face to the region selected by BEG and
END.
%s
@@ -162,7 +162,7 @@ highlight. In this case, no new ID gets generated."
(or face "`org-remark-highlighter'") properties)
(interactive (org-remark-region-or-word))
(org-remark-single-highlight-mark
- beg end id ,label ,face ,properties))
+ beg end id mode ,label ,face ,properties))
;; Register to `org-remark-available-pens'
(add-to-list 'org-remark-available-pens
@@ -259,7 +259,7 @@ recommended to turn it on as part of Emacs initialization.
(add-to-list 'org-remark-available-pens #'org-remark-mark)
;;;###autoload
-(defun org-remark-mark (beg end &optional id)
+(defun org-remark-mark (beg end &optional id mode)
"Apply the FACE to the region selected by BEG and END.
This function will apply face `org-remark-highlighter' to the selected region.
@@ -282,7 +282,8 @@ to the database."
;; FIXME
;; Adding "nil" is different to removing a prop
;; This will do for now
- (org-remark-single-highlight-mark beg end id nil nil
+ (org-remark-single-highlight-mark beg end id mode
+ nil nil
(list "org-remark-label" "nil")))
(when org-remark-create-default-pen-set
@@ -318,7 +319,7 @@ load the highlights"
(label (caddr highlight)))
(let ((fn (intern (concat "org-remark-mark-" label))))
(unless (functionp fn) (setq fn #'org-remark-mark))
- (funcall fn beg end id))))
+ (funcall fn beg end id :load))))
(setq org-remark-loaded t))
;; Tracking
(org-remark-notes-track-file (buffer-file-name)))
@@ -483,7 +484,7 @@ from."
(intern
(completing-read "Which pen?:"
org-remark-available-pens)))))
(delete-overlay ov)
- (funcall new-pen beg end id))))
+ (funcall new-pen beg end id :change))))
(defun org-remark-remove (point &optional delete)
"Remove the highlight at POINT.
@@ -556,7 +557,7 @@ If there are more than one, return CAR of the list."
(car found)))
(defun org-remark-single-highlight-mark
- (beg end &optional id label face properties)
+ (beg end &optional id mode label face properties)
"Apply the FACE to the region selected by BEG and END.
This function will apply FACE to the selected region. When it is
@@ -570,6 +571,10 @@ ID, always assuming it is working on a new highlighted text
region, and Org-remark will start tracking the highlight's
location in the current buffer.
+MODE determines whether or not highlight is to be saved in the
+marginal notes file. The expected values are nil, :load and
+:change.
+
A Org headline 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.
@@ -579,35 +584,35 @@ passed, indicating to Org-remark that it is to load an
existing
highlight. In this case, no new ID gets generated and the
highlight saved again, avoiding the unnecessary round-trip back
to the database."
- ;; BEG and END are not selected and in the interactive call
- ;; not Elisp call
- (let* ((load-only (when id t))
- ;; UUID is too long; does not have to be the full length
+ ;; UUID is too long; does not have to be the full length
+
+ ;; Ensure to turn on the local minor mode
+ (unless org-remark-mode (org-remark-mode +1))
+ ;; Add highlight to the text
+ (org-with-wide-buffer
+ (let ((ov (make-overlay beg end nil :front-advance))
(id (if id id (substring (org-id-uuid) 0 8))))
- ;; Ensure to turn on the local minor mode
- (unless org-remark-mode (org-remark-mode +1))
- ;; Add highlight to the text
- (org-with-wide-buffer
- (let ((ov (make-overlay beg end nil :front-advance)))
- (overlay-put ov 'face (if face face 'org-remark-highlighter))
- (while properties
- (let ((prop (pop properties))
- (val (pop properties)))
- (overlay-put ov prop val)))
- (when label (overlay-put ov 'org-remark-label label))
- (overlay-put ov 'org-remark-id id)
- ;; Keep track of the overlay in a local variable. It's a list that is
- ;; guaranteed to contain only org-remark overlays as opposed to the one
- ;; returned by `overlay-lists' that lists any overlays.
- (push ov org-remark-highlights)
- (unless load-only
- (org-remark-single-highlight-save (buffer-file-name)
- beg end
- (overlay-properties ov)
-
(org-remark-single-highlight-get-title)))
- (deactivate-mark)))
- (org-remark-housekeep)
- (org-remark-highlights-sort)))
+ (overlay-put ov 'face (if face face 'org-remark-highlighter))
+ (while properties
+ (let ((prop (pop properties))
+ (val (pop properties)))
+ (overlay-put ov prop val)))
+ (when label (overlay-put ov 'org-remark-label label))
+ (overlay-put ov 'org-remark-id id)
+ ;; Keep track of the overlay in a local variable. It's a list that is
+ ;; guaranteed to contain only org-remark overlays as opposed to the one
+ ;; returned by `overlay-lists' that lists any overlays.
+ (push ov org-remark-highlights)
+ ;; for mode, nil and :change result in saving the highlight. :load
+ ;; bypasses save.
+ (unless (eq mode :load)
+ (org-remark-single-highlight-save (buffer-file-name)
+ beg end
+ (overlay-properties ov)
+
(org-remark-single-highlight-get-title)))))
+ (deactivate-mark)
+ (org-remark-housekeep)
+ (org-remark-highlights-sort))
(defun org-remark-single-highlight-get-title ()
"Return the title of the current buffer.
- [elpa] externals/org-remark 52eee18951 128/173: intrnl: refactor org-remark-next-or-prev, (continued)
- [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
- [elpa] externals/org-remark 62cba0ec63 148/173: fix: change now updates the marginal notes,
ELPA Syncer <=
- [elpa] externals/org-remark f43e4afc34 152/173: add: toggle to menu; intrnl: refactor, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark f353630ddd 153/173: fix:toggle: marking when toggle hidden confuses the state, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark da77d9dfba 154/173: fix: pen menu function for 27.x, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 4782d43f0f 155/173: add: change to menu items, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 713f64b7cb 168/173: docs: minor change to the demo/marginalia.org, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 7226f4d01e 173/173: docs: add delete; add help string to menu items, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 4b5d9c3fda 171/173: fix:delete quit window if it did not exist on calling delete, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 9deaecd211 116/173: add: Legacy data facility wtih org-remark-tracking, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark d36debe2b4 124/173: add: factor out org-remark-legacy-convert, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark f30ad4f570 122/173: fix: program error in save, ELPA Syncer, 2022/01/28