[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r110426: Enhancements to indentation.
From: |
Fabián Ezequiel Gallina |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r110426: Enhancements to indentation. |
Date: |
Sun, 07 Oct 2012 13:13:52 -0300 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110426
committer: Fabián Ezequiel Gallina <address@hidden>
branch nick: trunk
timestamp: Sun 2012-10-07 13:13:52 -0300
message:
Enhancements to indentation.
* lisp/progmodes/python.el (python-indent-context): Give priority to
inside-string context. Make comments indentation markers.
(python-indent-region): Do not mess with strings, unless it's the
enclosing set of quotes.
modified:
lisp/ChangeLog
lisp/progmodes/python.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-10-07 15:54:30 +0000
+++ b/lisp/ChangeLog 2012-10-07 16:13:52 +0000
@@ -1,3 +1,11 @@
+2012-10-07 Fabián Ezequiel Gallina <address@hidden>
+
+ Enhancements to indentation.
+ * progmodes/python.el (python-indent-context): Give priority to
+ inside-string context. Make comments indentation markers.
+ (python-indent-region): Do not mess with strings, unless it's the
+ enclosing set of quotes.
+
2012-10-07 Stefan Monnier <address@hidden>
* window.el (internal--before-save-selected-window)
=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el 2012-10-07 04:33:16 +0000
+++ b/lisp/progmodes/python.el 2012-10-07 16:13:52 +0000
@@ -676,12 +676,12 @@
(goto-char (line-beginning-position))
(bobp))
'no-indent)
+ ;; Inside string
+ ((setq start (python-syntax-context 'string ppss))
+ 'inside-string)
;; Inside a paren
((setq start (python-syntax-context 'paren ppss))
'inside-paren)
- ;; Inside string
- ((setq start (python-syntax-context 'string ppss))
- 'inside-string)
;; After backslash
((setq start (when (not (or (python-syntax-context 'string ppss)
(python-syntax-context 'comment ppss)))
@@ -710,7 +710,7 @@
;; After normal line
((setq start (save-excursion
(back-to-indentation)
- (python-util-forward-comment -1)
+ (skip-chars-backward (rx (or whitespace ?\n)))
(python-nav-beginning-of-statement)
(point-marker)))
'after-line)
@@ -973,7 +973,16 @@
(back-to-indentation)
(setq word (current-word))
(forward-line 1)
- (when word
+ (when (and word
+ ;; Don't mess with strings, unless it's the
+ ;; enclosing set of quotes.
+ (or (not (python-syntax-context 'string))
+ (eq
+ (syntax-after
+ (+ (1- (point))
+ (current-indentation)
+ (python-syntax-count-quotes (char-after)
(point))))
+ (string-to-syntax "|"))))
(beginning-of-line)
(delete-horizontal-space)
(indent-to (python-indent-calculate-indentation)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r110426: Enhancements to indentation.,
Fabián Ezequiel Gallina <=