Merge lp:~ufleisch/python-mode/improve-completion into lp:python-mode/components-python-mode

Proposed by Urs Fleisch
Status: Merged
Approved by: Andreas Roehler
Approved revision: no longer in the source branch.
Merged at revision: 2542
Proposed branch: lp:~ufleisch/python-mode/improve-completion
Merge into: lp:python-mode/components-python-mode
Diff against target: 39 lines (+16/-6)
1 file modified
completion/pycomplete.py (+16/-6)
To merge this branch: bzr merge lp:~ufleisch/python-mode/improve-completion
Reviewer Review Type Date Requested Status
Andreas Roehler Pending
Review via email: mp+258353@code.launchpad.net

Description of the change

Fix pycomplete.py for Python 3.

To post a comment you must log in.
2358. By Andreas Roehler

py-indent-or-complete fixed

Indentation was not triggered when at space in line

2359. By Andreas Roehler

`py--execute-base' fixed

Avoid wrong quotes

2360. By Andreas Roehler

`py-electric-backspace', lp:1453384

fixed

2361. By Andreas Roehler

`py-electric-delete, lp:1453384

fixed

2362. By Andreas Roehler

all-travis-ci.sh

2363. By Andreas Roehler

New keys setting in `py-python-shell-mode-map'

[(control c)(control l)] 'comint-dynamic-list-input-ring)
[(control c)(control r)] 'comint-previous-prompt)

Behaviour similar to Emacs comint/Python environment.
Taken from shift-keys, which are still there:

[(control c)(<)] 'py-shift-left)
[(control c)(>)] 'py-shift-right)

2364. By Andreas Roehler

Command args handed over as string, not list

2365. By Andreas Roehler

file' is not a built-in for Python 3, lp:1454858

fixed

Fontify buffer according to result of `py-choose-shell',
unless new var `py-python-edit-version' tells otherwise

2366. By Andreas Roehler

py--create-new-shell sets py-exception-buffer incorrectly, lp:1456415

fixed

Thanks Seong-Kook Shin for the patch

2367. By Andreas Roehler

"print" removed from `python-font-lock-keywords' initial setting

2368. By Andreas Roehler

`py-execution-region' commands restored, lp:1456456

2369. By Andreas Roehler

Reset py-version format to good old times, lp:1456456

2370. By Andreas Roehler

test/py-execute-region-commandp-test.el added

2371. By Andreas Roehler

execute-region forms re-organized

2372. By Andreas Roehler

`py-goto-statement-below' unused form, removed

Erroneous defalias removed

2373. By Andreas Roehler

Don't hard-code imenu-max-items - new py-imenu-max-items

2374. By Andreas Roehler

`py-indent-or-complete' fixed

Deal with empty string as result

2375. By Andreas Roehler

py-checker call fixed

2376. By Andreas Roehler

in string/comment tests added

2377. By Andreas Roehler

asically use `backward' and `forward' instead of beginning/end of

`py-beginning-of-statement' aliased `py-backward-statement' etc.

"beginning/end"-named forms intended for booleans, which should make
sripting easier.

2378. By Andreas Roehler

Delete key deletes only whitespace, lp:1465648, fixed

2379. By Andreas Roehler

py-electric-delete, again

2380. By Andreas Roehler

`py-end-of-def' hangs, if no newline at EOB, fixed

2381. By Andreas Roehler

Evaluating chunks of code,, lp:1467217, fixed

New commands:

  - py-execute-section
  - py-execute-section-python
  - py-execute-section-python2
  - py-execute-section-python3
  - py-execute-section-ipython
  - py-execute-section-ipython2.7
  - py-execute-section-ipython3
  - py-execute-section-jython

2382. By Andreas Roehler

`py-beginning-of-commented-section' renamed `py-beginning-of-comments'

Don't confuse with evaluating chunks of code commands

2383. By Andreas Roehler

Provide py-narrow-to-class and related commands, lp:1467160, fixed

  - py-narrow-to-block
  - py-narrow-to-block-or-clause
  - py-narrow-to-class
  - py-narrow-to-clause
  - py-narrow-to-def
  - py-narrow-to-def-or-class
  - py-narrow-to-statement

2384. By Andreas Roehler

py-sectionize-region, new commands

- py-backward-section
- py-forward-section

2385. By Andreas Roehler

Docu updated

2386. By Andreas Roehler

Put forward/backward section into python-components-move.el

2387. By Andreas Roehler

Some cleanup

2388. By Andreas Roehler

Set C-M-f, C-M-b to forward/backward expression.

If `py-sexp-use-expression-p' is `t'

C-M-f calls `py-forward-expression'
C-M-b calls `py-backward-expression'

Default is nil

2389. By Andreas Roehler

`py-forward-expression' re-write

Unused bounds-forms removed

2390. By Andreas Roehler

`py-backward-expression' re-write

2391. By Andreas Roehler

Use `py-backward-' forms instead of `py-beginning-of'

Resp. `py-forward' forms instead of `py-end-of'

`py-beginning-of', `py-end-of' reserved for positions and booleans
Old commands aliased

2392. By Andreas Roehler

Remove not useful comment-forms

2393. By Andreas Roehler

devel/python-mode-utils.el splitted

  devel/python-mode-write-menu.el
  devel/python-mode-write-tests.el
  test/py-ert-forward-tests.el

py-ipython-input-prompt-re moved to setq, minor change

2394. By Andreas Roehler

  .travis.yml

2395. By Andreas Roehler

Some tests fail for unknown reasons at Travis CI

Put into test/py-non-travis-tests.el

2396. By Andreas Roehler

email updated

2397. By Andreas Roehler

Menu updated

2398. By Andreas Roehler

Docu updated

2399. By Andreas Roehler

python-components-create-menu.el belongs into devel

2400. By Andreas Roehler

py-match-paren, lp:1468198, fixed

If at a beginning, jump to end and vice versa.

When called from within, go to the start.
Matches lists, but also block, statement, string and comment.

2401. By Andreas Roehler

When at empty line, match block according to indent

2402. By Andreas Roehler

py-match-paren closing delimiter, lp:1471122, fixed

Make `py-match-paren' forward stop at the closing delimiters indent

2403. By Andreas Roehler

Unused arg `keep-level' removed, minor-cleanup

2404. By Andreas Roehler

`py-match-paren', tests and fixes

`py-down-top-level' re-considered

2405. By Andreas Roehler

`py--match-end-finish' fixed

2406. By Andreas Roehler

py-match-paren from class, fixed

2407. By Andreas Roehler

`py-guess-py-install-directory' fixed

2408. By Andreas Roehler

`py--delete-trailing-whitespace' use argument orig

2409. By Andreas Roehler

defalias `py-backward-declarations' fixed

obsolete aliases removed

2410. By Andreas Roehler

Reduce compiler warnings

2411. By Andreas Roehler

py-indent-line, minor fix

2412. By Andreas Roehler

Remove redundant definition of `py--beginning-of-except-block-position-bol'

2413. By Andreas Roehler

Remove wrong definition of `py-backward-statement-bol'

2414. By Andreas Roehler

Redundant `py-forward-line', `py-forward-line-bol' removed

2415. By Andreas Roehler

delete-forms fixed

2416. By Andreas Roehler

`py--jump-to-exception' fixed

2417. By Andreas Roehler

Fix delete-forms, again

2418. By Andreas Roehler

`py--jump-to-exception-intern', again

2419. By Andreas Roehler

Unused function `py--display-windows' commented out

2420. By Andreas Roehler

Reset email to "@online.de"

2421. By Andreas Roehler

Set `py-install-directory' if empty

2422. By Andreas Roehler

`py-backward-statement-bol' not part of backward-forms

statement is special wrt blocks defined by keywords

2423. By Andreas Roehler

`py-guess-py-install-directory', fixed

py-install-directory used as var here

2424. By Andreas Roehler

`py--jump-to-exception' fixed

2425. By Andreas Roehler

`py--grab-prompt-ps1', unused for now, minor fix

2426. By Andreas Roehler

`py--create-new-shell', hand over executable

2427. By Andreas Roehler

`py--close-execution', hand over tempfile

2428. By Andreas Roehler

`py--execute-base-intern', hand over `execute-directory'

2429. By Andreas Roehler

`py--execute-buffer-finally', let-bound return value, minor-fix

2430. By Andreas Roehler

exexute, typo fixed

2431. By Andreas Roehler

py--execute-base-intern hand over start end

2432. By Andreas Roehler

py--execute-base-intern hand over which-shell

2433. By Andreas Roehler

Avoid compiler warning, minor fixes

2434. By Andreas Roehler

Execute-region forms reconsidered

2435. By Andreas Roehler

`py-down-statement' fixed

`py-down-statement' may return nil

2436. By Andreas Roehler

executes reconsidered

2437. By Andreas Roehler

`py-execute-string' arg fixed

2438. By Andreas Roehler

`py-execute-string-dedicated' arg fixed

2439. By Andreas Roehler

`py-match-paren' obsolete alias removed

2440. By Andreas Roehler

New var `py-python-ms-pdb-command'

MS-systems might use that

2441. By Andreas Roehler

Redundant definitions removed

2442. By Andreas Roehler

end-position forms fixed

2443. By Andreas Roehler

More redundancies

Unused function py--bounds-of-region removed
py-beg/end-line normalized backward/forward

2444. By Andreas Roehler

py-forward-line, minor changes

2445. By Andreas Roehler

Redundant `py-comment-region' removed

2446. By Andreas Roehler

`py-section' not suitable inside extended-executes

has a different end as others, needs different treatment

2447. By Andreas Roehler

`py-comment-auto-fill', minor change

2448. By Andreas Roehler

Prefixed `ar-py' normalized to `py-'

2449. By Andreas Roehler

Reduce compiler warnings

2450. By Andreas Roehler

top-level booleans don't make sense as -bol suffixed

2451. By Andreas Roehler

forward/backward function minor fixes

2452. By Andreas Roehler

py--end-of-paragraph-position-bol removed

2453. By Andreas Roehler

`py-backward-decorator-bol' aliased `py-backward-decorator'

2454. By Andreas Roehler

`py-end-of-comment' alias `py-forward-comment'

2455. By Andreas Roehler

`py--dump-help-string' fixed

2456. By Andreas Roehler

Menu fixed

2457. By Andreas Roehler

`py-execute-import-or-reload', typo

2458. By Andreas Roehler

`py--beginning-of-line-form', hand over argument erg

2459. By Andreas Roehler

`py--guess-buffer-name' fixed

2460. By Andreas Roehler

`py--reuse-existing-shell', hand over exception-buffer

2461. By Andreas Roehler

`py--create-new-shell', hand over args

2462. By Andreas Roehler

`py--create-new-shell', hand over exception-buffer

2463. By Andreas Roehler

`py--provide-command-args' hand over fast-process

2464. By Andreas Roehler

`py--execute-ge24.3' hand over origline

2465. By Andreas Roehler

`py-execute-python-mode-v5' hand over origline

2466. By Andreas Roehler

`py--execute-file-base' hand over origline

2467. By Andreas Roehler

`py--execute-file-base' provide windows-config

2468. By Andreas Roehler

`py--fix-start', args of py-shift-left fixed

2469. By Andreas Roehler

`py--execute-buffer-finally' hand over origline

2470. By Andreas Roehler

`py--guess-buffer-name' re-write

2471. By Andreas Roehler

`py--provide-command-args' hand over argprompt

2472. By Andreas Roehler

`py--shell-insert-completion-maybe' hand over input

2473. By Andreas Roehler

`py-check-command' fixed

2474. By Andreas Roehler

`py--match-end-finish' hand over cui

2475. By Andreas Roehler

Unused `py--match-paren-indented-empty' removed

2476. By Andreas Roehler

`py-python-shell-mode', use current process

py-electric-space renamed `py-electric-close'
New customizable `py-electric-close-active-p'

2477. By Andreas Roehler

`py--skip-to-comment-or-semicolon' hand over done

2478. By Andreas Roehler

`py--go-down-when-found-upward' hand over regexp

2479. By Andreas Roehler

`py-down-statement' minor fix

2480. By Andreas Roehler

`py--in-or-behind-or-before-a-docstring' fixed

2481. By Andreas Roehler

`py-python-shell-mode' again

2482. By Andreas Roehler

`py--go-down-when-found-upward' again

2483. By Andreas Roehler

`py--end-base-look-upward' minor fix

2484. By Andreas Roehler

`py--fill-docstring-base', let-bound delimiters style

2485. By Andreas Roehler

`py--fill-docstring-base', hand over py-current-indent

2486. By Andreas Roehler

`py--fill-docstring-base', hand over orig

2487. By Andreas Roehler

`py--execute-prepare' provide origline

2488. By Andreas Roehler

`py--unfontify-banner-intern' receive buffer

2489. By Andreas Roehler

`py--fill-docstring-last-line' receive orig

2490. By Andreas Roehler

`py--fill-docstring-first-line' receive beg end thisbeg thisend style

2491. By Andreas Roehler

`py--fill-docstring-last-line' receive first-line-p

2492. By Andreas Roehler

`py--fill-docstring-last-line' receive py-current-indent

2493. By Andreas Roehler

Boolean `py-comment-auto-fill' renamed `py-comment-auto-fill-p'

New customizable `py-comment-auto-fill-p'

2494. By Andreas Roehler

py--end-base-look-upward receive regexp

2495. By Andreas Roehler

auto-fill fixed

2496. By Andreas Roehler

Require which-func, avoid compiler warning `which-func-functions'

2497. By Andreas Roehler

unused function `py--eos-in-string' removed

2498. By Andreas Roehler

Avoid assignment to free variable `line'

2499. By Andreas Roehler

Avoid reference to free variable `docstring'

2500. By Andreas Roehler

`py--skip-to-semicolon-backward' avoid assignment to free variable `done'

2501. By Andreas Roehler

`py--fill-docstring-last-line' hand over docstring

2502. By Andreas Roehler

`py--indent-line-by-line' must start at second line

2503. By Andreas Roehler

`py--docstring-p', lp:1476751, fixed

2504. By Andreas Roehler

Commands in Python-Mode not working, lp:1476933, fixed

2505. By Andreas Roehler

py-ert-split-window-on-execute-1361535-test moved into py-ert-interactive-tests.el

Fails in batch-mode but succeeds interactively

2506. By Andreas Roehler

docstring style nil not like regular string, lp:1477422, fixed

2507. By Andreas Roehler

README_DEVEL.org

Info for tests added

2508. By Andreas Roehler

README_DEVEL.org extended

How to instrument for debug via edebug

2509. By Andreas Roehler

`py-switch-buffers-on-execute-p', lp:1361535, fixed

`py-split-window-on-execute-threshold', new customizable
Don't split when max number of displayed windows is reached.
Default is 3

2510. By Andreas Roehler

py-execute-buffer switches focus, lp:1478122

2511. By Andreas Roehler

py-execute-import-or-reload error, lp:1478893, fixed

2512. By Andreas Roehler

Provide `py-backward-buffer' `py-forward-buffer', lp:1480702

Auto-generated commands may look for it instead
of (goto-char (point-min)), (goto-char (point-max))

However the bug was not confirmed for now.

2513. By Andreas Roehler

Some alias moved into python-components-foot.el

2514. By Andreas Roehler

`py-compute-indentation' minor cleanup

2515. By Andreas Roehler

`py-compute-indentation' after import statement fixed

2516. By Andreas Roehler

`py-sectionize-region' fixed, python-mode-devs/python-mode#2

`py-markup-region-as-section' alias of `py-sectionize-region'

2517. By Andreas Roehler

switches focus and does not reuse, lp:1478122, again

2518. By Andreas Roehler

py-help-at-point empty help-buffer maybe, #3

take action only if at keyword
WRT speed: require fontified keyword

2519. By Andreas Roehler

py-help-at-point should close buffer , #4

2520. By Andreas Roehler

Emacs 25 global-eldoc-mode, #5

Don't turn on global-eldoc-mode at start

2521. By Andreas Roehler

Indent in docstring, #6

- permit indent in docstring as it would do outside strings
- provide a command `py-edit-docstring' - as source code inside a
  temp-buffer

2522. By Andreas Roehler

Named shell window-management, fixed

2523. By Andreas Roehler

Support some more suffixes

2524. By Andreas Roehler

`py-indent-line' fixed

2525. By Andreas Roehler

`py-find-definition' fixed

2526. By Andreas Roehler

`py-execute-line' calls void function, lp:1492054

fixed

2527. By Andreas Roehler

Handle multiple decorators

When `py-mark-decorators' is non-nil, py-backward-... commands should
reach outer decorators, if any.

2528. By Andreas Roehler

Detect new PEP 492 async coroutines

2529. By Andreas Roehler

with-current-buffer vs. set-buffer issues

fixed

2530. By Andreas Roehler

`py-version' fixed

2531. By Andreas Roehler

NEWS updated

2532. By Andreas Roehler

`py-version' updated after release

2533. By Andreas Roehler

py-shell honor `py-switch-buffers-on-execute-p'

2534. By Andreas Roehler

`py-indent-or-complete' , lp:1508179

fixed

Don't try completion when after a closing paren or colon

2535. By Andreas Roehler

Add source directories in comment

2536. By Andreas Roehler

#8, py-extended-block-or-clause-re-raw more customizable

fixed

2537. By Andreas Roehler

`py-current-defun' highlight name if `py-current-defun-show' is t

minor fix

2538. By Andreas Roehler

`py-fast-process' fixed

2539. By Andreas Roehler

#16, async def not working

fixed

2540. By Andreas Roehler

#17, Broken fill paragraph on comments

fixed

2541. By Andreas Roehler

#16, async def not working

again

2542. By Andreas Roehler

#11, which-function-mode sluggish

py-which-def-or-class minor fix

2543. By Andreas Roehler

Unused optional argument "indent" removed

2544. By Andreas Roehler

Remove python-rx

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'completion/pycomplete.py'
2--- completion/pycomplete.py 2012-08-19 12:45:40 +0000
3+++ completion/pycomplete.py 2015-12-01 08:24:23 +0000
4@@ -231,9 +231,14 @@
5 # is wrapped in try-except, so use only the import statement.
6 body.append(imp_node)
7 else:
8- body.append(ast.TryExcept(body=[imp_node], handlers=[
9- ast.ExceptHandler(type=None, name=None, body=[ast.Pass()])],
10- orelse=[]))
11+ if sys.version_info[0] >= 3: # Python 3
12+ body.append(ast.Try(body=[imp_node], handlers=[
13+ ast.ExceptHandler(type=None, name=None, body=[ast.Pass()])],
14+ orelse=[], finalbody=[]))
15+ else:
16+ body.append(ast.TryExcept(body=[imp_node], handlers=[
17+ ast.ExceptHandler(type=None, name=None, body=[ast.Pass()])],
18+ orelse=[]))
19 node = ast.Module(body=body)
20 ast.fix_missing_locations(node)
21 code = compile(node, fname, 'exec')
22@@ -341,9 +346,14 @@
23 if type_node:
24 # Wrap class lookup in try-except because it is not fail-safe.
25 node.value = ast.copy_location(type_node, node.value)
26- node = ast.copy_location(ast.TryExcept(body=[node], handlers=[
27- ast.ExceptHandler(type=None, name=None, body=[ast.Pass()])],
28- orelse=[]), node)
29+ if sys.version_info[0] >= 3: # Python 3
30+ node = ast.copy_location(ast.Try(body=[node], handlers=[
31+ ast.ExceptHandler(type=None, name=None, body=[ast.Pass()])],
32+ orelse=[], finalbody=[]), node)
33+ else:
34+ node = ast.copy_location(ast.TryExcept(body=[node], handlers=[
35+ ast.ExceptHandler(type=None, name=None, body=[ast.Pass()])],
36+ orelse=[]), node)
37 ast.fix_missing_locations(node)
38 else:
39 node.value = ast.copy_location(

Subscribers

People subscribed via source and target branches