python-mode

'run-python' failing on Emacs 24.3.1 for Windows, custom vendor-supplied Python2.6

余生颓废 提交于 2019-12-11 04:46:31
问题 I'm doing some work with a custom version of Python 2.6 on Windows, and would love to use emacs for this purpose. On more unixy platforms, I've never had any issue with the basic python-mode stuff, but now I'm encountering a problem when I try to use the M-x run-python command. My custom Python is on the path (i.e. can type python from a windows command prompt and get the appropriate version). Unfortunately, I simply get the following error in my *Messages* buffer when attempting to start it

Change the “send code to interpreter” (C-c |) command in python-mode

我们两清 提交于 2019-12-07 15:55:43
问题 I am used to "C-c C-r" command to send code to the interpreter in R with Emacs speaks statistics. How can I set python-mode to use "C-c C-r" rather than "C-c |" to evaulate code? Thanks! 回答1: It's already bound to C-c C-r in the built-in python.el, but here's a command that binds the key. If you're using python-mode.el, you'll have to change the library name, the command, and maybe the map. (eval-after-load "python" '(progn (define-key python-mode-map (kbd "C-c C-r") 'python-shell-send-region

Change the “send code to interpreter” (C-c |) command in python-mode

偶尔善良 提交于 2019-12-05 21:28:16
I am used to "C-c C-r" command to send code to the interpreter in R with Emacs speaks statistics. How can I set python-mode to use "C-c C-r" rather than "C-c |" to evaulate code? Thanks! It's already bound to C-c C-r in the built-in python.el, but here's a command that binds the key. If you're using python-mode.el, you'll have to change the library name, the command, and maybe the map. (eval-after-load "python" '(progn (define-key python-mode-map (kbd "C-c C-r") 'python-shell-send-region))) 来源: https://stackoverflow.com/questions/25222833/change-the-send-code-to-interpreter-c-c-command-in

Turning on linum-mode when in python/c mode

▼魔方 西西 提交于 2019-12-05 20:42:08
问题 I want to turn on linum mode (M-x linum-mode) automatically with python and c mode. I add the following code in .emacs, but it doesn't seem to work. (defun my-c-mode-common-hook () (line-number-mode 1)) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) (defun my-python-mode-common-hook () (line-number-mode 1)) (add-hook 'python-mode-common-hook 'my-python-mode-common-hook) What might be wrong? 回答1: line-number-mode and linum-mode are not the same. Try this: (defun my-c-mode-hook () (linum

improper exiting from indentation in emacs python-mode

南楼画角 提交于 2019-12-05 04:39:23
I am using Emacs python-mode. I invoke it using this in my .emacs (add-to-list 'load-path "~/emacs/python-mode.el-6.0.3/") (autoload 'python-mode "python-mode" "Python Mode." t) (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode)) (add-to-list 'interpreter-mode-alist '("python" . python-mode)) (require 'python-mode) (add-hook 'python-mode-hook (lambda () (set-variable 'py-indent-offset 4) ;(set-variable 'py-smart-indentation nil) (set-variable 'indent-tabs-mode nil) (define-key py-mode-map (kbd "RET") 'newline-and-indent) ;(define-key py-mode-map [tab] 'yas/expand) ;(setq yas/after-exit

Set python indent to 2 spaces in emacs 23?

我的未来我决定 提交于 2019-12-04 08:58:49
问题 I am using emacs 23.1.1 on Ubuntu 10.04. I wish to program in Python with a 2-space indent. emacs looks to have a default mode for python (python.el?). I put the following in my .emacs: ;; Only spaces, no tabs (setq indent-tabs-mode nil) ;; Always end a file with a newline (setq require-final-newline nil) ;; Don't know which of these might work (setq-default tab-width 2) (setq-default python-indent 2) (setq-default py-indent-offset 2) When I edit a Python file, it uses a 4-space indent. When

Emacs python-mode: Keyboard shortcuts for pdb step-by-step debugging

让人想犯罪 __ 提交于 2019-12-04 06:51:57
I was wondering if there is a way to associate: n RET (next) p RET (previous) c RET (continue) C-x SPC RET (set/clear breakpoint) with function keys F1 - F12 or other keyboard shortcuts. The idea is to emulate the keyboard shortcuts that other IDEs have for debugging (e.g. Visual Studio, MATLAB, etc.). Is this already supported by python-mode? Are there any Emacs modes that can be used to complement python-mode for debugging purposes? gavenkoa You always can define own key-bindings in Emacs. Firstly type C-h m to see help on mode in pdb buffer (which start by M-x pdb ). Next bind any keyboard

How can I set the Python max allowed line length to 120 in Syntastic for Vim?

我是研究僧i 提交于 2019-12-03 22:49:40
I'm using python-mode for Vim, I prefer for there to be 120 character lines rather than the stark 80 as defined in the PEP8 standard. In python-mode, this is easy. I just add the following to my ~/.vimrc: " Pylint configuration file let g:pymode_lint_config = '$HOME/.pylint.rc' let g:pymode_options_max_line_length=120 This works great, but then, I also wanted to use the superb Syntastic plugin for checking syntax of various other kinds (Chef recipes for foodcritic, for example.) Unfortunately, Syntastic also does Python linting, and as such it has now started complaining about my 120 character

Proper indendation with backslash line continuations in python-mode.el

大憨熊 提交于 2019-12-03 22:47:09
I like to use python-mode.el and (gnu) emacs for editing my python files. If I use parentheses for multiline continuations, indentation works as I expect. For example, foo_long_long_long_long = ( bar_long_long_long_long[ (x_long_long_long_long == X) & (y_long_long_long_long == Y)]) is just the way I like it. On the other hand, if I use a backslash for continuations, a single indentation is created and all subsequent lines stop using the extra indentation logic. Below the third and fourth lines fail to have any extra indentation foo_long_long_long_long = \ bar_long_long_long_long[ (x_long_long

Using multiple Python shells in Emacs 'python-mode' with Python or IPython

爷,独闯天下 提交于 2019-12-03 15:14:11
Is there a way to force a new instance of python-shell while running Emacs? It would be convenient when working on multiple projects with separate working directories (and different sets of modules). Any attempt to invoke python-shell will only pull up the current instance. You need to rename your original python-shell before opening up a new one. Use M - x rename-buffer . Daimrod Renaming the buffer doesn't work for me, but you can use the third parameter of run-python . M - : (run-python nil nil t) RET Since the binding to switch to the current buffer isn't really helpful you can rebound it