summaryrefslogtreecommitdiff
path: root/elisp/geiser-mode.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2022-07-14 16:06:12 +0200
committerJonas Bernoulli <jonas@bernoul.li>2024-07-06 17:37:23 +0200
commit67f727855895050aca3bcf37066e804dc8f307de (patch)
tree3259c69d275cdd20b4479eaa469414edf0d0b568 /elisp/geiser-mode.el
parentde52f0e36f1709181c1ce4e787d79208fa2cb870 (diff)
downloadgeiser-67f727855895050aca3bcf37066e804dc8f307de.tar.gz
geiser-67f727855895050aca3bcf37066e804dc8f307de.tar.bz2
Define autoloads how that is normally done
- Avoid defining autoload definitions in a central location. Instead add autoload cookies to the forms/definitions that should be autoloaded, in the locations where the actual definitions are located. - Do this for `geiser-mode', `turn-on-geiser-mode', `geiser-mode--maybe-activate' (including adding that to `scheme-mode-hook'), `geiser', `geiser-connect', `geiser-connect-local' and `geiser-repl-switch'. - Also do this for `run-geiser', even though it is only an obsolete function alias for `geiser', which might make it desirable to drop the autoload altogether. Some unusual autoload definitions remain in "geiser.el", see below. - One issue with defining autoloads in a central location is that it is easy to forget to remove such autoloads when the real definition is removed. No longer autoload `geiser-version' because since [1: 847d2ad] there no longer exists a proper definition of that function. - No longer autoload `geiser-unload', `geiser-reload' and `turn-off-geiser-mode', because they are only useful if Geiser has already been loaded, at which point any autoloaded definitions are no longer relevant. However, - Keep autoloading `geiser-activate-implementation' and `geiser-implementation-extension', even though I doubt that this is actually useful. - Keep using `custom-add-load' to specify dependencies of Custom groups and keep autoloading that. I don't know if this is actually necessary, and while it seems really weird, it might served a legit purpose, that I am not aware of. 1: 2020-07-19 847d2ad4c6da462c26c50af1ef7d9cd697f3a5d2 scheme and autotools removals
Diffstat (limited to 'elisp/geiser-mode.el')
-rw-r--r--elisp/geiser-mode.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el
index c8a9e0d..d5bfbfb 100644
--- a/elisp/geiser-mode.el
+++ b/elisp/geiser-mode.el
@@ -367,6 +367,7 @@ With prefix, try to enter the current buffer's module."
(or geiser-mode-string
(format " %s" (or (geiser-impl--impl-str) "G"))))
+;;;###autoload
(define-minor-mode geiser-mode
"Toggle Geiser's mode.
@@ -395,6 +396,7 @@ interacting with the Geiser REPL is at your disposal.
(not (geiser-repl--connection*)))
(save-window-excursion (geiser geiser-impl--implementation))))
+;;;###autoload
(defun turn-on-geiser-mode ()
"Enable `geiser-mode' (in a Scheme buffer)."
(interactive)
@@ -405,10 +407,14 @@ interacting with the Geiser REPL is at your disposal.
(interactive)
(geiser-mode -1))
+;;;###autoload
(defun geiser-mode--maybe-activate ()
(when (and geiser-mode-auto-p (eq major-mode 'scheme-mode))
(turn-on-geiser-mode)))
+;;;###autoload
+(add-hook 'scheme-mode-hook 'geiser-mode--maybe-activate)
+
;;; Reload support: