diff options
| author | Paul Eggert | 2015-02-25 22:53:56 -0800 |
|---|---|---|
| committer | Paul Eggert | 2015-02-25 22:53:56 -0800 |
| commit | d8e9122115b5ffcec342c841b81cb2d2b8217e4b (patch) | |
| tree | 477830be0a1707699381146a4ed45c53d0b928b0 /lisp/progmodes/python.el | |
| parent | cbd447e1cdbbebcd2a04144194138bb7936dea9d (diff) | |
| parent | e726f2058c98e68c951bdb290fe68dac2a84ff65 (diff) | |
| download | emacs-d8e9122115b5ffcec342c841b81cb2d2b8217e4b.tar.gz emacs-d8e9122115b5ffcec342c841b81cb2d2b8217e4b.zip | |
Merge from origin/emacs-24
e726f20 Handle "#" operator properly inside macro. Fix coding bug.
618931b Handle dead frame in menu-bar-non-minibuffer-window-p. (Bug#19728)
017a03a Document MS-Windows file-name idiosyncrasies (Bug#19463)
f3faf4f Fix description of Customize buffer in Emacs manual.
1c1d0b7 Fix a typo in the Emacs manual's Hungry Delete description.
be7fb82 src/dispextern.h (FACE_FOR_CHAR): Fix the commentary.
33c4409 Spelling fixes
6c8231e python.el: Handle tabs in python-indent-dedent-line.
41c3b92 * lisp/progmodes/python.el: Respect user indentation after comment.
868df45 Avoid compiler warnings in decode_env_path.
b28c979 Fix XEmacs version typo in comment and ChangeLog
989fb32 Improve solution of bug #19701
6310530 Fix refilling of list of language environments in User Manual
c4c447d Restore XEmacs compatibility
Conflicts:
doc/emacs/ChangeLog
lisp/ChangeLog
src/ChangeLog
test/ChangeLog
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 4420faf3dfc..1c3f7466c8c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -843,15 +843,6 @@ keyword | |||
| 843 | ;; Beginning of buffer. | 843 | ;; Beginning of buffer. |
| 844 | ((= (line-number-at-pos) 1) | 844 | ((= (line-number-at-pos) 1) |
| 845 | (cons :no-indent 0)) | 845 | (cons :no-indent 0)) |
| 846 | ;; Comment continuation (maybe). | ||
| 847 | ((save-excursion | ||
| 848 | (when (and | ||
| 849 | (or | ||
| 850 | (python-info-current-line-comment-p) | ||
| 851 | (python-info-current-line-empty-p)) | ||
| 852 | (forward-comment -1) | ||
| 853 | (python-info-current-line-comment-p)) | ||
| 854 | (cons :after-comment (point))))) | ||
| 855 | ;; Inside a string. | 846 | ;; Inside a string. |
| 856 | ((let ((start (python-syntax-context 'string ppss))) | 847 | ((let ((start (python-syntax-context 'string ppss))) |
| 857 | (when start | 848 | (when start |
| @@ -963,28 +954,29 @@ keyword | |||
| 963 | ((let ((start (python-info-dedenter-statement-p))) | 954 | ((let ((start (python-info-dedenter-statement-p))) |
| 964 | (when start | 955 | (when start |
| 965 | (cons :at-dedenter-block-start start)))) | 956 | (cons :at-dedenter-block-start start)))) |
| 966 | ;; After normal line. | 957 | ;; After normal line, comment or ender (default case). |
| 967 | ((let ((start (save-excursion | 958 | ((save-excursion |
| 968 | (back-to-indentation) | 959 | (back-to-indentation) |
| 969 | (skip-chars-backward " \t\n") | 960 | (skip-chars-backward " \t\n") |
| 970 | (python-nav-beginning-of-statement) | 961 | (python-nav-beginning-of-statement) |
| 971 | (point)))) | 962 | (cons |
| 972 | (when start | 963 | (cond ((python-info-current-line-comment-p) |
| 973 | (if (save-excursion | 964 | :after-comment) |
| 974 | (python-util-forward-comment -1) | 965 | ((save-excursion |
| 975 | (python-nav-beginning-of-statement) | 966 | (goto-char (line-end-position)) |
| 976 | (looking-at (python-rx block-ender))) | 967 | (python-util-forward-comment -1) |
| 977 | (cons :after-block-end start) | 968 | (python-nav-beginning-of-statement) |
| 978 | (cons :after-line start))))) | 969 | (looking-at (python-rx block-ender))) |
| 979 | ;; Default case: do not indent. | 970 | :after-block-end) |
| 980 | (t (cons :no-indent 0)))))) | 971 | (t :after-line)) |
| 972 | (point)))))))) | ||
| 981 | 973 | ||
| 982 | (defun python-indent--calculate-indentation () | 974 | (defun python-indent--calculate-indentation () |
| 983 | "Internal implementation of `python-indent-calculate-indentation'. | 975 | "Internal implementation of `python-indent-calculate-indentation'. |
| 984 | May return an integer for the maximum possible indentation at | 976 | May return an integer for the maximum possible indentation at |
| 985 | current context or a list of integers. The latter case is only | 977 | current context or a list of integers. The latter case is only |
| 986 | happening for :at-dedenter-block-start context since the | 978 | happening for :at-dedenter-block-start context since the |
| 987 | possibilities can be narrowed to especific indentation points." | 979 | possibilities can be narrowed to specific indentation points." |
| 988 | (save-restriction | 980 | (save-restriction |
| 989 | (widen) | 981 | (widen) |
| 990 | (save-excursion | 982 | (save-excursion |
| @@ -1075,7 +1067,7 @@ minimum." | |||
| 1075 | (defun python-indent-line (&optional previous) | 1067 | (defun python-indent-line (&optional previous) |
| 1076 | "Internal implementation of `python-indent-line-function'. | 1068 | "Internal implementation of `python-indent-line-function'. |
| 1077 | Use the PREVIOUS level when argument is non-nil, otherwise indent | 1069 | Use the PREVIOUS level when argument is non-nil, otherwise indent |
| 1078 | to the maxium available level. When indentation is the minimum | 1070 | to the maximum available level. When indentation is the minimum |
| 1079 | possible and PREVIOUS is non-nil, cycle back to the maximum | 1071 | possible and PREVIOUS is non-nil, cycle back to the maximum |
| 1080 | level." | 1072 | level." |
| 1081 | (let ((follow-indentation-p | 1073 | (let ((follow-indentation-p |
| @@ -1110,9 +1102,7 @@ indentation levels from right to left." | |||
| 1110 | (interactive "*") | 1102 | (interactive "*") |
| 1111 | (when (and (not (bolp)) | 1103 | (when (and (not (bolp)) |
| 1112 | (not (python-syntax-comment-or-string-p)) | 1104 | (not (python-syntax-comment-or-string-p)) |
| 1113 | (= (+ (line-beginning-position) | 1105 | (= (current-indentation) (current-column))) |
| 1114 | (current-indentation)) | ||
| 1115 | (point))) | ||
| 1116 | (python-indent-line t) | 1106 | (python-indent-line t) |
| 1117 | t)) | 1107 | t)) |
| 1118 | 1108 | ||