From 48b70f4bcee81de0d2a61eb2310ed08ab4e306f3 Mon Sep 17 00:00:00 2001 From: Nick Parker Date: Mon, 13 May 2013 13:36:34 -0500 Subject: 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. --- elisp/geiser-mode.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'elisp') 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" -- cgit v1.2.3