Shadow python-mode-hook during python-send-shell-*

This commit is contained in:
Trapez Breen 2019-04-13 09:31:08 +02:00 committed by smile13241324
parent 76ba46893b
commit d25b329c17
3 changed files with 34 additions and 12 deletions

View File

@ -1902,6 +1902,7 @@ Other:
- Added diminish for importmagic (thanks to Loys Ollivier)
- Added debugger integration via =dap= layer
- Added documentation on installing importmagic and epc (thanks to Trapez Breen)
- Made python-send-shell-* functions faster (thanks to Trapez Breen)
**** Racket
- Restore smart closing paren behavior in racket-mode (thanks to Don March)
**** Ranger

View File

@ -361,23 +361,44 @@ to be called for each testrunner. "
(defun spacemacs/python-shell-send-buffer-switch ()
"Send buffer content to shell and switch to it in insert mode."
(interactive)
(python-shell-send-buffer)
(python-shell-switch-to-shell)
(evil-insert-state))
(let ((python-mode-hook nil))
(python-shell-send-buffer)
(python-shell-switch-to-shell)
(evil-insert-state)))
(defun spacemacs/python-shell-send-buffer ()
"Send buffer content to shell and switch to it in insert mode."
(interactive)
(let ((python-mode-hook nil))
(python-shell-send-buffer)))
(defun spacemacs/python-shell-send-defun-switch ()
"Send function content to shell and switch to it in insert mode."
(interactive)
(python-shell-send-defun nil)
(python-shell-switch-to-shell)
(evil-insert-state))
(let ((python-mode-hook nil))
(python-shell-send-defun nil)
(python-shell-switch-to-shell)
(evil-insert-state)))
(defun spacemacs/python-shell-send-defun ()
"Send function content to shell and switch to it in insert mode."
(interactive)
(let ((python-mode-hook nil))
(python-shell-send-defun nil)))
(defun spacemacs/python-shell-send-region-switch (start end)
"Send region content to shell and switch to it in insert mode."
(interactive "r")
(python-shell-send-region start end)
(python-shell-switch-to-shell)
(evil-insert-state))
(let ((python-mode-hook nil))
(python-shell-send-region start end)
(python-shell-switch-to-shell)
(evil-insert-state)))
(defun spacemacs/python-shell-send-region (start end)
"Send region content to shell and switch to it in insert mode."
(interactive "r")
(let ((python-mode-hook nil))
(python-shell-send-region start end)))
(defun spacemacs/python-start-or-switch-repl ()
"Start and/or switch to the REPL."

View File

@ -324,12 +324,12 @@
"db" 'spacemacs/python-toggle-breakpoint
"ri" 'spacemacs/python-remove-unused-imports
"sB" 'spacemacs/python-shell-send-buffer-switch
"sb" 'python-shell-send-buffer
"sb" 'spacemacs/python-shell-send-buffer
"sF" 'spacemacs/python-shell-send-defun-switch
"sf" 'python-shell-send-defun
"sf" 'spacemacs/python-shell-send-defun
"si" 'spacemacs/python-start-or-switch-repl
"sR" 'spacemacs/python-shell-send-region-switch
"sr" 'python-shell-send-region)
"sr" 'spacemacs/python-shell-send-region)
;; Set `python-indent-guess-indent-offset' to `nil' to prevent guessing `python-indent-offset
;; (we call python-indent-guess-indent-offset manually so python-mode does not need to do it)