Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes python compile command #824

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions contrib/lang/python/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -210,26 +210,24 @@ which require an initialization must be listed explicitly in the list.")
"Execute a python script in a shell."
(interactive "P")
;; set compile command to buffer-file-name
;; if buffer-file-name exists
;; otherwise error occurs on e.g. org export including python src
;; universal argument put compile buffer in comint mode
(setq universal-argument t)
(if arg
(call-interactively 'compile)
(unless compile-command

(setq compile-command (format "python %s" (file-name-nondirectory
buffer-file-name))))
(compile compile-command t)))
buffer-file-name)))
(compile compile-command t)
(with-current-buffer (get-buffer "*compilation*")
(inferior-python-mode))))

(defun spacemacs/python-execute-file-focus (arg)
"Execute a python script in a shell and switch to the shell buffer in
`insert state'."
(interactive "P")
;; set compile command to buffer-file-name
;; if buffer-file-name exists
;; otherwise error occurs on e.g. org export including python src
(spacemacs/python-execute-file arg)
(switch-to-buffer-other-window "*compilation*")
(end-of-buffer)
(evil-insert-state))

(evil-leader/set-key-for-mode 'python-mode
Expand Down