From c76186ccc383593342439b2e02096a00573a5296 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 13 Sep 2014 01:48:21 -0400 Subject: Add python-shell-send-buffer-up-to-point --- lisp/init-python.el | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lisp/init-python.el') 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) -- cgit v1.2.3