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

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

[elpa] externals/org-remark b50d0f7688 52/67: refactor: rename highlight


From: ELPA Syncer
Subject: [elpa] externals/org-remark b50d0f7688 52/67: refactor: rename highlights-after-load-hook to -functions
Date: Sat, 22 Jul 2023 06:59:04 -0400 (EDT)

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

    refactor: rename highlights-after-load-hook to -functions
    
    It's an abnormal hook. The convention is to use -functions insted of
    -hook.
---
 NEWS          |  5 +++--
 org-remark.el | 25 +++++++++++++------------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/NEWS b/NEWS
index 571d8d1af1..cf655a1ea6 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ Current development version
 
           + The highlight position auto-adjusted (d)
 
-          + Uses the new `org-remark-highlights-after-load-hook'
+          + Uses the new `org-remark-highlights-after-load-functions'
 
           + Icons are customizable. You can also disable icons by setting
             the respective customizing variable to nil
@@ -36,7 +36,8 @@ Current development version
          + The fact that a given highlight has been automatically moved
            is indicated by an icon
 
-  - feat: org-remark-highlights-after-load-hook
+  - feat: org-remark-highlights-after-load-functions
+          Abnormal hook
 
   - fix: Make load process robust
 
diff --git a/org-remark.el b/org-remark.el
index 7e032c4a6e..bf37cfae31 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -122,7 +122,7 @@ Org-remark does not create this ID, which needs to be added
 manually or some other function to either the headline or file."
   :type 'boolean)
 
-(defcustom  org-remark-open-hook nil
+(defcustom org-remark-open-hook nil
   "Hook run when a note buffer is opened/visited.
 The current buffer is the note buffer."
   :type 'hook)
@@ -137,6 +137,12 @@ Nil means no icon is to be displayed."
 Nil means no icon is to be displayed."
   :type 'string)
 
+(defcustom org-remark-highlights-after-load-functions nil
+  "Abnormal hook run after `org-remark-highlights-load'.
+It is run with OVERLAYS and NOTES-BUF as arguments. OVERLAYS are
+highlights. It is run with the source buffer as current buffer."
+  :type hook)
+
 
 ;;;; Variables
 
@@ -292,12 +298,12 @@ recommended to turn it on as part of Emacs initialization.
       ;; Activate
       (org-remark-highlights-load)
       (add-hook 'after-save-hook #'org-remark-save nil t)
-      (add-hook 'org-remark-highlights-after-load-hook
+      (add-hook 'org-remark-highlights-after-load-functions
                 #'org-remark-highlights-adjust-positions)
       ;; Add-icons should be after all after-load-hook functions because
       ;; some of them make adjustment that's relevant for an icon --
       ;; e.g. adjust-positon.
-      (add-hook 'org-remark-highlights-after-load-hook
+      (add-hook 'org-remark-highlights-after-load-functions
                 #'org-remark-highlights-add-icons 80)
       (add-hook 'org-remark-highlight-link-to-source-functions
                 #'org-remark-highlight-link-to-source-default 80))
@@ -308,9 +314,9 @@ recommended to turn it on as part of Emacs initialization.
           (delete-overlay highlight)))
       (setq org-remark-highlights nil)
       (remove-hook 'after-save-hook #'org-remark-save t)
-      (remove-hook 'org-remark-highlights-after-load-hook
+      (remove-hook 'org-remark-highlights-after-load-functions
                    #'org-remark-highlights-adjust-positions)
-      (remove-hook 'org-remark-highlights-after-load-hook
+      (remove-hook 'org-remark-highlights-after-load-functions
                    #'org-remark-highlights-add-icons)
       (remove-hook 'org-remark-highlight-link-to-source-functions
                    #'org-remark-highlight-link-to-source-default))))
@@ -1346,11 +1352,6 @@ highlight is a property list in the following properties:
                          highlights)))))
            highlights))))))
 
-(defvar org-remark-highlights-after-load-hook nil
-  "Hook run after `org-remark-highlights-load'.
-It is run with OVERLAYS and NOTES-BUF as arguments.  OVERLAYS are
-highlights.  It is run with the source buffer as current buffer.")
-
 (defun org-remark-highlights-load (&optional update)
   "Visit notes file & load the saved highlights onto current buffer.
 If there is no highlights or annotations for current buffer,
@@ -1382,7 +1383,7 @@ process."
           (push (org-remark-highlight-load highlight) overlays))
         (unless update (org-remark-notes-setup notes-buf source-buf))
         (if overlays
-            (progn (run-hook-with-args 'org-remark-highlights-after-load-hook
+            (progn (run-functions-with-args 
'org-remark-highlights-after-load-functions
                                        overlays notes-buf)
                    ;; Return t
                    t)
@@ -1516,7 +1517,7 @@ Case 2. The overlay points to no buffer
 
 (defun org-remark-highlights-adjust-positions (overlays _notes-buf)
   "
-Meant to be set to `org-remark-highlights-after-load-hook' by
+Meant to be set to `org-remark-highlights-after-load-functions' by
 mode-specific extensions."
   (dolist (ov overlays)
     (let ((highlight-text (overlay-get ov '*org-remark-original-text)))



reply via email to

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