diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2014-01-10 06:20:05 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2014-01-10 06:20:05 +0100 |
commit | 0a0d8c9b7bde63362e8336d089ab2066669e9f71 (patch) | |
tree | 7c0244dddc1c9794595e9fa6bdfafb123e420127 | |
parent | 5655afa27b5eb4b2f75c923ad4de178ab8ae27a1 (diff) | |
download | geiser-0a0d8c9b7bde63362e8336d089ab2066669e9f71.tar.gz geiser-0a0d8c9b7bde63362e8336d089ab2066669e9f71.tar.bz2 |
Racket: better behaviour of geiser-eval-buffer
For buffers containing a #lang directive, geiser-eval-buffer was simply
broken: one cannot send the whole region wrapped in a `begin' in that
case.
We try now to send the region below, although a real solution would
imply using #%module-begin as the wrapper, in order to be robust for
languages that define their own version of the macro (such as TR).
But people should use C-c C-a or C-c C-k and leave this silly function
alone instead.
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | elisp/geiser-mode.el | 21 |
2 files changed, 12 insertions, 12 deletions
@@ -4,6 +4,9 @@ - Better support for Typed Racket: (re)definitions now work for typed/racket modules (thanks to Sam Tobin-Hochstadt). + - Better behaviour for geiser-eval-buffer in racket + buffers that contain a #lang directive. But you'd better use C-c + C-k instead. * Version 0.5 (Dec 9, 2013) 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." |