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

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

[elpa] externals/lentic 0e6e64e0b6 306/333: Autoload lentic-script-hook


From: ELPA Syncer
Subject: [elpa] externals/lentic 0e6e64e0b6 306/333: Autoload lentic-script-hook
Date: Tue, 27 Feb 2024 13:00:47 -0500 (EST)

branch: externals/lentic
commit 0e6e64e0b6b441a1cfbf6f1f06f92fdd9467ec6a
Author: Phillip Lord <phillip.lord@russet.org.uk>
Commit: Phillip Lord <phillip.lord@russet.org.uk>

    Autoload lentic-script-hook
---
 lentic-script.el | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/lentic-script.el b/lentic-script.el
index 530d21690e..5d80495674 100644
--- a/lentic-script.el
+++ b/lentic-script.el
@@ -33,13 +33,20 @@
 (defvar lentic-script-temp-location
   temporary-file-directory "/lentic-script")
 
-(defun lentic-script-hook (mode-hook init)
-  (add-to-list 'lentic-init-functions
-               init)
-  (add-hook mode-hook
-            (lambda ()
-              (unless lentic-init
-                (setq lentic-init init)))))
+;;;###autoload
+;; We need to copy this entire form into the autoloads file. If we use a
+;; normal autoload, it force loading of the entire package when it is called
+;; during autoload which defeats the point. Unfortunately, autoload files are
+;; normally dynamically bound, and we use closures. The eval form addresses
+;; both of these simultaneously.
+(eval
+ '(defun lentic-script-hook (mode-hook init)
+    (add-to-list 'lentic-init-functions init)
+    (add-hook mode-hook
+              (lambda nil
+                (unless lentic-init
+                  (setq lentic-init init)))))
+ t)
 
 (defun lentic-script--lentic-file-1 (file)
   (concat



reply via email to

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