summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-01-28 23:54:54 -0500
committerKyle Meyer <kyle@kyleam.com>2015-01-28 23:54:54 -0500
commitdbfe526b1e96eb825084d8d4f6da31160878d97f (patch)
tree743b190bd858493d14e9b71350b4243e4d8b0bfa
parent1b9f75009ec9021533c1463e40646ed75482e89a (diff)
downloademacs.d-dbfe526b1e96eb825084d8d4f6da31160878d97f.tar.gz
Send up to line, not point, to Python shell
-rw-r--r--lisp/init-python.el11
1 files changed, 4 insertions, 7 deletions
diff --git a/lisp/init-python.el b/lisp/init-python.el
index 2003777..7961920 100644
--- a/lisp/init-python.el
+++ b/lisp/init-python.el
@@ -61,13 +61,10 @@ This is inspired by `ess-eval-function-or-paragraph-and-step'."
(goto-char end)))
(km/python-next-code-line 1))
-(defun km/python-shell-send-buffer-up-to-point ()
- "Send from beginning of buffer up until point to Python shell."
+(defun km/python-shell-send-buffer-up-to-line ()
+ "Send beginning of buffer to the current line to Python shell."
(interactive)
- (save-excursion
- (setq end (point))
- (goto-char (point-min))
- (python-shell-send-region (point) end)))
+ (python-shell-send-region (point-min) (line-end-position)))
(defun km/python-inside-defun-p ()
;; I don't use `python-nav-beginning-of-defun' because it will go to
@@ -107,7 +104,7 @@ This is inspired by `ess-eval-function-or-paragraph-and-step'."
(key-chord-define python-mode-map ";w" 'auto-complete)
(define-key python-mode-map (kbd "C-c C-.")
- 'km/python-shell-send-buffer-up-to-point)
+ 'km/python-shell-send-buffer-up-to-line)
(define-key python-mode-map (kbd "C-c C-b") 'python-shell-send-buffer)
;; Rebind `python-shell-send-buffer'.
(define-key python-mode-map (kbd "C-c C-c")