Commit graph

354 commits

Author SHA1 Message Date
Dan Davison
6da55e5931 Don't send "if __name__ == '__main__':" to interpreter 2012-05-17 00:03:39 -03:00
Dan Davison
39806de381 Disregard leading whitespace when forming module completions
This allows an indented import line (e.g. in a function or method
body) to be completed.
2012-05-17 00:03:39 -03:00
Dan Davison
bdfb840ec4 Deactivate mark on python-shell-send-region 2012-05-17 00:03:39 -03:00
Dan Davison
799aa2afb2 Use completion-at-point instead of comint-dynamic-complete in shell completion 2012-05-17 00:03:38 -03:00
Dan Davison
53df7818c0 Pass entire line of input to module completer
The module completer wants e.g. 'from xxx' as input, not just 'xxx'.

This change also causes all modules to be offered as completions to
'from ', whereas previously this was regarded as empty input.
2012-05-17 00:03:38 -03:00
Fabián Ezequiel Gallina
936bc8333f Enhancements on ipython 0.10 setup documentation (thanks to @tkf for the hint) 2012-05-17 00:03:38 -03:00
Fabián Ezequiel Gallina
29810afbbd Added missing dot in `python-completion-complete-at-point' error 2012-05-17 00:03:37 -03:00
Fabián Ezequiel Gallina
cb37c7e369 Enhanced completion subject finding logic for `python-shell-completion--do-completion-at-point' 2012-05-17 00:03:37 -03:00
Fabián Ezequiel Gallina
0d0e6ccde6 Make python-shell-completion--do-completion-at-point' to return a list for completion-at-point' do it's job instead of replicating completion logic.
Removed vars:
 + python-shell-completion-original-window-configuration
2012-05-17 00:03:36 -03:00
Fabián Ezequiel Gallina
394f09a38f Make python-shell-completion--do-completion-at-point' work for calls done via python-completion-complete-at-point'.
The comint prompt retrieval logic was failing on
`python-shell-completion--do-completion-at-point' when calls to it
happened from outside the process buffer.
2012-05-17 00:03:36 -03:00
Fabián Ezequiel Gallina
cd1ed6c8f4 python-end-of-defun-function now works correctly when comments are not indented properly.
Calling `end-of-defun' on a python file will now do the correct thing,
even for cases like this:

    def fib(n):
        if n < 2:
    #       base cases
            return n
        else:
            return fib(n - 2) + fib(n - 1)
2012-05-17 00:03:36 -03:00
Fabián Ezequiel Gallina
dc4f2e5326 Enhancements on indentation for lines after a backslash continuation.
Backslashed continuations with parens in the middle are now handled
correctly. Things like this are now indented properly:

objects = Thing.objects.all() \
                       .filter(
                           type="toy",
                           status="bought"
                           subtype="car"
                       ) \
                       .aggregate(
                           Sum('amount')
                       ) \
                       .values_list()

New Functions:

    * `python-info-beginning-of-backlash' returns the point where a
      backslashed line start.
2012-05-17 00:03:36 -03:00
Fabián Ezequiel Gallina
479a14cc3a Added self to the list of font-lock-keywords 2012-05-17 00:03:35 -03:00
Fabián Ezequiel Gallina
27d7f16f7a Updated `python-font-lock-keywords' to match latest Python 2.7 and 3.2 documentation. 2012-05-17 00:03:35 -03:00
Fabián Ezequiel Gallina
6cad4c6e30 Beautified code
* All columns are now less that 79 chars.
  * Removed tabs that were beign used to indent code.
  * Reindented the whole file.
2012-05-17 00:03:35 -03:00
Fabián Ezequiel Gallina
0674d3fadb Enhancements on indentation code and related functions.
This commit includes:

    * A more robust implementation of `python-indent-calculate-indentation'.
    * enhancements on `python-indent-context' when dealing with backslashes
      and blocks.
    * Many changes, comments and enhancements to
      `python-indent-calculate-indentation'. Many of them especially focused
      to match pep8 guidelines, being this one the most important new one:
      http://mail.python.org/pipermail/python-dev/2011-June/111760.html
    * Better `python-info-line-ends-backslash-p' that would work as intended
      on narrowed buffers.
    * `python-info-continuation-line-p' now does what's supposed to do.
    * Enhanced implementation of `python-info-continuation-line-p',
      `python-info-block-continuation-line-p' and
      `python-info-assignment-continuation-line-p'

New Functions:

    * `python-util-forward-comment' a simple replacement `forward-comment'
      with some necessary enhancements.
2012-05-17 00:03:34 -03:00
Fabián Ezequiel Gallina
bbd27e0710 `python-check' now can have named buffers on its own depending the command launched.
New vars:
  + python-check-buffer-name
2012-05-17 00:03:34 -03:00
Fabián Ezequiel Gallina
bba416bcf2 Enhancements on python-check command.
Use pyflakes (PyChecker is dead) and run the process respecting
virtualenv rules.
2012-05-17 00:03:34 -03:00
Fabián Ezequiel Gallina
c4b155cb49 Removed :safe attribute for dangerous variables
Changed vars:
 + python-shell-interpreter
 + python-shell-interpreter-args
 + python-shell-completion-setup-code
 + python-shell-completion-string-code
 + python-shell-completion-module-string-code
 + python-shell-completion-pdb-string-code
 + python-ffap-setup-code
 + python-ffap-string-code
 + python-check-command
 + python-eldoc-setup-code
 + python-eldoc-string-code
2012-05-17 00:03:33 -03:00
Fabián Ezequiel Gallina
e37a45513c Fixed docstring typos 2012-05-17 00:03:33 -03:00
Fabián Ezequiel Gallina
a1ea6ab81c Enhanced shell setup for Windows.
Also added documentation explaining how to spawn the iPython process
on Windows.
2012-05-17 00:03:32 -03:00
Fabián Ezequiel Gallina
722c985bb0 Added compatibility with lastest CEDET.
Obsolete variables definitions:
  + python-buffer => python-shell-internal-buffer

Obsolete functions definitions:
  + python-proc => python-shell-internal-get-or-create-process
  + python-send-string => python-shell-internal-send-string
2012-05-17 00:03:32 -03:00
Fabián Ezequiel Gallina
338a21d0d1 Improvements on completion code.
Do no complete when defining a code block (we can't do this until
finding some way of getting raw tabs to the interpreter correctly)
2012-05-17 00:03:32 -03:00
Fabián Ezequiel Gallina
aa4099353c Improved completion support when in [i]pdb
`python-shell-completion--do-completion-at-point' has been modified in
order to support different completion contexts easily.

New vars:
 + python-shell-completion-pdb-string-code
2012-05-17 00:03:31 -03:00
Fabián Ezequiel Gallina
76a9ea3bbb Added `python-pdbtrack-activate' variable to allow users to activate/deactivate pdbtrack.
To keep in sync with the old behavior its default value is t.
2012-05-17 00:03:31 -03:00
Fabián Ezequiel Gallina
f6b59cd190 Renamed stuff to keep "namespace" clean.
Renamed vars:
 + python-shell-module-completion-string-code => python-shell-completion-module-string-code
 + python-completion-original-window-configuration => python-shell-completion-original-window-configuration
2012-05-17 00:03:31 -03:00
Dan Davison
9a5fc05973 Don't request completions for zero-length input
Fixes a bug in which incorrect completion output was displayed, for
example when point was after a closing paren.
2012-05-17 00:03:30 -03:00
Fabián Ezequiel Gallina
c7815c384b Make `python-shell-send-string-no-output' delete trailing newlines from output. 2012-05-17 00:03:30 -03:00
Dan Davison
291e2b939b Dismiss completions buffer when unique completion has been made 2012-05-17 00:03:30 -03:00
Fabián Ezequiel Gallina
9399498ea7 Documentation enhancements 2012-05-17 00:03:29 -03:00
Fabián Ezequiel Gallina
2bdce3883b Renamed indentity occurrences to identity in previous commmit 2012-05-17 00:03:29 -03:00
Fabián Ezequiel Gallina
279c9272ee Enhancements to internal python shell naming.
The internal python shell now takes into account more shell settings
in order to generate the unique hash for its name.

Also `python-shell-setup-codes' has been simplified and is not allowed
to be a list of cons anymore.
2012-05-17 00:03:29 -03:00
Fabián Ezequiel Gallina
e1f00930bf Enhancements to pdbtrack.
pdbtrack now handles correctly the case where the stacktrace
information is on the second line.

All python buffers not opened by the user and used for tracking are
closed automatically when tracking process finishes.

Simplified code for keeping the tracked buffer.

Removed vars:
 + python-pdbtrack-tracking-buffers

Removed functions:
 + python-pdbtrack-get-or-add-tracking-buffers

New vars:
 + python-pdbtrack-tracked-buffer
 + python-pdbtrack-buffers-to-kill

New functions:
 + python-pdbtrack-set-tracked-buffer
2012-05-17 00:03:28 -03:00
Fabián Ezequiel Gallina
aeac8c27f2 Enhancements to pdbtrack
pdbtracking now autodetects the filename being tracked from the prompt
and not from the `inferior-python-mode-current-file' variable.

Removed vars:
  + `inferior-python-mode-current-file'
2012-05-17 00:03:28 -03:00
Fabián Ezequiel Gallina
8386d830a3 Documentation enhancements and other small fixes.
Removed vars:
  + python-shell-import-line-regexp
2012-05-17 00:03:28 -03:00
Dan Davison
9253ea694d Complete module import lines in addition to variable names
Available when using ipython v0.11. Completions on lines starting with
"from " or "import " are supplied by
IPython.core.completerlib.module_completion

ipython v0.11 configuration:

(setq python-shell-interpreter "ipython"
      python-shell-completion-setup-code
      "from IPython.core.completerlib import module_completion\n"
      python-shell-module-completion-string-code
      "';'.join(module_completion('''%s'''))\n"
      python-shell-completion-string-code
      "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
2012-05-17 00:03:27 -03:00
Dan Davison
b71bfa9cd6 Return appropriate value to comint-dynamic-complete
This avoids a "No completions for ..." message being issued when a
completion has been made. Also, reduces redundancy between the
inferior-python-mode and python-mode completion code.
2012-05-17 00:03:27 -03:00
Fabián Ezequiel Gallina
929036b470 Enhancements to `python-shell-calculate-process-environment'
The `python-shell-extra-pythonpaths' variable have been introduced as
simple way of adding paths to the PYTHONPATH without affecting
existing values.
2012-05-17 00:03:27 -03:00
Fabián Ezequiel Gallina
40417cb37a Enhancements on python-shell-calculate-process-environment' and python-shell-calculate-exec-path'
Removed functions:
 + python-util-merge
2012-05-17 00:03:26 -03:00
Fabián Ezequiel Gallina
fc6c545e4c Added simple way of jumping to current buffer's class/function definitions
The new `python-nav-jump-to-defun' function allows a user to jump fast
and easy to a function or class definition in the current buffer. For
this a entry in the menu and the C-c C-j keybinding have been
introduced.

New functions:
 + `python-nav-list-defun-positions'
 + `python-nav-read-defun'
 + `python-nav-jump-to-defun'

The new function `python-nav-list-defun-positions' does the same as a
relevant part of the `python-imenu-create-index' so the latter has
been refactored to use it.
2012-05-17 00:03:25 -03:00
Fabián Ezequiel Gallina
1faf2911d6 Enhancements to python-shell-send-string-no-output to work OK with iPython 0.11
Also the documentation has been updated with info to make iPython 0.11
and 0.10 work with python.el's shell integration.
2012-05-17 00:03:25 -03:00
Fabián Ezequiel Gallina
a0686d71f6 Make run-python-internal to set process-query-on-exit-flag to nil
Also python-shell-make-comint now returns the process buffer name.
2012-05-17 00:03:25 -03:00
Fabián Ezequiel Gallina
fad22dec87 Fixed indentation case for after beginning of block 2012-05-17 00:03:25 -03:00
Fabián Ezequiel Gallina
fbc39529f0 Renamed python-clone-local-variables to python-util-clone-local-variables 2012-05-17 00:03:24 -03:00
Fabián Ezequiel Gallina
d2190c5795 New function python-clone-local-variables
Copied from org.el: it allows the `python-shell-make-comint' to be
simplified. It copies all local variables from a buffer to the
current.
2012-05-17 00:03:24 -03:00
Fabián Ezequiel Gallina
307bd2e8c7 Fix typo enviroment => environment
Removed function:
    * python-shell-calculate-process-enviroment

New function:
    * python-shell-calculate-process-environment
2012-05-17 00:03:24 -03:00
Fabián Ezequiel Gallina
96eeb83a55 Make shells inherit variables from parent buffer and internal shells not show by default.
python-shell-make-comint now passes all parent buffer variables to the
comint buffer created ensuring local variables work as intended. Also,
this function now receives a third optional argument called POP that
establishes if the created comint buffer should be displayed or not
after its creation.
2012-05-17 00:03:23 -03:00
Fabián Ezequiel Gallina
0f55249e18 Use defcustom with :safe whenever is possible. 2012-05-17 00:03:23 -03:00
Fabián Ezequiel Gallina
77afb61ab3 Refactored run-python and run-python-internal.
Created new function python-shell-make-comint that takes care of
creating comint processes.

New Function:
    * python-shell-make-comint
2012-05-17 00:03:22 -03:00
Fabián Ezequiel Gallina
257b0017ef Fixed cornercase for normal lines when indentation was triggered in the middle of them 2012-05-17 00:03:22 -03:00