summaryrefslogtreecommitdiff
path: root/lisp/init-python.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-09-13 01:48:21 -0400
committerKyle Meyer <kyle@kyleam.com>2014-09-13 01:48:21 -0400
commitc76186ccc383593342439b2e02096a00573a5296 (patch)
treedb84f84c235405a0e6eacbdaaa34241d86bd3d24 /lisp/init-python.el
parent158989de65409042f4933ec2cea118e91a285257 (diff)
downloademacs.d-c76186ccc383593342439b2e02096a00573a5296.tar.gz
Add python-shell-send-buffer-up-to-point
Diffstat (limited to 'lisp/init-python.el')
-rw-r--r--lisp/init-python.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/init-python.el b/lisp/init-python.el
index c020b08..803fe35 100644
--- a/lisp/init-python.el
+++ b/lisp/init-python.el
@@ -46,6 +46,14 @@ 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."
+ (interactive)
+ (save-excursion
+ (setq end (point))
+ (goto-char (point-min))
+ (python-shell-send-region (point) end)))
+
(defun km/python-inside-defun-p ()
;; I don't use `python-nav-beginning-of-defun' because it will go to
;; the function even when the point is not inside of it.
@@ -90,6 +98,8 @@ This is inspired by `ess-eval-function-or-paragraph-and-step'."
(define-key python-mode-map (kbd "C-c C-c")
'km/python-shell-send-function-or-paragraph-and-step)
(define-key python-mode-map (kbd "C-c C-b") 'python-shell-send-buffer)
+ (define-key python-mode-map (kbd "C-c C-.")
+ 'km/python-shell-send-buffer-up-to-point)
;; Swap `python-shell-send-defun' and `python-eldoc-at-point'.
(define-key python-mode-map (kbd "C-c C-f") 'python-shell-send-defun)