branch: externals/org-transclusion
commit f7146e742910fad428947f97d475bd204df1178a
Author: Noboru Ota <[email protected]>
Commit: Noboru Ota <[email protected]>

    refac: org-transclusion-font-lock can be activated independently
    
     By default, org-transclusion-font-lock does not need to be explicitly
     configured as it will be automatically activated via
     `org-transclusion-extensions'. `org-transclusion-font-lock' is set to be 
active
     by default).
    
     Alternatively, you can set it up without loading the whole 
`org-transclusion'
     library.
    
     (use-package org-transclusion-font-lock
      :after org
      :config (org-transclusion-font-lock-mode +1))
---
 org-transclusion-font-lock.el | 36 ++++++++++++++++++------------------
 test/test-2.0.org             | 16 ++++++++--------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/org-transclusion-font-lock.el b/org-transclusion-font-lock.el
index 775e632997..4f3b68b76e 100644
--- a/org-transclusion-font-lock.el
+++ b/org-transclusion-font-lock.el
@@ -17,16 +17,27 @@
 
 ;; Author: Noboru Ota <[email protected]>
 ;; Created: 22 August 2021
-;; Last modified: 18 December 2025
+;; Last modified: 19 December 2025
 
 ;;; Commentary:
 ;;  This file is part of Org-transclusion
 ;;  URL: https://github.com/nobiot/org-transclusion
+;;
+;;  By default, this library does not need to be explicitly configured as it
+;;  will be automatically activated via `org-transclusion-extensions' (part of
+;;  `org-transclusion') (`org-transclusion-font-lock' is set to be active by
+;;  default).
+;;
+;;  Alternatively, you can set it up without loading the whole
+;;  `org-transclusion' library.
+;;
+;;  (use-package org-transclusion-font-lock
+;;   :after org
+;;   :config (org-transclusion-font-lock-mode +1))
 
 ;;; Code:
 
 (require 'org)
-(require 'org-transclusion)
 
 ;;;###autoload
 (define-minor-mode org-transclusion-font-lock-mode ()
@@ -34,26 +45,15 @@
   :global t
   :group 'org-transclusion
   (if org-transclusion-font-lock-mode
-      (org-transclusion-extension-functions-add-or-remove
-       org-transclusion-font-lock-extension-functions)
-    (org-transclusion-extension-functions-add-or-remove
-     org-transclusion-font-lock-extension-functions :remove)))
-
-(defvar org-transclusion-font-lock-extension-functions
-  (list (cons 'org-mode-hook #'org-transclusion-font-lock-set))
-  "Alist of functions to activate `org-transclusion-font-lock'.
-CAR of each cons cell is a symbol name of an abnormal hook
-\(*-functions\). CDR is either a symbol or list of symbols, which
-are names of functions to be called in the corresponding abnormal
-hook.")
+      (add-hook 'org-mode-hook #'org-transclusion-font-lock-set)
+    (remove-hook 'org-mode-hook #'org-transclusion-font-lock-set)))
 
 (defface org-transclusion-keyword
   '((((class color) (min-colors 88) (background light))
-     :foreground "#0030b4")
+     :inherit font-lock-keyword-face)
     (((class color) (min-colors 88) (background dark))
-     :foreground "#34cfff")
-    (t
-     :foreground "darkgray"))
+     :inherit font-lock-keyword-face)
+    (t :inherit font-lock-keyword-face))
   "Face for #+transclude keyword."
   :group 'org-transclusion)
 
diff --git a/test/test-2.0.org b/test/test-2.0.org
index 78050504df..9091d2dd8d 100644
--- a/test/test-2.0.org
+++ b/test/test-2.0.org
@@ -5,7 +5,7 @@ This is the first section before the first headline.
 * Regression
 ** notmuch
 
-   #+transclude: [[notmuch:id:[email protected]]]
+   #+transclude: 
[[notmuch:id:[email protected]][notmuch email]]
 
    [[notmuch:id:[email protected]]]
 
@@ -20,7 +20,7 @@ This is the first section before the first headline.
    #+transclude: [[file:paragraph.org::non-exisitent]]
    => Should not transclude anything
 
-#+transclude: [[paragraph.tx]]
+   #+transclude: [[paragraph.tx]]
 
 ** make from link -- ID and ID with search option
 This is a link to a [[id:2022-05-30T203553][Bertrand Russell]] wikipedia 
excerpt
@@ -44,16 +44,16 @@ ID with "first section" [[id:2022-06-26T152831]]
 
 ** test text
 
-#+transclude: [[file:test.txt][text file]]
-#+transclude: [[file:test.txt][text file]]
+   #+transclude: [[file:test.txt][text file]]
+   #+transclude: [[file:test.txt][text file]]
 
-Below are tesing the new ~org-transclusion-fix-common-misspelling~ function.
+   Below are tesing the new ~org-transclusion-fix-common-misspelling~ function.
 
-    #+transclude: [[file:test.txt][text file]]
+   #+transclude: [[file:test.txt][text file]]
 
-    #+transclude [[file:test.txt][text file]]
+   #+transclude [[file:test.txt][text file]]
 
-#+trans [[file:test.txt][text file]]
+   #+trans [[file:test.txt][text file]]
 
 ** test t/nil
 t/nil will be dropped after remove-at-point

Reply via email to