New answers tagged

0

Based on @muffinmad's answer: (defun my/python-navigate-up-to-class-statement () (interactive) (let ((pos nil)) (while (not (equal pos (point))) (setf pos (point)) (python-nav-backward-up-list)))) (defun my/python-navigate-to-next-python-class () (interactive) (my/python-navigate-up-to-class-statement) (end-of-defun) (end-of-...


1

What I found so far and use to navigate between classes in python-mode: First C-M-u which runs the command python-nav-backward-up-list to navigate up to class definition. After that C-M-a (beginning-of-defun) and C-M-e (end-of-defun) to navigate to previous and next class definition respectively.


3

Use C-u C-c C-c. See python-shell-buffer-substring function docstring: When optional argument NOMAIN is non-nil everything under an if __name__ == '__main__' block will be removed. And python-shell-send-buffer: When optional argument SEND-MAIN is non-nil, allow execution of code inside blocks delimited by if __name__== '__main__':. When called ...


0

Try usimng ipython blocks instead of python (#+BEGIN_SRC ipython) and add the following line to your first source block: %matplotlib inline Note - I'm not sure if this will work with Spacemacs, but it is what scimax is all about. I used Spacemacs for about 6 months for python and jupyter notebooks before I switched to scimax for org-mode and never looked ...


0

Customize python-shell-interpreter to something else than python.


1

You could use M-x compile with an appropriate compile-command value. e.g. as a file-local variable: # -*- compile-command: "python file.py"; -*- Emacs will prompt you to save (or not) the file before running the command.


1

Use M-! (M-x shell-command) if you want to run a shell command, e.g. python file.py and print the output in a new buffer (*Shell Command Output*). That does not open a shell in a new buffer. Use M-x shell to run a shell in a new buffer as pointed by @NickD.


Top 50 recent answers are included