diff options
| author | Fabián Ezequiel Gallina | 2013-02-19 00:18:32 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2013-02-19 00:18:32 -0300 |
| commit | 2af3b9c16e340ad034e57e949f09bbafc00bd52c (patch) | |
| tree | a8f68cb43ad0913f4c10b527276e2901eaaea0ff | |
| parent | 6db17b0200e342dae7a1e09df7f03f80dcbf3fad (diff) | |
| download | emacs-2af3b9c16e340ad034e57e949f09bbafc00bd52c.tar.gz emacs-2af3b9c16e340ad034e57e949f09bbafc00bd52c.zip | |
* progmodes/python.el (python-indent-context): Fix
python-info-line-ends-backslash-p call.
(python-info-line-ends-backslash-p)
(python-info-beginning-of-backslash): Respect line-number
argument.
(python-info-current-line-comment-p): Fix behavior when not at
beginning-of-line.
(python-util-position): Remove function.
(python-util-goto-line): New function.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 25 |
2 files changed, 24 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7d7e62e8141..f99cab9edbf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2013-02-19 Fabián Ezequiel Gallina <fgallina@cuca> | ||
| 2 | |||
| 3 | * progmodes/python.el (python-indent-context): Fix | ||
| 4 | python-info-line-ends-backslash-p call. | ||
| 5 | (python-info-line-ends-backslash-p) | ||
| 6 | (python-info-beginning-of-backslash): Respect line-number | ||
| 7 | argument. | ||
| 8 | (python-info-current-line-comment-p): Fix behavior when not at | ||
| 9 | beginning-of-line. | ||
| 10 | (python-util-position): Remove function. | ||
| 11 | (python-util-goto-line): New function. | ||
| 12 | |||
| 1 | 2013-02-18 Michael Albinus <michael.albinus@gmx.de> | 13 | 2013-02-18 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 14 | ||
| 3 | * eshell/em-unix.el (eshell/su): Require tramp. | 15 | * eshell/em-unix.el (eshell/su): Require tramp. |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 92f86ce1231..49eaff637a6 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -698,10 +698,9 @@ START is the buffer position where the sexp starts." | |||
| 698 | ;; After backslash | 698 | ;; After backslash |
| 699 | ((setq start (when (not (or (python-syntax-context 'string ppss) | 699 | ((setq start (when (not (or (python-syntax-context 'string ppss) |
| 700 | (python-syntax-context 'comment ppss))) | 700 | (python-syntax-context 'comment ppss))) |
| 701 | (let ((line-beg-pos (line-beginning-position))) | 701 | (let ((line-beg-pos (line-number-at-pos))) |
| 702 | (when (python-info-line-ends-backslash-p | 702 | (python-info-line-ends-backslash-p |
| 703 | (1- line-beg-pos)) | 703 | (1- line-beg-pos))))) |
| 704 | (- line-beg-pos 2))))) | ||
| 705 | 'after-backslash) | 704 | 'after-backslash) |
| 706 | ;; After beginning of block | 705 | ;; After beginning of block |
| 707 | ((setq start (save-excursion | 706 | ((setq start (save-excursion |
| @@ -3105,7 +3104,7 @@ With optional argument LINE-NUMBER, check that line instead." | |||
| 3105 | (save-restriction | 3104 | (save-restriction |
| 3106 | (widen) | 3105 | (widen) |
| 3107 | (when line-number | 3106 | (when line-number |
| 3108 | (goto-char line-number)) | 3107 | (python-util-goto-line line-number)) |
| 3109 | (while (and (not (eobp)) | 3108 | (while (and (not (eobp)) |
| 3110 | (goto-char (line-end-position)) | 3109 | (goto-char (line-end-position)) |
| 3111 | (python-syntax-context 'paren) | 3110 | (python-syntax-context 'paren) |
| @@ -3121,7 +3120,7 @@ Optional argument LINE-NUMBER forces the line number to check against." | |||
| 3121 | (save-restriction | 3120 | (save-restriction |
| 3122 | (widen) | 3121 | (widen) |
| 3123 | (when line-number | 3122 | (when line-number |
| 3124 | (goto-char line-number)) | 3123 | (python-util-goto-line line-number)) |
| 3125 | (when (python-info-line-ends-backslash-p) | 3124 | (when (python-info-line-ends-backslash-p) |
| 3126 | (while (save-excursion | 3125 | (while (save-excursion |
| 3127 | (goto-char (line-beginning-position)) | 3126 | (goto-char (line-beginning-position)) |
| @@ -3200,7 +3199,9 @@ operator." | |||
| 3200 | 3199 | ||
| 3201 | (defun python-info-current-line-comment-p () | 3200 | (defun python-info-current-line-comment-p () |
| 3202 | "Check if current line is a comment line." | 3201 | "Check if current line is a comment line." |
| 3203 | (char-equal (or (char-after (+ (point) (current-indentation))) ?_) ?#)) | 3202 | (char-equal |
| 3203 | (or (char-after (+ (line-beginning-position) (current-indentation))) ?_) | ||
| 3204 | ?#)) | ||
| 3204 | 3205 | ||
| 3205 | (defun python-info-current-line-empty-p () | 3206 | (defun python-info-current-line-empty-p () |
| 3206 | "Check if current line is empty, ignoring whitespace." | 3207 | "Check if current line is empty, ignoring whitespace." |
| @@ -3215,12 +3216,10 @@ operator." | |||
| 3215 | 3216 | ||
| 3216 | ;;; Utility functions | 3217 | ;;; Utility functions |
| 3217 | 3218 | ||
| 3218 | (defun python-util-position (item seq) | 3219 | (defun python-util-goto-line (line-number) |
| 3219 | "Find the first occurrence of ITEM in SEQ. | 3220 | "Move point to LINE-NUMBER." |
| 3220 | Return the index of the matching item, or nil if not found." | 3221 | (goto-char (point-min)) |
| 3221 | (let ((member-result (member item seq))) | 3222 | (forward-line (1- line-number))) |
| 3222 | (when member-result | ||
| 3223 | (- (length seq) (length member-result))))) | ||
| 3224 | 3223 | ||
| 3225 | ;; Stolen from org-mode | 3224 | ;; Stolen from org-mode |
| 3226 | (defun python-util-clone-local-variables (from-buffer &optional regexp) | 3225 | (defun python-util-clone-local-variables (from-buffer &optional regexp) |