summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-13 02:31:39 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-13 02:31:39 +0100
commit69efb94a50ca6e8120a7a08d6ccf8216625c8519 (patch)
tree242f3726d8aea0717aad7599c85904537c666825
parent1853b281918ea8c6e143ed1cfe1950189956d076 (diff)
downloadgeiser-guile-69efb94a50ca6e8120a7a08d6ccf8216625c8519.tar.gz
geiser-guile-69efb94a50ca6e8120a7a08d6ccf8216625c8519.tar.bz2
geiser-mode-auto-p: automatic geiser-mode is now optional
It hadn't occurred to me that anyone wouldn't want non-automatic geiser-mode often enough to require its own customization variable. Rotty proved me wrong. Or maybe not, but he deserves a custom var!
-rw-r--r--doc/parens.texi9
-rw-r--r--elisp/geiser-mode.el9
-rw-r--r--elisp/geiser.el4
3 files changed, 15 insertions, 7 deletions
diff --git a/doc/parens.texi b/doc/parens.texi
index 78149e5..8068d51 100644
--- a/doc/parens.texi
+++ b/doc/parens.texi
@@ -58,12 +58,9 @@ Since @i{geiser-mode} is a minor mode, you can toggle it with
@kbd{M-x geiser-mode}, and control its activation in hooks with the
functions @code{turn-on-geiser-mode} and @code{turn-off-geiser-mode}.
If, for some reason i cannot fathom, you prefer @i{geiser-mode} not
-to be active by default, the following elisp incantation will do the
-trick:
-@example
-(eval-after-load "geiser"
- (remove-hook 'scheme-mode-hook 'turn-on-geiser-mode))
-@end example
+to be active by default, customizing @code{geiser-mode-auto-p} to
+@code{nil} will do the trick.
+
@cindex scheme file extensions
And if you happen to use a funky extension for your Scheme files that is
not recognised as such by Emacs, just tell her about it with:
diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el
index 719176d..8f8b7fe 100644
--- a/elisp/geiser-mode.el
+++ b/elisp/geiser-mode.el
@@ -34,6 +34,12 @@
"Mode enabling Geiser abilities in Scheme buffers &co.."
:group 'geiser)
+(geiser-custom--defcustom geiser-mode-auto-p t
+ "Whether `geiser-mode' should be active by default in all
+scheme buffers."
+ :group 'geiser-mode
+ :type 'boolean)
+
(geiser-custom--defcustom geiser-mode-autodoc-p t
"Whether `geiser-autodoc-mode' gets enabled by default in Scheme buffers."
:group 'geiser-mode
@@ -250,6 +256,9 @@ interacting with the Geiser REPL is at your disposal.
(interactive)
(geiser-mode -1))
+(defun geiser-mode--maybe-activate ()
+ (when geiser-mode-auto-p (turn-on-geiser-mode)))
+
;;; Keys:
diff --git a/elisp/geiser.el b/elisp/geiser.el
index d40b6a8..d293423 100644
--- a/elisp/geiser.el
+++ b/elisp/geiser.el
@@ -67,6 +67,8 @@
(autoload 'turn-off-geiser-mode "geiser-mode"
"Disable Geiser's mode (useful in Scheme buffers)." t)
+(autoload 'geiser-mode--maybe-activate "geiser-mode")
+
(mapc (lambda (group)
(custom-add-load group (symbol-name group))
(custom-add-load 'geiser (symbol-name group)))
@@ -85,7 +87,7 @@
;;; Setup:
(eval-after-load "scheme"
- '(add-hook 'scheme-mode-hook 'turn-on-geiser-mode))
+ '(add-hook 'scheme-mode-hook 'geiser-mode--maybe-activate))
(add-to-list 'auto-mode-alist '("\\.rkt\\'" . scheme-mode))