Commit graph

354 commits

Author SHA1 Message Date
Fabián Ezequiel Gallina
dc4f818b02 * progmodes/python.el:
(python-shell-send-buffer): Better handling of "if __name__ ==
'__main__':" conditionals when sending the buffer.
2012-09-24 20:15:40 -03:00
Fabián Ezequiel Gallina
8fb8b88f2d Enhancements for triple-quote string syntax.
* progmodes/python.el (python-quote-syntax): Remove.
(python-syntax-propertize-function): New value.
(python-syntax-count-quotes, python-syntax-stringify): New
functions.
2012-09-24 14:54:46 -03:00
Fabián Ezequiel Gallina
095bb82357 * progmodes/python.el (python-indent-line): More consistent cursor
movement behavior.
2012-09-23 15:21:33 -03:00
Matt McClure
9dd40b0005 * progmodes/python.el (python-shell-send-string): When
default-directory is remote, create temp file on remote
filesystem.
(python-shell-send-file): When file is remote, pass local view of
file paths to remote Python interpreter.  (Bug#12340)
2012-09-07 16:53:15 +02:00
Glenn Morris
2a1e24765b Replace version 24.2 with 24.3 where appropriate (hopefully) 2012-08-15 09:29:11 -07:00
Fabián Ezequiel Gallina
925411b4ce * progmodes/python.el (python-shell-send-string):
(python-shell-send-setup-code): Do not use `format' with
`message'.
2012-08-14 10:39:27 -03:00
Fabián Ezequiel Gallina
5beed58664 Use `completion-table-dynamic' for completion functions.
* progmodes/python.el
(python-shell-completion--do-completion-at-point)
(python-shell-completion--get-completions): Remove
functions.
(python-shell-completion-complete-at-point): New function.
(python-completion-complete-at-point): Use it.
2012-08-14 01:18:41 -03:00
Chong Yidong
1530c98e56 Remove some unnecessary bindings of same-window-* variables.
* lisp/progmodes/python.el (python-shell-get-process-name): Don't mess
with same-window-buffer-names.

* lisp/eshell/eshell.el (eshell-add-to-window-buffer-names)
(eshell-remove-from-window-buffer-names): Make obsolete.
(eshell-buffer-name, eshell-unload-hook): Don't use them.
(eshell): Just use pop-to-buffer-same-window instead.
2012-08-11 00:46:07 +08:00
Fabián Ezequiel Gallina
e0cc4efac7 * progmodes/python.el (python-pdbtrack-tracked-buffer)
(python-pdbtrack-buffers-to-kill, python-shell-internal-buffer)
(python-shell-internal-last-output): Use make-local-variable
instead of make-variable-buffer-local.
2012-08-09 01:08:29 -03:00
Fabián Ezequiel Gallina
489af14fa5 * progmodes/python.el: Enhancements to forward-sexp.
(python-nav-forward-sexp): Rename from
python-nav-forward-sexp-function.
(python-nav--forward-sexp, python-nav--backward-sexp): New
functions.
2012-08-09 00:30:37 -03:00
Fabián Ezequiel Gallina
2d79ec42a2 * progmodes/python.el Fixed defsubst warning.
(python-syntax-context) Rename from python-info-ppss-context.
(python-syntax-context-type): Rename from
python-info-ppss-context-type.
(python-syntax-comment-or-string-p): Rename from
python-info-ppss-comment-or-string-p.
2012-08-07 23:30:08 -03:00
Fabián Ezequiel Gallina
ba7b015436 Make internal shell process buffer names start with space.
* progmodes/python.el (python-shell-make-comint): Add optional
argument INTERNAL.
(run-python-internal): Use it.
(python-shell-internal-get-or-create-process): Check for new
internal buffer names.
2012-08-06 00:27:43 -03:00
Fabián Ezequiel Gallina
0d49da68b9 Shell processes: enhancements to startup and CEDET compatibility.
* progmodes/python.el (python-shell-send-setup-max-wait): Delete var.
(python-shell-make-comint): accept-process-output at startup.
(run-python-internal): Set inferior-python-mode-hook to nil.
(python-shell-internal-get-or-create-process): call sit-for.
(python-preoutput-result): Add obsolete alias.
(python-shell-internal-send-string): Use it.
(python-shell-send-setup-code): Remove call to
accept-process-output.
2012-07-31 20:43:31 -03:00
Fabián Ezequiel Gallina
d77149619b * progmodes/python.el (run-python-internal): Disable font lock for
internal shells.
2012-07-31 00:31:10 -03:00
Fabián Ezequiel Gallina
aa81af715c Consistent completion in inferior python with emacs -nw.
* progmodes/python.el (inferior-python-mode): replace "<tab>"
binding in inferior-python-mode-map with "\t".
(python-shell-completion-complete-at-point)
(python-completion-complete-at-point): Remove interactive spec.
2012-07-27 13:42:19 -03:00
Fabián Ezequiel Gallina
a90dfb9511 * lisp/progmodes/python.el (python-mode-map): Added keybinding for
run-python.
(python-shell-make-comint): Fix pop-to-buffer call.
(run-python): Autoload.  New arg SHOW.
(python-shell-get-or-create-process): Do not pop python process
buffer.
2012-07-27 09:38:19 -03:00
Fabián Ezequiel Gallina
1d29cc7da7 Enhancements to ppss related code (thanks Stefan).
* progmodes/python.el (python-indent-context)
(python-indent-calculate-indentation, python-indent-dedent-line)
(python-indent-electric-colon, python-nav-forward-block)
(python-mode-abbrev-table)
(python-info-assignment-continuation-line-p): Simplified checks
for ppss context.
(python-info-continuation-line-p): Cleanup.
(python-info-ppss-context): Do not catch 'quote.
(python-info-ppss-context-type)
(python-info-ppss-comment-or-string-p): Simplify.
2012-07-18 21:55:55 -03:00
Fabián Ezequiel Gallina
d617c457bd progmodes/python.el: Set file local vars at end of file and clean tabs. 2012-07-18 16:04:06 -03:00
Fabián Ezequiel Gallina
d583cbe681 * progmodes/python.el: Enhancements to eldoc support.
(python-info-current-symbol): New function.
(python-eldoc-at-point): Use python-info-current-symbol.
(python-info-current-defun): Fix cornercase on first defun scan.
(python-eldoc--get-doc-at-point): Use python-info-current-symbol
and signal error when no inferior python process is available.
2012-07-18 15:40:03 -03:00
Fabián Ezequiel Gallina
0a60bc1071 New utility functions + python-info-ppss-context fix.
* progmodes/python.el (python-info-beginning-of-block-statement-p)
(python-info-ppss-comment-or-string-p): New functions.
(python-info-ppss-context): Small fix for string check.

Fixes: debbugs:11910
2012-07-17 17:27:49 -03:00
Fabián Ezequiel Gallina
bcdc27d7d4 Final renames and doc fixes for movement commands.
* progmodes/python.el (python-nav-beginning-of-statement): Rename
from python-nav-statement-start.
(python-nav-end-of-statement): Rename from
python-nav-statement-end.
(python-nav-beginning-of-block): Rename from
python-nav-block-start.
(python-nav-end-of-block): Rename from python-nav-block-end.

Fixes: debbugs:11899
2012-07-17 15:02:53 -03:00
Fabián Ezequiel Gallina
191da00ee2 * progmodes/python.el (python-shell-send-string-no-output): Allow
accept-process-output to quit, keeping shell process ready for
future interactions.

Fixes: debbugs:11868
2012-07-17 13:47:58 -03:00
Fabián Ezequiel Gallina
758e556a7a * progmodes/python.el: Simplified imenu implementation.
(python-nav-jump-to-defun): Remove command.
(python-mode-map): Use `imenu' instead.
(python-nav-list-defun-positions-cache)
(python-imenu-include-defun-type, python-imenu-make-tree)
(python-imenu-subtree-root-label, python-imenu-index-alist):
Remove vars.
(python-nav-list-defun-positions, python-nav-read-defun)
(python-imenu-tree-assoc, python-imenu-make-element-tree)
(python-imenu-make-tree, python-imenu-create-index): Remove
functions.
(python-mode): Update to interact with imenu by setting
`imenu-extract-index-name-function' only.
2012-07-16 14:18:39 -03:00
Fabián Ezequiel Gallina
032d23ab66 * progmodes/python.el: Enhancements to navigation commands.
(python-nav-backward-sentence)
(python-nav-forward-sentence): Remove.
(python-nav-backward-statement, python-nav-forward-statement)
(python-nav-statement-start, python-nav-statement-end)
(python-nav-backward-block, python-nav-forward-block)
(python-nav-block-start, python-nav-block-end)
(python-nav-forward-sexp-function)
(python-info-current-line-comment-p)
(python-info-current-line-empty-p): New functions.
(python-indent-context): Use `python-nav-statement-start'.
2012-07-16 10:13:01 -03:00
Chong Yidong
0e9e6c6abc Mark python-mode abbrevs as system abbrevs.
* progmodes/python.el (python-skeleton-define): Mark abbrevs as
system abbrevs.

* ansi-color.el (ansi-color-apply-on-region): Doc fix.
2012-06-23 17:28:10 +08:00
Glenn Morris
68f1241189 * lisp/progmodes/python.el (python-mode): Derive from prog-mode. 2012-06-19 09:04:47 -07:00
Stefan Monnier
25f09295fa * lisp/progmodes/python.el (python-rx-constituents): Move backquote.
(python-skeleton-define, python-define-auxiliary-skeleton): Use `declare'.
2012-06-18 16:41:23 -04:00
Glenn Morris
35647f79fd Fix python.el obsolescence versions
* lisp/progmodes/python.el (python-proc, python-buffer)
(python-send-receive, python-send-string): Fix obsolete versions.
2012-06-18 14:23:59 -04:00
Glenn Morris
a633e6a2b4 Add coding cookie 2012-06-18 14:04:21 -04:00
Paul Eggert
48d1354eb8 Spelling fixes. 2012-06-17 01:53:31 -07:00
Fabián Ezequiel Gallina
2d7b84eab6 lisp/progmodes/python.el: Updated Copyright years. 2012-06-14 23:22:19 -03:00
Fabián Ezequiel Gallina
9ddf3c74c8 * lisp/progmodes/python.el: (python-indent, python-guess-indent,
python-use-skeletons): New obsolete variable aliases.
  (python-indent-guess-indent-offset): Make interactive.
2012-06-14 22:33:57 -03:00
Fabián Ezequiel Gallina
aeadd9a469 Migrated python-font-lock-syntactic-keywords to python-syntax-propertize-function
This is a backport of Stefan Monnier's migration to the new font-lock
machinery (introduced in 2010-09-10T23:13:42Z!monnier@iro.umontreal.ca).

New Vars:
 + python-syntax-propertize-function

Deleted Vars:
 + python-font-lock-syntactic-keywords
2012-05-17 00:03:46 -03:00
Fabián Ezequiel Gallina
09268a54ae Copyright information update 2012-05-17 00:03:45 -03:00
Fabián Ezequiel Gallina
bd98267736 Revert "Merge pull request #83 from tkf/empty-triple-quote"
This reverts commit f4d086427343eb0b8bc91355388d2437c568b1f6, reversing
changes made to 8f697fd2ef23a9e1d9a06ac8ca419d76ccedb27d.

While the fix worked with empty triple quoted strings it broke simpler cases
like these:

    """
    def someting(a, b, c):
        "
    """

    or

    '''
    def someting(a, b, c):
        '
    '''

Another approach is needed for giving triple quoted string the correct syntax.
2012-05-17 00:03:45 -03:00
Fabián Ezequiel Gallina
c6d3df36da Make `which-func-functions' defaults to '(python-info-current-defun) 2012-05-17 00:03:45 -03:00
Fabián Ezequiel Gallina
4289485a58 Function documentation enhancements 2012-05-17 00:03:44 -03:00
Fabián Ezequiel Gallina
8c6f9e60df New defun navigation machinery
`python-nav-beginning-of-defun' and
`python-beginning-of-defun-function' have changed and now they don't
handle decorators anymore.

`python-end-of-defun-function' is now smart enough to detect the real
ending of the current defun.

`python-shell-send-defun' always sends the outermost defun and
includes decorators. When called with prefix argument the decorators
are skipped.

`python-info-current-defun' has been modified to use the new defun
movement API.

New Functions:
  + python-info-looking-at-beginning-of-defun
2012-05-17 00:03:44 -03:00
Fabián Ezequiel Gallina
462973b5ef Enhancements on python-beginning-of-defun-function' for mark-defun' behavior.
`mark-defun' was failing when point was right at the start of a defun.
2012-05-17 00:03:43 -03:00
Fabián Ezequiel Gallina
b15e880041 `python-nav-list-defun-positions' now caches defuns positions (#75)
This is a simplified version of @dandavison pull request (thanks dan!)

`python-nav-list-defun-positions' now uses
`python-nav-list-defun-positions-cache' buffer local variable to store
cached values of defun positions.

`python-nav-jump-to-defun' now benefits from this new cache and if
called with prefix argument it will invalidate it so new defuns are
scanned.

New Vars:
 + `python-nav-list-defun-positions-cache'
2012-05-17 00:03:43 -03:00
Fabián Ezequiel Gallina
0d85f46527 Enhancements to `python-end-of-defun-function' so it's not blocked by top level assignments (fixes #64) 2012-05-17 00:03:43 -03:00
Dan Davison
a7a6d8ff0e Variable name change
python-shell-enable-syntax-highlighting -> python-shell-enable-font-lock
2012-05-17 00:03:42 -03:00
Fabián Ezequiel Gallina
cd05d2a6b0 Enhancements to `python-indent-post-self-insert-function'
Fixed case where the paren base indentation is not 0.
2012-05-17 00:03:42 -03:00
Fabián Ezequiel Gallina
cd7ab09299 Enhanced closing block notification when line is indented or a colon is inserted.
`python-indent-line' and `python-indent-electric-colon' now uses the
new `python-info-closing-block-message' function that takes care of
messaging the block the current line is closing (if applicable).

New Functions:
 + `python-info-closing-block-message'
2012-05-17 00:03:42 -03:00
Fabián Ezequiel Gallina
5eae76aed1 Readjust indentation automatically on lines with closing parens.
For this to work `python-indent-post-self-insert-function' is added to
the `post-self-insert-hook.' when python-mode is initialized.

New functions:
 + `python-indent-post-self-insert-function'
2012-05-17 00:03:42 -03:00
Fabián Ezequiel Gallina
90a41b9dc2 Removed tabs and fixed indentation in several parts. 2012-05-17 00:03:41 -03:00
Fabián Ezequiel Gallina
035c45e336 Do not call switch-to-buffer' in python-shell-get-or-create-process'
For this to work properly `run-python' now calls
`python-shell-make-comint' with the POP argument set to nil.
2012-05-17 00:03:41 -03:00
Takafumi Arakaki
8f1eba8b5e Treat empty triple quote
Fix #70
2012-05-17 00:03:41 -03:00
Fabián Ezequiel Gallina
1dae378f10 Small fix in `python-shell-send-defun' (#69 thanks mafm-git!) 2012-05-17 00:03:40 -03:00
Dan Davison
b4b661d885 Customizable variable to control syntax highlighting in shell.
Default is on.
2012-05-17 00:03:40 -03:00