emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org-remark 62a1c72d70 3/4: feat: on-save (create and ch


From: ELPA Syncer
Subject: [elpa] externals/org-remark 62a1c72d70 3/4: feat: on-save (create and change) and load updates props
Date: Sun, 25 Dec 2022 12:57:55 -0500 (EST)

branch: externals/org-remark
commit 62a1c72d707a8b0568f1aa4ee3df488886857032
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>

    feat: on-save (create and change) and load updates props
    
    Body of the annotation text gets update to the source's highlight
    overlay props as help-echo and the new 'org-remark-notes-body'
    properties.
    
    WIP.
---
 README.org    | 18 +++++++++---------
 org-remark.el | 35 +++++++++++++++++++++--------------
 2 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/README.org b/README.org
index 0ec5274791..d3007e03b7 100644
--- a/README.org
+++ b/README.org
@@ -118,31 +118,31 @@ This macro was inspired by 
[[https://github.com/jkitchin/ov-highlight][Ov-highli
 
 ** org-remark-notes-send-data
 :PROPERTIES:
-:org-remark-beg: 39420
-:org-remark-end: 39446
+:org-remark-beg: 39905
+:org-remark-end: 39931
 :org-remark-id: 4de1f10c
 :org-remark-label: nil
-:org-remark-link: [[file:org-remark.el::982]]
+:org-remark-link: [[file:org-remark.el::989]]
 :org-remark-note-body: [empty entry]
 :END:
 
 ** org-remark-highlights-load
 :PROPERTIES:
-:org-remark-beg: 39537
-:org-remark-end: 39563
+:org-remark-beg: 40022
+:org-remark-end: 40048
 :org-remark-id: bf05b18c
 :org-remark-label: nil
-:org-remark-link: [[file:org-remark.el::986]]
+:org-remark-link: [[file:org-remark.el::993]]
 :org-remark-note-body: [empty entry]
 :END:
 
 ** goto
 :PROPERTIES:
-:org-remark-beg: 33747
-:org-remark-end: 33751
+:org-remark-beg: 34151
+:org-remark-end: 34155
 :org-remark-id: 184667c4
 :org-remark-label: nil
-:org-remark-link: [[file:org-remark.el::850]]
+:org-remark-link: [[file:org-remark.el::856]]
 :org-remark-note-body: This is no longer empty.
 :END:
 This is no longer empty.
diff --git a/org-remark.el b/org-remark.el
index 22d746e11d..bb2e37c39d 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -684,7 +684,8 @@ to the database."
   (org-with-wide-buffer
    (let ((ov (make-overlay beg end nil :front-advance))
          ;; UUID is too long; does not have to be the full length
-         (id (if id id (substring (org-id-uuid) 0 8))))
+         (id (if id id (substring (org-id-uuid) 0 8)))
+         (notes-props))
      (overlay-put ov 'face (if face face 'org-remark-highlighter))
      (while properties
        (let ((prop (pop properties))
@@ -701,16 +702,20 @@ to the database."
      (let ((filename (org-remark-source-find-file-name)))
        (unless (eq mode :load)
          (if filename
-             (org-remark-highlight-save filename
-                                        beg end
-                                        (overlay-properties ov)
-                                        (org-remark-highlight-get-title))
+             (setq notes-props
+                   (org-remark-highlight-save filename
+                                              beg end
+                                              (overlay-properties ov)
+                                              
(org-remark-highlight-get-title)))
               ;;; Get props for create and change any way
-           (message "org-remark: Highlights not saved; buffer is not visiting 
a file")))
-       ;;; on load, send data once from notes to source
-
-       (when (eq mode :load)
-         (org-remark-notes-communicate-with-source filename id)))))
+           ;; TODO remove this message; non-file-visiting buffers is now 
supported.
+           (message "org-remark: Highlights not saved; buffer is not visiting 
a file"))
+         (when notes-props
+           ;; TODO. The function should be based on parameters
+           (unless (overlay-get ov 'help-echo)
+             (overlay-put ov 'help-echo (plist-get notes-props :body)))
+           (overlay-put ov 'org-remark-note-body
+                        (plist-get notes-props :body)))))))
   ;;; for on-going communication from notes to source, after-save-hook.
   (let ((notes-buf (find-file-noselect (org-remark-notes-get-file-name))))
     (with-current-buffer notes-buf
@@ -782,7 +787,7 @@ non-nil.  Returns nil otherwise, or when no Org-ID is 
found."
 (defun org-remark-highlight-save (filename beg end props &optional title)
   "Save a single HIGHLIGHT in the marginal notes file.
 
-Return t.
+Return the highlight's data properties list (TODO refer to ...).
 
 FILENAME specifies the name of source file with which the marginal notes
 file is associated.
@@ -827,7 +832,8 @@ source with using ORGID."
                    (concat "[[file:" filename
                            (when line-num (format "::%d" line-num)) "]]")
                  (run-hook-with-args-until-success
-                  'org-remark-highlight-link-to-source-functions filename))))
+                  'org-remark-highlight-link-to-source-functions filename)))
+         (notes-props))
     (with-current-buffer notes-buf
       (when (featurep 'org-remark-convert-legacy) 
(org-remark-convert-legacy-data))
       ;;`org-with-wide-buffer is a macro that should work for non-Org file'
@@ -866,7 +872,8 @@ source with using ORGID."
            (insert (concat "** " text "\n"))
            (org-remark-notes-set-properties beg end props)
            (when (and orgid org-remark-use-org-id)
-               (insert (concat "[[id:" orgid "]" "[" title "]]"))))))
+             (insert (concat "[[id:" orgid "]" "[" title "]]"))))
+         (setq notes-props (list :body (org-remark-highlight-get-text)))))
       (cond
        ;; fix GH issue #19
        ;; Temporarily remove `org-remark-save' from the `after-save-hook'
@@ -879,7 +886,7 @@ source with using ORGID."
        ;; notes buffer
        ((buffer-modified-p)
         (save-buffer)))
-      t)))
+      notes-props)))
 
 
 ;;;;; org-remark-notes



reply via email to

[Prev in Thread] Current Thread [Next in Thread]