diff options
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-mode.el | 21 | ||||
-rw-r--r-- | elisp/geiser-racket.el | 10 |
2 files changed, 16 insertions, 15 deletions
diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el index b5c10fd..3bc5494 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, 2010, 2011, 2012, 2013 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 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 @@ -93,23 +93,20 @@ With prefix, goes to the REPL buffer afterwards (as (interactive "r") (geiser-eval-region start end t)) +(geiser-impl--define-caller geiser-eval--bounds eval-bounds () + "A pair with the bounds of a buffer to be evaluated, defaulting + to (cons (point-min) . (point-max)).") + (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))) + (let* ((bounds (geiser-eval--bounds geiser-impl--implementation)) + (from (or (car bounds) (point-min))) + (to (or (cdr bounds) (point-max)))) + (geiser-eval-region from to and-go raw nomsg))) (defun geiser-eval-buffer-and-go () "Eval the current buffer in the Geiser REPL and visit it afterwads." diff --git a/elisp/geiser-racket.el b/elisp/geiser-racket.el index 59886e3..e466ce3 100644 --- a/elisp/geiser-racket.el +++ b/elisp/geiser-racket.el @@ -1,6 +1,6 @@ ;; geiser-racket.el -- geiser support for Racket scheme -;; Copyright (C) 2009, 2010, 2011, 2012, 2013 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 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 @@ -137,11 +137,14 @@ using start-geiser, a procedure in the geiser/server module." (geiser-syntax--form-from-string (match-string-no-properties 1)))) "#f")) -(defun geiser-racket--implicit-module () +(defun geiser-racket--implicit-module (&optional pos) (save-excursion (goto-char (point-min)) (when (re-search-forward "^#lang " nil t) - (buffer-file-name)))) + (if pos (progn (end-of-line) (list (point))) (buffer-file-name))))) + +(defun geiser-racket--eval-bounds () + (geiser-racket--implicit-module t)) (defun geiser-racket--find-module () (let ((bf (geiser-racket--implicit-module)) @@ -428,6 +431,7 @@ Use a prefix to be asked for a submodule name." (import-command geiser-racket--import-command) (exit-command geiser-racket--exit-command) (find-symbol-begin geiser-racket--symbol-begin) + (eval-bounds geiser-racket--eval-bounds) (display-error geiser-racket--display-error) (external-help geiser-racket--external-help) (check-buffer geiser-racket--guess) |