diff options
author | jao <jao@gnu.org> | 2022-11-30 13:33:43 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-11-30 13:33:43 +0000 |
commit | 47bb86d6829ffa81ec021ee6217379b216d95bfc (patch) | |
tree | bb3ebd9ddc48a46f630a962ea0c6e07672f88e02 /elisp/geiser-impl.el | |
parent | a29ad0533090e804f84b72c064a595b35c077977 (diff) | |
download | geiser-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.
Diffstat (limited to 'elisp/geiser-impl.el')
-rw-r--r-- | elisp/geiser-impl.el | 24 |
1 files changed, 14 insertions, 10 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 |