diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-04-12 00:57:23 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-04-12 00:57:23 +0200 |
commit | 7a666d1e2da690ab45a2f40d388e47df711e4868 (patch) | |
tree | 3a6daf728702b7b6448b858e1f509961aef44bec /elisp/geiser-mode.el | |
parent | 2ebc1225b929d2a3c3b25fbd7596adb4d49915f0 (diff) | |
download | geiser-guile-7a666d1e2da690ab45a2f40d388e47df711e4868.tar.gz geiser-guile-7a666d1e2da690ab45a2f40d388e47df711e4868.tar.bz2 |
Simplifications to previous patch
Diffstat (limited to 'elisp/geiser-mode.el')
-rw-r--r-- | elisp/geiser-mode.el | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el index a47a92b..8d66a8a 100644 --- a/elisp/geiser-mode.el +++ b/elisp/geiser-mode.el @@ -72,7 +72,7 @@ active when `geiser-mode' is activated in a buffer." (push-mark) (goto-char (point-max))) -(defun geiser-eval-region (start end &optional and-go raw) +(defun geiser-eval-region (start end &optional and-go raw nomsg) "Eval the current region in the Geiser REPL. With prefix, goes to the REPL buffer afterwards (as `geiser-eval-region-and-go')" @@ -84,7 +84,8 @@ With prefix, goes to the REPL buffer afterwards (as start end (and and-go 'geiser--go-to-repl) - (not raw))) + (not raw) + nomsg)) (defun geiser-eval-region-and-go (start end) "Eval the current region in the Geiser REPL and visit it afterwads." @@ -109,21 +110,17 @@ With prefix, goes to the REPL buffer afterwards (as (defun geiser-eval-last-sexp (print-to-buffer-p) "Eval the previous sexp in the Geiser REPL. - With a prefix, print the result of the evaluation to the buffer." (interactive "P") - (let ((ret (geiser-eval-region (save-excursion (backward-sexp) (point)) - (point) - nil - t))) - (if print-to-buffer-p - (let ((str (geiser-eval--retort-result-to-buffer ret))) - ;; It's possible that a procedure returns nothing, so we - ;; don't want to `push-mark' if it's not necessary - (unless (string= "" str) - (push-mark) - (insert str))) - (message "%s" (geiser-eval--retort-result-str ret))))) + (let* ((ret (geiser-eval-region (save-excursion (backward-sexp) (point)) + (point) + nil + t + print-to-buffer-p)) + (str (geiser-eval--retort-result-str ret (when print-to-buffer-p "")))) + (when (and print-to-buffer-p (not (string= "" str))) + (push-mark) + (insert str)))) (defun geiser-compile-definition (&optional and-go) "Compile the current definition in the Geiser REPL. |