Fix bug in spacemacs//cider-eval-in-repl-no-focus

- Move to point-max before inserting text.
- Only indent the newly inserted form instead of the whole buffer.
This commit is contained in:
luxbock 2015-08-14 16:41:00 +07:00 committed by syl20bnr
parent 534dd9a5db
commit 7240654d32

View file

@ -45,12 +45,13 @@
(defun spacemacs//cider-eval-in-repl-no-focus (form)
"Insert FORM in the REPL buffer and eval it."
(let ((start-pos (point)))
(while (string-match "\\`[ \t\n\r]+\\|[ \t\n\r]+\\'" form)
(setq form (replace-match "" t t form)))
(with-current-buffer (cider-current-repl-buffer)
(while (string-match "\\`[ \t\n\r]+\\|[ \t\n\r]+\\'" form)
(setq form (replace-match "" t t form)))
(with-current-buffer (cider-current-repl-buffer)
(let ((pt-max (point-max)))
(goto-char pt-max)
(insert form)
(indent-region start-pos (point))
(indent-region pt-max (point))
(cider-repl-return))))
(defun spacemacs/cider-send-last-sexp-to-repl ()