Commit graph

517 commits

Author SHA1 Message Date
Tom Willemse
9dfa949c0d * lisp/progmodes/python.el: Recognize docstrings.
(python-docstring-at-p, python-font-lock-syntactic-face-function):
New functions.
(python-mode): Use them.
2014-12-07 11:24:35 -05:00
Stefan Monnier
0bb24df135 Merge from origin/emacs-24
bb19b22 Python.el: Update commentary on RET-behavior
2014-12-05 15:12:00 -05:00
Rasmus
bb19b229f9 Python.el: Update commentary on RET-behavior
Commentary reflect that `electric-indent-mode' in enabled by default.
2014-11-29 13:58:20 -03:00
Paul Eggert
0cce3623b1 Merge branch 'emacs-24'. 2014-11-28 23:07:16 -08:00
Fabián Ezequiel Gallina
7bf7edf53f * lisp/progmodes/python.el (python-shell-completion-setup-code): Use
__builtin__ module (or builtins in Python 3) and catch all errors
when importing readline and rlcompleter.
2014-11-26 23:45:24 -03:00
Ted Zlatanov
ba4502fe14 Merge branch 'emacs-24'
Conflicts:
	nt/addsection.c
	nt/inc/ms-w32.h
	src/w32.c
2014-11-26 21:31:11 -05:00
Fabián Ezequiel Gallina
238c052fdb Set PYTHONUNBUFFERED on shell startup.
Fixes: debbugs:18595

* lisp/progmodes/python.el (python-shell-unbuffered): New var.
(python-shell-calculate-process-environment): Use it.

* test/automated/python-tests.el
(python-shell-calculate-process-environment-4)
(python-shell-calculate-process-environment-5): New tests.
(python-shell-make-comint-3): Use file-equal-p.
(python-shell-get-or-create-process-1)
(python-shell-get-or-create-process-2)
(python-shell-get-or-create-process-3): Fix interpreter for
Windows.
2014-11-22 20:09:30 -03:00
Fabián Ezequiel Gallina
c2e145b237 * lisp/progmodes/python.el (python-mode): Avoid use of set-local to
keep Emacs 24.x compatibility.
2014-11-16 17:59:42 -03:00
Fabián Ezequiel Gallina
651ebee618 Fixes: debbugs:18596
* lisp/progmodes/python.el (run-python): Allow CMD to be optional and
default it to a safe command, even for Windows.  (bug#18596)
2014-11-16 11:20:25 -03:00
Fabián Ezequiel Gallina
cf100f60a6 Prevent resizing the echo area when iPython is enabled
Fixes: debbugs:18794

* lisp/progmodes/python.el (python-eldoc--get-doc-at-point): Strip
shell output before returning.
2014-11-16 11:11:49 -03:00
Fabián Ezequiel Gallina
6f167f95dc * lisp/progmodes/python.el (python-shell-calculate-command): Rename
from python-shell-parse-command.  Cleanup.
(run-python, run-python-internal): Use it.
(python-shell-calculate-pythonpath): Rename from
python-new-pythonpath.
(python-shell-calculate-process-environment): Use it.
(python-shell-calculate-exec-path): Add comment.

* test/automated/python-tests.el
(python-shell-calculate-process-environment-2): Fix test.
(python-shell-calculate-process-environment-1)
(python-shell-calculate-process-environment-3): Cleanup.
2014-11-16 10:47:14 -03:00
Stefan Monnier
9075fcc193 Merge from emacs-24 2014-11-16 00:22:20 -05:00
Fabián Ezequiel Gallina
92f58578cc Fixes: debbugs:18432
* lisp/progmodes/python.el (python-indent-calculate-levels): Fix
indentation behavior multiline dedenter statement.

* test/automated/python-tests.el (python-indent-dedenters-8): New test
for Bug#18432.
2014-11-15 19:02:52 -03:00
Fabián Ezequiel Gallina
89ebffc1f6 Fix region indentation
Fixes: debbugs:18843

* lisp/progmodes/python.el (python-indent-region): Use
python-indent-line and skip special cases.

* test/automated/python-tests.el (python-indent-region-1)
(python-indent-region-2, python-indent-region-3)
(python-indent-region-4, python-indent-region-5): New tests.
2014-11-15 18:10:58 -03:00
Fabián Ezequiel Gallina
9ae5396b8f Eldoc setup code enhancements
Fixes: debbugs:18962

* lisp/progmodes/python.el (python-eldoc-setup-code): Enhance string
type checks, simplify printing.
2014-11-15 15:50:30 -03:00
Ivan Andrus
15ec2d7cff Backport Use derived-mode-p in python.el instead of equality test with major-mode
Fixes: debbugs:18854

* progmodes/python.el (python-ffap-module-path): Use
`derived-mode-p' instead of equality test on `major-mode'.
2014-11-14 21:56:11 -07:00
Ivan Andrus
f20a19df87 Use derived-mode-p in python.el instead of equality test on major-mode
* progmodes/python.el (python-shell-font-lock-kill-buffer):
(python-shell-font-lock-with-font-lock-buffer)
(python-shell-get-buffer, python-ffap-module-path): Use
`derived-mode-p' instead of equality test on `major-mode'.
2014-11-14 13:54:10 -07:00
Fabián Ezequiel Gallina
eb97699236 Rename python-shell-virtualenv-path to fit GNU conventions
* lisp/progmodes/python.el (python-shell-virtualenv-root): Rename from
python-shell-virtualenv-path.
(python-shell-internal-get-process-name)
(python-shell-calculate-process-environment)
(python-shell-calculate-exec-path): Use it.
2014-11-14 03:26:08 -03:00
Fabián Ezequiel Gallina
5d977b968c * lisp/progmodes/python.el (python-shell-completion-get-completions):
Fix previous merge.
2014-11-14 02:29:40 -03:00
Stefan Monnier
c9f7e33c60 * lisp/progmodes/python.el (inferior-python-mode): Use add-hook. 2014-10-20 18:37:04 -04:00
Glenn Morris
b1d5ab0352 Merge from emacs-24; up to 2014-07-26T11:58:24Z!schwab@linux-m68k.org 2014-10-12 15:56:45 -07:00
Fabián Ezequiel Gallina
b1be0eda33 Fix import completion.
* lisp/progmodes/python.el (python-shell-completion-get-completions):
Fix import case regexp.

Fixes: debbugs:18582
2014-10-12 12:12:04 -03:00
Stefan Monnier
cb325041b0 * lisp/progmodes/python.el: Avoid building unneeded markers.
(python-font-lock-keywords, python-indent-dedent-line)
(python-fill-paren, python-shell-completion-complete-or-indent):
Prefer point over point-marker.
(inferior-python-mode): Remove redundant completion settings.
2014-10-03 22:35:28 -04:00
Stefan Monnier
d7f413b893 Merge from emacs-24 2014-10-02 11:13:05 -04:00
Stefan Monnier
85ee81a08f * lisp/progmodes/python.el (python-shell-completion-get-completions):
Use python-shell--prompt-calculated-input-regexp from the
process buffer.
Don't assume that `line' comes from the process buffer.

Fixes: debbugs:18582
2014-09-30 20:41:51 -04:00
Stefan Monnier
07bec0fc67 Merge from emacs-24 2014-09-30 19:19:31 -04:00
Leonardo Nobrega
d3b7a90bc2 * lisp/progmodes/python.el (python-fill-paren): Don't inf-loop at EOB.
Fixes: debbugs:18462
2014-09-30 19:00:57 -04:00
Stefan Monnier
cbdc06f3be Rename 24.5 to 25.1
Except where we expect to backport the corresponding change.
2014-09-29 14:14:08 -04:00
Paul Eggert
0f2ed59206 Spelling fixes.
* lisp/ses.el (ses-file-format-extend-parameter-list): Rename from
ses-file-format-extend-paramter-list.  All uses changed.
* lisp/gnus-cloud.el (gnus-cloud-parse-version-1): Fix misspelling
of ":delete".
2014-09-11 12:44:25 -07:00
Glenn Morris
62fca47221 Merge from emacs-24; up to 2014-07-04T02:28:54Z!dmantipov@yandex.ru 2014-09-02 21:21:40 -07:00
Fabián Ezequiel Gallina
0e4c8f1856 * lisp/progmodes/python.el (python-indent-post-self-insert-function):
Avoid electric colon at beginning-of-defun. 

* test/automated/python-tests.el:
(python-indent-electric-colon-1): New test.  (Bug#18228)
2014-09-01 19:51:46 -03:00
Glenn Morris
6d26235315 Merge from emacs-24; up to 2014-07-02T00:57:53Z!juri@jurta.org 2014-08-27 18:59:29 -07:00
Sam Steingold
3f05baa175 Extract python-new-pythonpath to handle PYTHONPATH in user code
* lisp/progmodes/python.el (python-new-pythonpath): Extract from
`python-shell-calculate-process-environment'.
2014-08-20 11:33:10 -04:00
Stefan Monnier
5d3c0a067f * lisp/progmodes/python.el (python-shell-prompt-detect): Remove redundant
executable-find.

Fixes: debbugs:18244
2014-08-18 12:11:43 -04:00
Fabián Ezequiel Gallina
5ea39c0613 * lisp/progmodes/python.el: Fix completions inside (i)pdb.
(python-shell-completion-pdb-string-code): Make obsolete.
(python-shell-completion-get-completions): Use
python-shell-completion-string-code resending setup code
continuously for (i)pdb.
2014-08-04 18:35:17 -03:00
Fabián Ezequiel Gallina
01c600f6d6 * progmodes/python.el: Completion code cleanups.
(python-shell-completion-get-completions): Detect and send import
statements directly to completion function.
(python-shell-completion-at-point): Simplify prompt calculation
and import vs input completion logic.
2014-08-02 19:52:55 -03:00
Fabián Ezequiel Gallina
bc1ce1df86 * lisp/progmodes/python.el: Shell output capture enhancements.
(python-shell-accept-process-output): New function.
(inferior-python-mode)
(python-shell-send-setup-code): Use it.
2014-07-31 21:18:19 -03:00
Fabián Ezequiel Gallina
6628be853e * lisp/progmodes/python.el (inferior-python-mode): Make input prompts
read-only.
2014-07-28 18:07:10 -03:00
Glenn Morris
da41ffdd08 Merge from emacs-24; up to 2014-06-26T06:55:15Z!rgm@gnu.org 2014-07-28 05:39:09 -04:00
Fabián Ezequiel Gallina
7daa4ff121 Parse completion input in a iPython friendly way.
* lisp/progmodes/python.el
(python-shell-completion-at-point): Rename from
python-shell-completion-complete-at-point.
(inferior-python-mode): Use it.
(python-completion-at-point): Rename from
python-completion-complete-at-point.  Parse input up to first
backward occurrence of whitespace, open-paren, close-paren or
string delimiter.
(python-mode): Use it.

Fixes: debbugs:18084
2014-07-28 01:32:28 -03:00
Fabián Ezequiel Gallina
4256626a7a Prevent Python process shell buffer to pop twice.
* lisp/progmodes/python.el (python-shell-switch-to-shell): Do not call
pop-to-buffer.
2014-07-28 00:58:06 -03:00
Fabián Ezequiel Gallina
ca43b53625 * lisp/progmodes/python.el
(python-shell-with-shell-buffer): New macro.
(python-shell-font-lock-get-or-create-buffer)
(python-shell-font-lock-kill-buffer)
(python-shell-font-lock-with-font-lock-buffer)
(python-shell-font-lock-cleanup-buffer)
(python-shell-font-lock-toggle): Use it.
(python-shell-font-lock-turn-on)
(python-shell-font-lock-turn-off): Use it.  Make command.
2014-07-28 00:35:37 -03:00
Fabián Ezequiel Gallina
f5bed1021b Grab all Python process output before inferior-python-mode hooks.
* lisp/progmodes/python.el (inferior-python-mode): Call
accept-process-output and sit-for to ensure all output for process
has been received before running hooks.
(python-shell-internal-get-or-create-process): Cleanup
accept-process-output and sit-for calls.
2014-07-27 23:47:29 -03:00
Fabián Ezequiel Gallina
72c64ae95a More robust shell startup and code setup.
* lisp/progmodes/python.el (python-shell-make-comint): Remove
accept-process-output call.
(python-shell-get-buffer): Return current buffer if major-mode is
inferior-python-mode.
(python-shell-get-or-create-process): Use it.
(python-shell-send-setup-code): Send all setup code in one string,
output success message and accept-process-output.
2014-07-27 22:41:29 -03:00
Fabián Ezequiel Gallina
c76059efc6 Cleanup error signals.
* lisp/progmodes/python.el
(python-indent-shift-left): Use user-error instead.
(python-shell-prompt-detect): Use lwarn with python group.
(python-completion-complete-at-point)
(python-eldoc--get-doc-at-point): Don't signal error.

Fixes: debbugs:18067
2014-07-27 04:05:13 -03:00
Fabián Ezequiel Gallina
4b03be01ce Support for packages in Python shell.
* lisp/progmodes/python.el (python-shell--package-depth): New var.
(python-shell-package-enable): New command.
(python-util-list-directories, python-util-list-files)
(python-util-list-packages): New functions.

Fixes: debbugs:13570
2014-07-27 03:39:17 -03:00
Glenn Morris
9578a71f2e * python.el (python-shell-enable-font-lock): Fix typo in earlier change. 2014-07-26 22:59:49 -04:00
Fabián Ezequiel Gallina
a6dc66a544 Faster comint output.
* lisp/progmodes/python.el:
(python-comint-output-filter-function): Make obsolete.
(python-comint-postoutput-scroll-to-bottom): New function.
(inferior-python-mode): Set comint-output-filter-functions to a
minimum.

Fixes: debbugs:16875
2014-07-26 23:02:38 -03:00
Fabián Ezequiel Gallina
85bc77b270 * lisp/progmodes/python.el (inferior-python-mode): Doc fix. 2014-07-26 22:36:48 -03:00
Fabián Ezequiel Gallina
ef29dc9b14 * lisp/progmodes/python.el (python-shell-font-lock-post-command-hook):
Safeguard current point and undo history.
2014-07-26 22:00:26 -03:00