diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-09-25 05:10:00 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-09-25 05:10:00 +0200 |
commit | 5c08caccbec41d9c14781ece9a336f91da2c7ab8 (patch) | |
tree | 50ba59d50e70e83102a1c37fc2c5b5eedb90f221 /elisp/geiser-repl.el | |
parent | 401a15abc2302ccc870c1df386e5b7cb9880ab43 (diff) | |
download | geiser-5c08caccbec41d9c14781ece9a336f91da2c7ab8.tar.gz geiser-5c08caccbec41d9c14781ece9a336f91da2c7ab8.tar.bz2 |
Scheme version checks
And, if you happen to be launching it all the time, a way of skipping
them via a customizable variable.
Should address issue #15.
Diffstat (limited to 'elisp/geiser-repl.el')
-rw-r--r-- | elisp/geiser-repl.el | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index 68e4708..ebb74c2 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -105,6 +105,16 @@ expression, if any." :type 'boolean :group 'geiser-repl) +(geiser-custom--defcustom geiser-repl-skip-version-check-p nil + "Whether to skip version checks for the Scheme executable. + +When set, Geiser won't check the version of the Scheme +interpreter when starting a REPL, saving a few tenths of a +second. +" + :type 'boolean + :group 'geiser-repl) + (geiser-custom--defcustom geiser-repl-query-on-exit-p nil "Whether to prompt for confirmation on \\[geiser-repl-exit]." :type 'boolean @@ -188,6 +198,13 @@ module command as a string") (geiser-impl--define-caller geiser-repl--exit-cmd exit-command () "Function returning the REPL exit command as a string") +(geiser-impl--define-caller geiser-repl--version version-command (binary) + "Function returning the version of the corresponding scheme process, + given its full path.") + +(geiser-impl--define-caller geiser-repl--min-version minimum-version () + "A variable providing the minimum required scheme version, as a string.") + ;;; Geiser REPL buffers and processes: @@ -355,6 +372,13 @@ module command as a string") geiser-repl-query-on-kill-p) (message "%s up and running!" (geiser-repl--repl-name impl)))) +(defun geiser-repl--check-version (impl) + (when (not geiser-repl-skip-version-check-p) + (let ((v (geiser-repl--version impl (geiser-repl--binary impl))) + (r (geiser-repl--min-version impl))) + (when (geiser--version< v r) + (error "Geiser requires %s version %s but detected %s" impl r v))))) + (defun geiser-repl--start-scheme (impl address prompt) (setq comint-prompt-regexp prompt) (let* ((name (geiser-repl--repl-name impl)) @@ -363,6 +387,7 @@ module command as a string") `(,(geiser-repl--binary impl) nil ,@(geiser-repl--arglist impl))))) + (when (not address) (geiser-repl--check-version impl)) (condition-case err (apply 'make-comint-in-buffer `(,name ,buff ,@args)) (error (insert "Unable to start REPL:\n" |