summaryrefslogtreecommitdiff
path: root/lisp/progmodes/python.el
AgeCommit message (Collapse)Author
2014-07-19Fix Python shell prompts detection for remote hosts.Fabián Ezequiel Gallina
* lisp/progmodes/python.el (python-shell-prompt-detect): Replace call-process with process-file and make it more robust.
2014-07-19Autodetect Python shell prompts. Fabián Ezequiel Gallina
* lisp/progmodes/python.el: (python-shell-interpreter-interactive-arg) (python-shell-prompt-detect-enabled) (python-shell-prompt-detect-failure-warning) (python-shell-prompt-input-regexps) (python-shell-prompt-output-regexps): New vars. (python-shell-prompt-calculated-input-regexp) (python-shell-prompt-calculated-output-regexp): New vars. (python-shell-get-process-name) (python-shell-internal-get-process-name) (python-shell-output-filter) (python-shell-completion-get-completions): Use them. (python-shell-prompt-detect) (python-shell-prompt-validate-regexps): New functions. (python-shell-prompt-set-calculated-regexps): New function. (inferior-python-mode): Use it. Also honor overriden python-shell-interpreter and python-shell-interpreter-args. (python-shell-make-comint): Honor overriden python-shell-interpreter and python-shell-interpreter-args. (python-shell-get-or-create-process): Make it testable by allowing to call run-python non-interactively. (python-util-valid-regexp-p): New function. (python-shell-prompt-regexp, python-shell-prompt-block-regexp) (python-shell-prompt-output-regexp) (python-shell-prompt-pdb-regexp): Use it as defcustom :safe. * test/automated/python-tests.el (python-shell-make-comint-1): (python-shell-make-comint-2): Fix indentation. (python-shell-make-comint-3) (python-shell-make-comint-4): New tests. (python-shell-get-or-create-process-1): Fix test. (python-shell-get-or-create-process-2) (python-shell-get-or-create-process-3): New tests. (python-shell-internal-get-or-create-process-1): Fix test. (python-shell-prompt-detect-1): New test. (python-shell-prompt-detect-2): New test. (Bug#17370) (python-shell-prompt-detect-3) (python-shell-prompt-detect-4) (python-shell-prompt-detect-5) (python-shell-prompt-detect-6) (python-shell-prompt-validate-regexps-1) (python-shell-prompt-validate-regexps-2) (python-shell-prompt-validate-regexps-3) (python-shell-prompt-validate-regexps-4) (python-shell-prompt-validate-regexps-5) (python-shell-prompt-validate-regexps-6) (python-shell-prompt-validate-regexps-7) (python-shell-prompt-set-calculated-regexps-1) (python-shell-prompt-set-calculated-regexps-2) (python-shell-prompt-set-calculated-regexps-3) (python-shell-prompt-set-calculated-regexps-4) (python-shell-prompt-set-calculated-regexps-5) (python-shell-prompt-set-calculated-regexps-6) (python-util-valid-regexp-p-1): New tests.
2014-07-12Merge from emacs-24; up to 2014-06-22T05:00:14Z!dmantipov@yandex.ruGlenn Morris
2014-07-09Fix dedenters and electric colon handling.Fabián Ezequiel Gallina
* lisp/progmodes/python.el (python-rx-constituents): Add dedenter and block-ender. (python-indent-dedenters, python-indent-block-enders): Delete. (python-indent-context): Return new case for dedenter-statement. (python-indent-calculate-indentation): Handle new case. (python-indent-calculate-levels): Fix levels calculation for dedenter statements. (python-indent-post-self-insert-function): Fix colon handling. (python-info-dedenter-opening-block-message): New function. (python-indent-line): Use it. (python-info-closing-block) (python-info-closing-block-message): Remove. (python-info-dedenter-opening-block-position) (python-info-dedenter-opening-block-positions) (python-info-dedenter-statement-p): New functions. * test/automated/python-tests.el (python-indent-block-enders-1) (python-indent-block-enders-2): Fix tests. (python-indent-block-enders-3) (python-indent-block-enders-4) (python-indent-block-enders-5) (python-indent-dedenters-1) (python-indent-dedenters-2): Remove tests. (python-indent-dedenters-1) (python-indent-dedenters-2) (python-indent-dedenters-3) (python-indent-dedenters-4) (python-indent-dedenters-5) (python-indent-dedenters-6) (python-indent-dedenters-7) (python-info-dedenter-opening-block-position-1) (python-info-dedenter-opening-block-position-2) (python-info-dedenter-opening-block-position-3) (python-info-dedenter-opening-block-positions-1) (python-info-dedenter-opening-block-positions-2) (python-info-dedenter-opening-block-positions-3) (python-info-dedenter-opening-block-positions-4) (python-info-dedenter-opening-block-positions-5) (python-info-dedenter-opening-block-message-1) (python-info-dedenter-opening-block-message-2) (python-info-dedenter-opening-block-message-3) (python-info-dedenter-opening-block-message-4) (python-info-dedenter-opening-block-message-5) (python-info-dedenter-statement-p-1) (python-info-dedenter-statement-p-2) (python-info-dedenter-statement-p-3) (python-info-dedenter-statement-p-4) (python-info-dedenter-statement-p-5): New tests. Fixes: debbugs:15163
2014-07-02Merge from emacs-24; up to 2014-06-15T04:52:34Z!eli@barzilay.orgGlenn Morris
2014-07-01* lisp/progmodes/python.el (python-indent-post-self-insert-function):Fabián Ezequiel Gallina
Enhancements to electric indentation behavior inside parens. * test/automated/python-tests.el (python-tests-self-insert): New function. (python-triple-quote-pairing): Use it. (python-util-forward-comment-1): New test. (Bug#17658)
2014-06-21Merge from emacs-24; up to 2014-06-06T02:22:40Z!monnier@iro.umontreal.caGlenn Morris
2014-06-21Fix completion retrieval parsing.Fabián Ezequiel Gallina
* progmodes/python.el (python-mode): (python-util-strip-string): New function. (python-shell-completion-get-completions): Use it. * automated/python-tests.el (python-util-strip-string-1): New test. Fixes: debbugs:17209
2014-06-21Enhancements for outline integration.Fabián Ezequiel Gallina
* lisp/progmodes/python.el (python-mode): Properly set outline-heading-end-regexp so that comments after colons for defuns are supported. Fixes: debbugs:17796
2014-06-11* lisp/progmodes/python.el (import skeleton): New skeleton.Matthias Meulien
(python-mode-map): Bind it. Fixes: debbugs:17672
2014-06-11* lisp/progmodes/python.el (class skeleton): Don't erase last char of classMatthias Meulien
name. Fixes: debbugs:17683
2014-06-11* lisp/progmodes/python.el (run-python): Use read-shell-command.Eric Hanchrow
2014-05-14avoid unnecessary questionsSam Steingold
* lisp/progmodes/python.el (python-shell-get-or-create-process): Do not bind `current-prefix-arg' so that C-c C-z does not talk back unless requested.
2014-04-07Fix triple-quoting electricity in python-modeJoão Távora
* lisp/progmodes/python.el (python-electric-pair-string-delimiter): Fix triple-quoting electricity. * test/automated/python-tests.el (python-triple-quote-pairing): New test. (python-syntax-after-python-backspace): New test. Fixes: debbugs:17192
2014-03-15lisp/progmodes/python.el: Fix docstring typos.Juanma Barranquero
(defconst, python-syntax-count-quotes) (python-indent-region, python-indent-shift-right) (python-indent-dedent-line-backspace, python-nav-backward-sexp) (python-nav-backward-sexp-safe, python-nav-backward-up-list) (python-shell-prompt-block-regexp, python-shell-prompt-output-regexp) (python-shell-prompt-pdb-regexp, python-shell-enable-font-lock) (inferior-python-mode, python-shell-make-comint, run-python-internal) (python-shell-buffer-substring, python-shell-send-buffer) (python-pdbtrack-activate, python-pdbtrack-stacktrace-info-regexp) (python-completion-complete-at-point, python-fill-docstring-style) (python-eldoc-function, python-imenu-format-item-label) (python-imenu-format-parent-item-label) (python-imenu-format-parent-item-jump-label) (python-imenu--build-tree, python-imenu-create-index) (python-imenu-create-flat-index): Fix docstring typos. (python-indent-context, python-shell-prompt-regexp, run-python): Remove superfluous backslashes. (python-indent-line, python-nav-beginning-of-defun) (python-shell-get-buffer, python-shell-get-process) (python-info-current-defun, python-info-current-line-comment-p) (python-info-current-line-empty-p, python-util-popn): Doc fixes. (python-indent-post-self-insert-function, python-shell-send-file) (python-shell-completion-get-completions) (python-shell-completion-complete-or-indent) (python-eldoc--get-doc-at-point): Reflow docstrings.
2014-02-09Replace "Maintainer: FSF" with the emacs-devel mailing addressGlenn Morris
2014-02-04* progmodes/python.el (python-shell-send-string):Fabián Ezequiel Gallina
(python-shell-send-string-no-output): Fix docstring. Fixes: debbugs:16547
2014-01-01Update copyright year to 2014 by running admin/update-copyright.Paul Eggert
2013-12-26* lisp/progmodes/python.el: Use lexical-binding.Fabián Ezequiel Gallina
(python-nav-beginning-of-defun): Stop searching ASAP.
2013-12-25* lisp/progmodes/python.el:Fabián Ezequiel Gallina
(python-nav--lisp-forward-sexp): New function. (python-nav--lisp-forward-sexp-safe): Use it. Rename from python-nav-lisp-forward-sexp-safe. (python-nav--forward-sexp): New argument SAFE allows switching forward sexp movement behavior for parens. (python-nav-forward-sexp): Throw errors on unterminated parens. (python-nav-backward-sexp, python-nav-forward-sexp-safe) (python-nav-backward-sexp-safe): New functions. (python-shell-buffer-substring): Use `python-nav-forward-sexp-safe'. * test/automated/python-tests.el (python-nav-lisp-forward-sexp-safe-1): Remove test. (python-nav-forward-sexp-safe-1): New test. Fixes: debbugs:16191
2013-12-24* lisp/progmodes/python.el (python-nav-beginning-of-statement): SpeedFabián Ezequiel Gallina
up. Fixes: debbugs:15295
2013-12-12* lisp/progmodes/python.el (python-pdbtrack-stacktrace-info-regexp):Fabián Ezequiel Gallina
Also match after beginning of line. (python-pdbtrack-set-tracked-buffer): Fix logic for remote files. Thanks to Russell Sim. Fixes: debbugs:15378
2013-12-12* lisp/progmodes/python.el (python-indent-calculate-indentation): FixFabián Ezequiel Gallina
de-denters cornercase. * test/automated/python-tests.el (python-indent-dedenters-2): New test. Fixes: debbugs:15731
2013-12-12* lisp/progmodes/python.el (python-indent-context)Fabián Ezequiel Gallina
(python-indent-calculate-indentation): Fix auto-identation behavior for comment blocks. * test/automated/python-tests.el (python-indent-after-comment-1) (python-indent-after-comment-2): New tests. Fixes: debbugs:15916
2013-12-12* lisp/progmodes/python.el (python-indent-calculate-indentation): WhenNathan Trapuzzano
determining indentation, don't treat "return", "pass", etc., as operators when they are just string constituents. * automated/python-test.el (python-indent-block-enders-1): Rename from python-indent-block-enders. (python-indent-block-enders-2): New test. Fixes: debbugs:15812
2013-11-28* lisp/progmodes/python.el (python-mode-map): Remove binding for ":".Stefan Monnier
(python-indent-electric-colon): Remove command. (python-indent-post-self-insert-function): Integrate the previous code of python-indent-electric-colon. Make it conditional on electric-indent-mode. (python-mode): Add ?: to electric-indent-chars. Move python-indent-post-self-insert-function to the end of post-self-insert-hook.
2013-11-25* lisp/progmodes/python.el (python-indent-guess-indent-offset):Glenn Morris
Avoid corner-case error. Fixes: debbugs:15975
2013-11-23* python.el (python-shell-send-file): Add option to delete file when done. Glenn Morris
(python-shell-send-string, python-shell-send-region): Use it. Fixes: debbugs:15647
2013-11-22Revert previous python.el changeGlenn Morris
2013-11-22* lisp/progmodes/python.el (python-shell--save-temp-file): Tiny changeJorgen Schaefer
Delete temp-file when done. Fixes: debbugs:15647
2013-11-05* lisp/progmodes/python.el (python-mode): Remove incorrect text from docstring.Bozhidar Batsov
* lisp/progmodes/scheme.el (scheme-mode): Remove incorrect text from docstring. * lisp/progmodes/prolog.el (prolog-mode): Remove incorrect text from docstring. * lisp/emacs-lisp/lisp-mode.el (lisp-mode, lisp-interaction-mode, emacs-lisp-mode): Remove incorrect text from docstring.
2013-11-04* lisp/progmodes/python.el: Fix up last change.Stefan Monnier
(python-shell--save-temp-file): New function. (python-shell-send-string): Use it. Remove `msg' arg. Don't assume `string' comes from the current buffer. (python-shell-send-string-no-output): Remove `msg' arg. (python--use-fake-loc): New var. (python-shell-buffer-substring): Obey it. Try to compensate for the extra coding line added by python-shell--save-temp-file. (python-shell-send-region): Use python-shell--save-temp-file and python-shell-send-file directly. Add `nomain' argument. (python-shell-send-buffer): Use python-shell-send-region. (python-electric-pair-string-delimiter): New function. (python-mode): Use it.
2013-10-29* lisp/progmodes/python.el (python-shell-get-buffer): New function.Stefan Monnier
(python-shell-get-process): Use it. (python-shell-send-string): Always use utf-8 and add a cookie to tell Python which encoding was used. Don't split-string since we only care about the first line. Return the temp-file, if applicable. (python-shell-send-region): Tell compile.el how to turn locations in the temp-file into locations in the source buffer.
2013-10-07* lisp/electric.el (electric-indent-inhibit): New var.Stefan Monnier
(electric-indent-post-self-insert-function): Use it. * lisp/progmodes/python.el (python-mode): Set it.
2013-09-10Improve previous interpreter-mode-alist changeGlenn Morris
* lisp/files.el (interpreter-mode-alist): Remove \\` \\' parts. (set-auto-mode): Don't regexp-quote elements. * lisp/progmodes/python.el (interpreter-mode-alist): Remove \\` \\'. * lisp/progmodes/cc-mode.el (interpreter-mode-alist): * lisp/progmodes/ruby-mode.el (interpreter-mode-alist): Revert previous change. * etc/NEWS: Update.
2013-09-10Tweak previous changeGlenn Morris
2013-09-10Treat interpreter-mode-alist as alist of regexps, not literalsGlenn Morris
Cf http://lists.gnu.org/archive/html/emacs-devel/2005-08/msg00472.html * lisp/files.el (interpreter-mode-alist): Convert to regexps. (set-auto-mode): Adapt for this. * lisp/progmodes/cperl-mode.el (cperl-clobber-mode-lists): Comment out unused variable. * lisp/progmodes/cc-mode.el (interpreter-mode-alist): * lisp/progmodes/python.el (interpreter-mode-alist): * lisp/progmodes/ruby-mode.el (interpreter-mode-alist): Convert to regexps. * lisp/progmodes/sh-script.el (sh-set-shell): No longer use interpreter-mode-alist to get list of shells. * etc/NEWS: Mention this. Fixes: debbugs:15306
2013-09-09Spelling fixes and tidy up a comment.Paul Eggert
2013-09-04* lisp/subr.el (pop): Use `car-safe'.Stefan Monnier
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Remove hack to detect unused `pop' return value. * lisp/emacs-lisp/advice.el (defadvice): Add indent rule. * lisp/international/mule-cmds.el: Require CL. (find-coding-systems-for-charsets): Avoid add-to-list. (sanitize-coding-system-list): New function, extracted from select-safe-coding-system-interactively. (select-safe-coding-system-interactively): Use it. (read-input-method-name): Accept symbols for `default'. * lisp/progmodes/python.el (python-nav-beginning-of-block): Remove unused var `block-regexp'. (python-nav--forward-sexp): Remove unused var `re-search-fn'. (python-fill-string): Remove unused var `marker'. (python-skeleton-add-menu-items): Remove unused var `items'.
2013-09-02Format code sent to Python shell for robustness.Fabián Ezequiel Gallina
* progmodes/python.el (python-shell-buffer-substring): New function. (python-shell-send-region, python-shell-send-buffer): Use it.
2013-09-02* progmodes/python.el (python-nav-if-name-main): New command.Fabián Ezequiel Gallina
2013-09-02* progmodes/python.el (python-shell-completion-get-completions):Fabián Ezequiel Gallina
Drop use of deleted `comint-last-prompt-overlay'.
2013-08-26* lisp/progmodes/python.el (python-font-lock-keywords): Don't return nilStefan Monnier
from a matcher-function unless there's no more matches. Fixes: debbugs:15161
2013-08-15Spelling fixes.Paul Eggert
2013-08-13* lisp/progmodes/python.el (python-imenu--build-tree)Fabián Ezequiel Gallina
(python-imenu--put-parent): Simplify and Fix (GH bug 146). * test/automated/python-tests.el (python-imenu-create-index-4) (python-imenu-create-flat-index-2): New tests.
2013-07-12* lisp/progmodes/python.el (python-imenu--build-tree): Fix corner caseFabián Ezequiel Gallina
in nested defuns. * test/automated/python-tests.el (python-imenu-create-index-2) (python-imenu-create-index-3): New tests.
2013-06-18* lisp/progmodes/python.el (ffap-alist): Declare.Glenn Morris
2013-06-01Merge from emacs-24; up to 2012-12-27T20:09:45Z!juri@jurta.orgGlenn Morris
2013-05-26* progmodes/python.el: Fix typo in commentary.Fabián Ezequiel Gallina
2013-05-26* progmodes/python.el (python-indent-block-enders): Add break,Fabián Ezequiel Gallina
continue and raise keywords.