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

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

[elpa] externals/org-remark f1ea78bcf1 47/67: refactor: highlight-add


From: ELPA Syncer
Subject: [elpa] externals/org-remark f1ea78bcf1 47/67: refactor: highlight-add
Date: Sat, 22 Jul 2023 06:59:03 -0400 (EDT)

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

    refactor: highlight-add
---
 org-remark-nov.el | 29 ++++++++++++++++++-----------
 org-remark.el     | 22 +++++++++++++---------
 2 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/org-remark-nov.el b/org-remark-nov.el
index 0438d0825e..075e45621c 100644
--- a/org-remark-nov.el
+++ b/org-remark-nov.el
@@ -2,13 +2,14 @@
 
 ;; URL: https://github.com/nobiot/org-remark
 ;; Created: 9 January 2023
-;; Last modified: 09 July 2023
+;; Last modified: 12 July 2023
 
 ;;; Commentary:
 
 ;;; Code:
 
-(require 'nov nil 'NOERROR)
+(if (locate-library "nov") (require 'nov)
+  (error "Org-remark: package `nov' is missing"))
 (require 'org-remark)
 
 ;;;###autoload
@@ -90,15 +91,21 @@ buffer."
 
 (cl-defmethod org-remark-highlight-get-constructors (&context (major-mode 
nov-mode))
   "Dev needs to define a mode-specific headline constructors.
-`(level source-filename-fn title-fn prop-to-find)`'"
-  (let* ((headline-1 (list 1
-                           (lambda () nov-file-name)
-                           (lambda () (cdr (assoc 'title nov-metadata)))
-                           "org-remark-nov-file"))
-         (headline-2 (list 2
-                           #'org-remark-get-epub-source
-                           #'org-remark-nov-get-epub-document-title
-                           org-remark-prop-source-file))
+`(SOURCE-FILENAME-FN TITLE-FN PROP-TO-FIND)`'"
+  (let* ((headline-1 (list
+                      ;; SOURCE-FILENAME-FN
+                      (lambda () nov-file-name)
+                      ;; TITLE-FN
+                      (lambda () (cdr (assoc 'title nov-metadata)))
+                      ;; PROP-TO-FIND
+                      "org-remark-nov-file"))
+         (headline-2 (list
+                      ;; SOURCE-FILENAME-FN
+                      #'org-remark-get-epub-source
+                      ;; TITLE-FN
+                      #'org-remark-nov-get-epub-document-title
+                      ;; PROP-TO-FIND
+                      org-remark-prop-source-file))
          (headline-constructors (list headline-1 headline-2)))
     headline-constructors))
 
diff --git a/org-remark.el b/org-remark.el
index 456a0a8ca5..f487493bee 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -6,7 +6,7 @@
 ;; URL: https://github.com/nobiot/org-remark
 ;; Version: 1.1.0
 ;; Created: 22 December 2020
-;; Last modified: 10 July 2023
+;; Last modified: 11 July 2023
 ;; Package-Requires: ((emacs "27.1") (org "9.4"))
 ;; Keywords: org-mode, annotation, note-taking, marginal-notes, wp,
 
@@ -842,12 +842,15 @@ This function assumes the current buffer is the source 
buffer."
 (cl-defgeneric org-remark-highlight-get-constructors ()
   "Dev needs to define a mode-specific headline constructors.
 `(level source-filename-fn title-fn prop-to-find)`'"
-  (let* ((headline-1 (list 1
-                           (lambda ()
-                             (org-remark-source-get-file-name
-                              (org-remark-source-find-file-name)))
-                           #'org-remark-highlight-get-title
-                           org-remark-prop-source-file))
+  (let* ((headline-1 (list
+                      ;; SOURCE-FILENAME-FN
+                      (lambda ()
+                        (org-remark-source-get-file-name
+                         (org-remark-source-find-file-name)))
+                      ;; TITLE-FN
+                      #'org-remark-highlight-get-title
+                      ;; PROP-TO-FIND
+                      org-remark-prop-source-file))
          (headline-constructors (list headline-1)))
     headline-constructors))
 
@@ -908,7 +911,8 @@ buffer for automatic sync."
        ;;      text file:   1. source file; 2. highlight
        ;; Note the lowest level is always the highlight (common). And
        ;; the top level is the "source" -- the file or URL, etc.
-       (cl-loop for (level filename-fn title-fn prop-to-find) in 
headline-constructors
+       (cl-loop for index from 1
+                for (filename-fn title-fn prop-to-find) in 
headline-constructors
                 ;; This variable "point" is set in order to be returned at
                 ;; the end of the loop.
                 with point = nil
@@ -921,7 +925,7 @@ buffer for automatic sync."
                              (or (org-find-property
                                   prop-to-find filename)
                                  (org-remark-new-headline
-                                  level title (list prop-to-find filename))))))
+                                  index title (list prop-to-find filename))))))
                 ;; Add the hightlight/note nodes after the headline loop.
                 finally (progn
                           ;; need to move to the point at the end



reply via email to

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