summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Parker <nparker@zetetic.net>2013-05-13 13:36:34 -0500
committerNick Parker <nparker@zetetic.net>2013-05-13 13:36:34 -0500
commit9d98c096bc5e87a027666a8e6e769aff33232134 (patch)
treeb0e1c95c9167e2c79ce33b90606d417207aa7df1
parent89d8e496f16bcd389c147aef448f1199e412f865 (diff)
downloadgeiser-9d98c096bc5e87a027666a8e6e769aff33232134.tar.gz
geiser-9d98c096bc5e87a027666a8e6e769aff33232134.tar.bz2
Add geiser-eval-buffer & geiser-eval-buffer-and-go
These functions are similar to geiser-eval-region and geiser-eval-region-and-go, however they allow the user to operate on the entire buffer, not requiring the user to narrow to a specific region. This also differs slightly from geiser-compile-current-buffer as geiser-eval-buffer does not require the contents of the buffer to be saved prior to being sent to the REPL. Documentaion has also been updated to include references to the new methods and their keybindings.
-rw-r--r--README2
-rw-r--r--doc/cheat.texi6
-rw-r--r--doc/parens.texi4
-rw-r--r--elisp/geiser-mode.el25
4 files changed, 37 insertions, 0 deletions
diff --git a/README b/README
index a581ce3..3537cea 100644
--- a/README
+++ b/README
@@ -95,6 +95,8 @@
| C-x C-e | Eval sexp before point |
| C-c C-r | Eval region |
| C-c M-r | Eval region and switch to REPL |
+ | C-c C-b | Eval buffer |
+ | C-c M-b | Eval buffer and switch to REPL |
|-------------+-------------------------------------------------|
| C-c C-m x | Macro-expand definition around point |
| C-c C-m e | Macro-expand sexp before point |
diff --git a/doc/cheat.texi b/doc/cheat.texi
index 76a2330..f027b64 100644
--- a/doc/cheat.texi
+++ b/doc/cheat.texi
@@ -61,6 +61,12 @@ third key not modified by @key{Control}; e.g.,
@item C-c M-r
@tab @code{geiser-eval-region-and-go}
@tab Eval region and switch to REPL
+@item C-c C-b
+@tab @code{geiser-eval-buffer}
+@tab Eval buffer
+@item C-c M-b
+@tab @code{geiser-eval-buffer-and-go}
+@tab Eval buffer and switch to REPL
@item @tab @tab
@item C-c C-m C-x
@tab @code{geiser-expand-definition}
diff --git a/doc/parens.texi b/doc/parens.texi
index 3ca9390..869643d 100644
--- a/doc/parens.texi
+++ b/doc/parens.texi
@@ -451,6 +451,10 @@ way, but it also teleports you to REPL after the evaluation.
region. Again, there's an @i{and-go} version available,
@code{geiser-eval-region-and-go}, bound to @kbd{C-c M-r}.
+@code{geiser-eval-buffer}, bound to @kbd{C-c C-b}, evals the current
+buffer. There is a @i{and-go} version available,
+@code{geiser-eval-buffer-and-go}, bound to @kbd{C-c M-b}.
+
@cindex evaluating images
@cindex image display
For all the commands above, the result of the evaluation is displayed in
diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el
index 4d43d1b..b5c10fd 100644
--- a/elisp/geiser-mode.el
+++ b/elisp/geiser-mode.el
@@ -93,6 +93,29 @@ With prefix, goes to the REPL buffer afterwards (as
(interactive "r")
(geiser-eval-region start end t))
+(defun geiser-eval-buffer (&optional and-go raw nomsg)
+ "Eval the current buffer in the Geiser REPL.
+
+With prefix, goes to the REPL buffer afterwards (as
+`geiser-eval-buffer-and-go')"
+ (interactive "P")
+ (let ((start (point-min))
+ (end (point-max)))
+ (save-restriction
+ (narrow-to-region start end)
+ (check-parens))
+ (geiser-debug--send-region nil
+ start
+ end
+ (and and-go 'geiser--go-to-repl)
+ (not raw)
+ nomsg)))
+
+(defun geiser-eval-buffer-and-go ()
+ "Eval the current buffer in the Geiser REPL and visit it afterwads."
+ (interactive)
+ (geiser-eval-buffer t))
+
(defun geiser-eval-definition (&optional and-go)
"Eval the current definition in the Geiser REPL.
@@ -309,6 +332,8 @@ interacting with the Geiser REPL is at your disposal.
("Eval region" "\C-c\C-r" geiser-eval-region :enable mark-active)
("Eval region and go" "\C-c\M-r" geiser-eval-region-and-go
geiser-eval-region :enable mark-active)
+ ("Eval buffer" "\C-c\C-b" geiser-eval-buffer)
+ ("Eval buffer and go" "\C-c\M-b" geiser-eval-buffer-and-go)
;; ("Compile definition" "\C-c\M-c" geiser-compile-definition)
;; ("Compile definition and go" "\C-c\C-c" geiser-compile-definition-and-go)
(menu "Macroexpand"