diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 38bf9552b2a..a0a368777e7 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -119,7 +119,7 @@ | |||
| 119 | (1 font-lock-type-face)) | 119 | (1 font-lock-type-face)) |
| 120 | ;; Built-ins. (The next three blocks are from | 120 | ;; Built-ins. (The next three blocks are from |
| 121 | ;; `__builtin__.__dict__.keys()' in Python 2.7) These patterns | 121 | ;; `__builtin__.__dict__.keys()' in Python 2.7) These patterns |
| 122 | ;; are debateable, but they at least help to spot possible | 122 | ;; are debatable, but they at least help to spot possible |
| 123 | ;; shadowing of builtins. | 123 | ;; shadowing of builtins. |
| 124 | (,(rx symbol-start (or | 124 | (,(rx symbol-start (or |
| 125 | ;; exceptions | 125 | ;; exceptions |
| @@ -550,7 +550,7 @@ element matches `python-python-command'." | |||
| 550 | "^> \\(.*\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()" | 550 | "^> \\(.*\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()" |
| 551 | "Regular expression pdbtrack uses to find a stack trace entry.") | 551 | "Regular expression pdbtrack uses to find a stack trace entry.") |
| 552 | 552 | ||
| 553 | (defconst python-pdbtrack-input-prompt "\n[(<]*[Pp]db[>)]+ " | 553 | (defconst python-pdbtrack-input-prompt "\n[(<]*[Ii]?[Pp]db[>)]+ " |
| 554 | "Regular expression pdbtrack uses to recognize a pdb prompt.") | 554 | "Regular expression pdbtrack uses to recognize a pdb prompt.") |
| 555 | 555 | ||
| 556 | (defconst python-pdbtrack-track-range 10000 | 556 | (defconst python-pdbtrack-track-range 10000 |
| @@ -948,22 +948,12 @@ Finds end of innermost nested class or method definition." | |||
| 948 | "Go to start of current statement. | 948 | "Go to start of current statement. |
| 949 | Accounts for continuation lines, multi-line strings, and | 949 | Accounts for continuation lines, multi-line strings, and |
| 950 | multi-line bracketed expressions." | 950 | multi-line bracketed expressions." |
| 951 | (beginning-of-line) | 951 | (while |
| 952 | (python-beginning-of-string) | ||
| 953 | (let (point) | ||
| 954 | (while (and (python-continuation-line-p) | ||
| 955 | (if point | ||
| 956 | (< (point) point) | ||
| 957 | t)) | ||
| 958 | (beginning-of-line) | ||
| 959 | (if (python-backslash-continuation-line-p) | 952 | (if (python-backslash-continuation-line-p) |
| 960 | (progn | 953 | (progn (forward-line -1) t) |
| 961 | (forward-line -1) | 954 | (beginning-of-line) |
| 962 | (while (python-backslash-continuation-line-p) | 955 | (or (python-beginning-of-string) |
| 963 | (forward-line -1))) | 956 | (python-skip-out)))) |
| 964 | (python-beginning-of-string) | ||
| 965 | (python-skip-out)) | ||
| 966 | (setq point (point)))) | ||
| 967 | (back-to-indentation)) | 957 | (back-to-indentation)) |
| 968 | 958 | ||
| 969 | (defun python-skip-out (&optional forward syntax) | 959 | (defun python-skip-out (&optional forward syntax) |
| @@ -971,6 +961,7 @@ multi-line bracketed expressions." | |||
| 971 | Skip forward if FORWARD is non-nil, else backward. | 961 | Skip forward if FORWARD is non-nil, else backward. |
| 972 | If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point. | 962 | If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point. |
| 973 | Return non-nil if and only if skipping was done." | 963 | Return non-nil if and only if skipping was done." |
| 964 | ;; FIXME: Use syntax-ppss-toplevel-pos. | ||
| 974 | (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss)))) | 965 | (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss)))) |
| 975 | (forward (if forward -1 1))) | 966 | (forward (if forward -1 1))) |
| 976 | (unless (zerop depth) | 967 | (unless (zerop depth) |
| @@ -2562,7 +2553,7 @@ If the traceback target file path is invalid, we look for the | |||
| 2562 | most recently visited python-mode buffer which either has the | 2553 | most recently visited python-mode buffer which either has the |
| 2563 | name of the current function or class, or which defines the | 2554 | name of the current function or class, or which defines the |
| 2564 | function or class. This is to provide for scripts not in the | 2555 | function or class. This is to provide for scripts not in the |
| 2565 | local filesytem (e.g., Zope's 'Script \(Python)', but it's not | 2556 | local file system (e.g., Zope's 'Script \(Python)', but it's not |
| 2566 | Zope specific). If you put a copy of the script in a buffer | 2557 | Zope specific). If you put a copy of the script in a buffer |
| 2567 | named for the script and activate python-mode, then pdbtrack will | 2558 | named for the script and activate python-mode, then pdbtrack will |
| 2568 | find it." | 2559 | find it." |
| @@ -2592,6 +2583,7 @@ find it." | |||
| 2592 | (if (not (string-match (concat python-pdbtrack-input-prompt "$") block)) | 2583 | (if (not (string-match (concat python-pdbtrack-input-prompt "$") block)) |
| 2593 | (python-pdbtrack-overlay-arrow nil) | 2584 | (python-pdbtrack-overlay-arrow nil) |
| 2594 | 2585 | ||
| 2586 | (setq block (ansi-color-filter-apply block)) | ||
| 2595 | (setq target (python-pdbtrack-get-source-buffer block)) | 2587 | (setq target (python-pdbtrack-get-source-buffer block)) |
| 2596 | 2588 | ||
| 2597 | (if (stringp target) | 2589 | (if (stringp target) |