summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-11-30 13:33:43 +0000
committerjao <jao@gnu.org>2022-11-30 13:33:43 +0000
commit47bb86d6829ffa81ec021ee6217379b216d95bfc (patch)
treebb3ebd9ddc48a46f630a962ea0c6e07672f88e02
parenta29ad0533090e804f84b72c064a595b35c077977 (diff)
downloadgeiser-47bb86d6829ffa81ec021ee6217379b216d95bfc.tar.gz
geiser-47bb86d6829ffa81ec021ee6217379b216d95bfc.tar.bz2
make autoloads more lazy (Stefan Monnier)
Thanks to Stefan's patience and actual implementation, we now don't load all of geiser-impl.el and its dependencies just because there's a call geiser-activate-implementation in geiser-<impl>-autoloads.el.
-rw-r--r--elisp/geiser-impl.el24
-rw-r--r--elisp/geiser.el4
2 files changed, 15 insertions, 13 deletions
diff --git a/elisp/geiser-impl.el b/elisp/geiser-impl.el
index cd702ca..3034cb3 100644
--- a/elisp/geiser-impl.el
+++ b/elisp/geiser-impl.el
@@ -28,10 +28,12 @@
"Symbol naming the default Scheme implementation."
:type 'symbol)
+;;;###autoload (defvar geiser-active-implementations nil)
(geiser-custom--defcustom geiser-active-implementations ()
"List of active installed Scheme implementations."
:type '(repeat symbol))
+;;;###autoload (defvar geiser-implementations-alist nil)
(geiser-custom--defcustom geiser-implementations-alist nil
"A map from regular expressions or directories to implementations.
When opening a new file, its full path will be matched against
@@ -140,8 +142,10 @@ in order to determine its scheme flavour."
(push (cons impl methods) geiser-impl--registry))
(push (cons impl file) geiser-impl--load-files)))
+;;;###autoload
+(progn ;Copy the whole def to the autoloads file.
(defun geiser-activate-implementation (impl)
- (add-to-list 'geiser-active-implementations impl))
+ (add-to-list 'geiser-active-implementations impl)))
(defsubst geiser-deactivate-implementation (impl)
(setq geiser-active-implementations
@@ -235,13 +239,14 @@ switcher (geiser-NAME-switch), and provides geiser-NAME."
(geiser-menu--add-impl ',name ',runner ',switcher)))))
;;;###autoload
-(defun geiser-impl--add-to-alist (kind what impl &optional append)
- (add-to-list 'geiser-implementations-alist
- (list (list kind what) impl) append))
+(progn
+ (defun geiser-impl--add-to-alist (kind what impl &optional append)
+ (add-to-list 'geiser-implementations-alist
+ (list (list kind what) impl) append))
-(defun geiser-implementation-extension (impl ext)
- "Add to `geiser-implementations-alist' an entry for extension EXT."
- (geiser-impl--add-to-alist 'regexp (format "\\.%s\\'" ext) impl t))
+ (defun geiser-implementation-extension (impl ext)
+ "Add to `geiser-implementations-alist' an entry for extension EXT."
+ (geiser-impl--add-to-alist 'regexp (format "\\.%s\\'" ext) impl t)))
;;; Trying to guess the scheme implementation:
@@ -274,8 +279,7 @@ buffer contains Scheme code of the given implementation.")
(defun geiser-impl--guess (&optional prompt)
(or geiser-impl--implementation
(progn (hack-local-variables)
- (and (memq geiser-scheme-implementation
- geiser-active-implementations)
+ (and (geiser-impl--active-p geiser-scheme-implementation)
geiser-scheme-implementation))
(and (null (cdr geiser-active-implementations))
(car geiser-active-implementations))
@@ -286,7 +290,7 @@ buffer contains Scheme code of the given implementation.")
(let ((bn (buffer-file-name)))
(when bn
(dolist (x geiser-implementations-alist)
- (when (and (memq (cadr x) geiser-active-implementations)
+ (when (and (geiser-impl--active-p (cadr x))
(geiser-impl--match-impl (car x) bn))
(throw 'impl (cadr x)))))))
geiser-default-implementation
diff --git a/elisp/geiser.el b/elisp/geiser.el
index 63a308b..70e2716 100644
--- a/elisp/geiser.el
+++ b/elisp/geiser.el
@@ -100,11 +100,9 @@
(autoload 'turn-off-geiser-mode "geiser-mode"
"Disable Geiser's mode (useful in Scheme buffers)." t)
-;;;###autoload
(autoload 'geiser-activate-implementation "geiser-impl"
"Register the given implementation as active.")
-;;;###autoload
(autoload 'geiser-implementation-extension "geiser-impl"
"Register a file extension as handled by a given implementation.")
@@ -130,7 +128,7 @@
(autoload 'geiser-mode--maybe-activate "geiser-mode")
;;;###autoload
-(add-hook 'scheme-mode-hook 'geiser-mode--maybe-activate)
+(add-hook 'scheme-mode-hook #'geiser-mode--maybe-activate)
(provide 'geiser)
;;; geiser.el ends here