diff options
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | elisp/geiser-guile.el | 5 | ||||
-rw-r--r-- | elisp/geiser-mode.el | 10 | ||||
-rw-r--r-- | elisp/geiser-plt.el | 6 | ||||
-rw-r--r-- | elisp/geiser-repl.el | 14 |
5 files changed, 33 insertions, 3 deletions
@@ -92,6 +92,7 @@ |---------------------+-------------------------------------------------| | C-c C-z | Switch to REPL | + | C-u C-c C-z | Switch to REPL and current module | | C-c C-s | Specify Scheme implementation for buffer | |---------------------+-------------------------------------------------| | M-. | Go to definition of identifier at point | diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 89b80d7..13fdc49 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -89,6 +89,9 @@ This function uses `geiser-guile-init-file' if it exists." (or (ignore-errors (car (read-from-string module))) :f)) (t :f))) +(defun geiser-guile--enter-command (module) + (and module (format ",m %s\n" (geiser-guile--get-module module)))) + (defun geiser-guile--symbol-begin (module) (if module (max (save-excursion (beginning-of-line) (point)) @@ -154,6 +157,7 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Implementation definition: (define-geiser-implementation guile + (unsupported-procedures '(enter-command)) (binary geiser-guile--binary) (arglist geiser-guile--parameters) (startup geiser-guile--startup) @@ -161,6 +165,7 @@ This function uses `geiser-guile-init-file' if it exists." (debugger-prompt-regexp geiser-guile--debugger-prompt-regexp) (marshall-procedure geiser-guile--geiser-procedure) (find-module geiser-guile--get-module) + ;; (enter-command geiser-guile--enter-command) (find-symbol-begin geiser-guile--symbol-begin) (display-error geiser-guile--display-error) (display-help) diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el index d083973..3e0f522 100644 --- a/elisp/geiser-mode.el +++ b/elisp/geiser-mode.el @@ -1,6 +1,6 @@ ;; geiser-mode.el -- minor mode for scheme buffers -;; Copyright (C) 2009 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -150,6 +150,12 @@ With prefix, recursively macro-expand the resulting expression." (geiser-impl--set-buffer-implementation impl) (geiser-repl--get-repl impl))) +(defun geiser-mode-switch-to-repl (arg) + "Switches to Geiser REPL. +With prefix, try to enter the current's buffer module." + (interactive "P") + (if arg (switch-to-geiser-module) (switch-to-geiser))) + ;;; Geiser mode: @@ -201,7 +207,7 @@ interacting with the Geiser REPL is at your disposal. (define-key geiser-mode-map (vector '(control ?c) `(control ,p) k) c) (define-key geiser-mode-map (vector '(control ?c) `(control ,p) `(control ,k)) c)) -(define-key geiser-mode-map "\C-c\C-z" 'switch-to-geiser) +(define-key geiser-mode-map "\C-c\C-z" 'geiser-mode-switch-to-repl) (define-key geiser-mode-map "\C-c\C-s" 'geiser-set-scheme) (define-key geiser-mode-map "\C-c\C-l" 'geiser-load-current-buffer) diff --git a/elisp/geiser-plt.el b/elisp/geiser-plt.el index d9b3ca9..c808ed5 100644 --- a/elisp/geiser-plt.el +++ b/elisp/geiser-plt.el @@ -109,6 +109,9 @@ This function uses `geiser-plt-init-file' if it exists." (defun geiser-plt--symbol-begin (module) (save-excursion (skip-syntax-backward "^-()>") (point))) +(defun geiser-plt--enter-command (module) + (and (stringp module) (format "(enter! (file %S))" module))) + ;;; External help @@ -169,13 +172,14 @@ This function uses `geiser-plt-init-file' if it exists." ;;; Implementation definition: (define-geiser-implementation plt + (unsupported-procedures '(callers callees generic-methods)) (binary geiser-plt--binary) (arglist geiser-plt--parameters) (startup) - (unsupported-procedures '(callers callees generic-methods)) (prompt-regexp geiser-plt--prompt-regexp) (marshall-procedure geiser-plt--geiser-procedure) (find-module geiser-plt--get-module) + (enter-command geiser-plt--enter-command) (find-symbol-begin geiser-plt--symbol-begin) (display-error geiser-plt--display-error) (display-help geiser-plt--external-help) diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index 2afdcef..facae50 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -227,6 +227,20 @@ If no REPL is running, execute `run-geiser' to start a fresh one." (defalias 'geiser 'switch-to-geiser) +(geiser-impl--define-caller geiser-repl--enter-cmd enter-command (module) + "Function taking a module designator and returning a REPL enter +module command as a string") + +(defun switch-to-geiser-module () + "Switch to running Geiser REPL and try to enter current module." + (interactive) + (let ((m (geiser-repl--enter-cmd geiser-impl--implementation + (geiser-eval--get-module)))) + (switch-to-geiser) + (when m + (comint-send-string nil m) + (comint-send-eof)))) + (defun geiser-repl-nuke () "Try this command if the REPL becomes unresponsive." (interactive) |