[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark 2f8b05259b 8/8: refactor: remove modules; pr
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark 2f8b05259b 8/8: refactor: remove modules; prfere global minor mode |
Date: |
Sat, 24 Dec 2022 02:57:59 -0500 (EST) |
branch: externals/org-remark
commit 2f8b05259b2a1ef01f038e599b103d925bbb1429
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
refactor: remove modules; prfere global minor mode
Remove all the module related code. Add 'org-remark-eww-mode' to enable
EWW integration.
---
org-remark-eww.el | 40 ++++++++++++++++++++---------
org-remark-global-tracking.el | 60 +++++--------------------------------------
2 files changed, 35 insertions(+), 65 deletions(-)
diff --git a/org-remark-eww.el b/org-remark-eww.el
index dd95ee935d..f5a27c42e9 100644
--- a/org-remark-eww.el
+++ b/org-remark-eww.el
@@ -6,7 +6,7 @@
;; Noboru Ota <me@nobiot.com>
;; URL: https://github.com/nobiot/org-remark
;; Created: 23 December 2022
-;; Last modified: 23 December 2022
+;; Last modified: 24 December 2022
;; Package-Requires: ((emacs "27.1") (org "9.4"))
;; Keywords: org-mode, annotation, note-taking, marginal-notes, wp
@@ -35,26 +35,42 @@
;;; Code:
(require 'eww)
-;; Silence compiler
-(defvar org-remark-global-tracking-mode)
(declare-function org-remark-auto-on "org-remark-global-tracking")
-(defun org-remark-eww-enable ()
- (if org-remark-global-tracking-mode
- (add-hook 'eww-after-render-hook #'org-remark-auto-on)
- (remove-hook 'eww-after-render-hook #'org-remark-auto-on))
- ;; TODO allow for disable with org-remark-mode-hook (local)
- (add-hook 'org-remark-source-find-file-name-functions
- #'org-remark-eww-find-file-name)
- (add-hook 'org-remark-highlight-link-to-source-functions
- #'org-remark-eww-highlight-link-to-source))
+;;;###autoload
+(define-minor-mode org-remark-eww-mode
+ "Enable Org-remark to work with EWW."
+ :global t
+ :group 'org-remark
+ (if org-remark-eww-mode
+ ;; Enable
+ (progn
+ (add-hook 'eww-after-render-hook #'org-remark-auto-on)
+ (add-hook 'org-remark-source-find-file-name-functions
+ #'org-remark-eww-find-file-name)
+ (add-hook 'org-remark-highlight-link-to-source-functions
+ #'org-remark-eww-highlight-link-to-source))
+ ;; Disable
+ (remove-hook 'eww-after-render-hook #'org-remark-auto-on)
+ (remove-hook 'org-remark-source-find-file-name-functions
+ #'org-remark-eww-find-file-name)
+ (remove-hook 'org-remark-highlight-link-to-source-functions
+ #'org-remark-eww-highlight-link-to-source)))
(defun org-remark-eww-find-file-name ()
+ "Return URL without the protocol as the file name for the website.
+It assumes the buffer is the source website to be annotated.
+This function is meant to be set to hook
+`org-remark-source-find-file-name-functions'."
(when (eq major-mode 'eww-mode)
(let ((url-parsed (url-generic-parse-url (eww-current-url))))
(concat (url-host url-parsed) (url-filename url-parsed)))))
(defun org-remark-eww-highlight-link-to-source (filename)
+ "Return URL pointinting to the source website (FILENAME).
+It assumes https:
+This function is meant to be set to hook
+`org-remark-highlight-link-to-source-functions'."
(when (eq major-mode 'eww-mode)
;;; FIXME we shhould not assume https?
(concat "[[https://" filename "]]")))
diff --git a/org-remark-global-tracking.el b/org-remark-global-tracking.el
index bdb288ccf3..a2b70ea8fb 100644
--- a/org-remark-global-tracking.el
+++ b/org-remark-global-tracking.el
@@ -5,7 +5,7 @@
;; Author: Noboru Ota <me@nobiot.com>
;; URL: https://github.com/nobiot/org-remark
;; Created: 15 August 2021
-;; Last modified: 23 December 2022
+;; Last modified: 24 December 2022
;; Package-Requires: ((emacs "27.1") (org "9.4"))
;; Keywords: org-mode, annotation, note-taking, marginal-notes, wp
@@ -55,6 +55,12 @@ suffix to the file name without the extension."
(file "marginalia.org")
(function org-remark-notes-file-name-function)))
+(defcustom org-remark-highlight-link-to-source-functions nil
+ "Abnormal hook called to create a link to source in notes file.
+Each one is called with FILENAME as an argument."
+ :group 'org-remark
+ :type '(repeat function))
+
;;;###autoload
(define-minor-mode org-remark-global-tracking-mode
"Automatically activates local minor mode `org-remark-mode'.
@@ -72,58 +78,6 @@ readable, the function automatically activates `org-remark'."
;; Disable
(remove-hook 'find-file-hook #'org-remark-auto-on)))
-;;; Modules
-;; This needs to be defined after the minor mode as the hook needs to
-;; have been defined.
-
-;; Note the sequence of symbol definition in the modules section is
-;; significant. The hook needs to be defined before the module set
-;; function.
-(defcustom org-remark-source-find-file-name-functions '(buffer-name)
- "Abnormal hook called to find the source file name.
-Each one is called with argument until a non-nil value is
-returned.
-
-Org-remark runs this hook when the buffer in question does not
-visit a file; this is why the `buffer-file-name' cannot be used
-and a special function is required for each context. Each
-module (`org-remark-modules') is supposed to provide and set an
-appropriate function to this hook.
-
-Assume that the current buffer is the source buffer when the function is
-called, which can be used to find the file name."
- :group 'org-remark
- :type '(repeat function))
-
-(defcustom org-remark-highlight-link-to-source-functions nil
- "Abnormal hook called to create a link to source in notes file.
-Each one is called with FILENAME as an argument."
- :group 'org-remark
- :type '(repeat function))
-
-(defun org-remark-modules-set (symbol value)
- "Enable the modules set in user option `org-remark-modules'.
-Set SYMBOL and VALUE for `org-remark-modules'."
- (set symbol value)
- (dolist (module value)
- (let ((feat (intern (concat "org-remark-" (symbol-name module))))
- (fn (intern (concat "org-remark-"
- (symbol-name module)
- "-enable"))))
- (require feat)
- (when (functionp fn)
- ;; As minor mode would have been already activated, run the
- ;; function once and then set the hook
- (funcall fn)
- (add-hook 'org-remark-global-tracking-mode-hook fn)))))
-
-(defcustom org-remark-modules (list 'eww)
- "List of modules enabled for Org-remark."
- :group 'org-remark
- :set #'org-remark-modules-set
- :type
- '(set (const :tag "Org-remark in EWW" eww)))
-
;;; Functions
(defun org-remark-notes-file-name-function ()
"Return a marginal notes file name for the current buffer.
- [elpa] externals/org-remark updated (6779999bda -> 2f8b05259b), ELPA Syncer, 2022/12/24
- [elpa] externals/org-remark 1426ccf3b0 6/8: fix: case for highlight-get-text empty notes at the bottom of buffer, ELPA Syncer, 2022/12/24
- [elpa] externals/org-remark dd273eae59 1/8: disply annotation text as help-echo prop, ELPA Syncer, 2022/12/24
- [elpa] externals/org-remark 7995630552 2/8: update help-echo prop on save., ELPA Syncer, 2022/12/24
- [elpa] externals/org-remark 5e91b35cfc 5/8: style: get-text should be org-remark-highlight (singular), ELPA Syncer, 2022/12/24
- [elpa] externals/org-remark 42126b609e 7/8: style: silence package-lint, ELPA Syncer, 2022/12/24
- [elpa] externals/org-remark e73dc29ca2 4/8: fix: help-echo to work with create and change, ELPA Syncer, 2022/12/24
- [elpa] externals/org-remark 8e66af27d4 3/8: Merge branch 'echo-text', ELPA Syncer, 2022/12/24
- [elpa] externals/org-remark 2f8b05259b 8/8: refactor: remove modules; prfere global minor mode,
ELPA Syncer <=