summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-03-16 18:03:42 (GMT)
committerMichael W. Hudson <mwh@python.net>2002-03-16 18:03:42 (GMT)
commit13510e7afb849e7b934fdc946ca38738ed4ea4c4 (patch)
tree826e5985202be547f5cf54ce39de79ddbd96b086
parent09a5bd8c48c7bbb2f5c1f0217a6ef6ce289d1565 (diff)
downloadcpython-13510e7afb849e7b934fdc946ca38738ed4ea4c4.zip
cpython-13510e7afb849e7b934fdc946ca38738ed4ea4c4.tar.gz
cpython-13510e7afb849e7b934fdc946ca38738ed4ea4c4.tar.bz2
backport bwarsaw's checkin of
revision 4.7 of python-mode.el (py-honor-comment-indentation, py-compute-indentation): Fix the implementation to match the documentation for py-honor-comment-indentation w.r.t. not nil or t value. In that case it should still ignore ## for indentation purposes. Closes SF bug #523825, w/ patch provided by Christian Stork (mod'd by Barry). Python 2.2.1 candidate.
-rw-r--r--Misc/python-mode.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el
index eb37e3a..868ff6f 100644
--- a/Misc/python-mode.el
+++ b/Misc/python-mode.el
@@ -184,8 +184,8 @@ indentation is used as a hint for this line's indentation. Lines that
begin with `py-block-comment-prefix' are ignored for indentation
purposes.
-When not nil or t, comment lines that begin with a `#' are used as
-indentation hints, unless the comment character is in column zero."
+When not nil or t, comment lines that begin with a single `#' are used
+as indentation hints, unless the comment character is in column zero."
:type '(choice
(const :tag "Skip all comment lines (fast)" nil)
(const :tag "Single # `sets' indentation for next line" t)
@@ -1902,7 +1902,11 @@ dedenting."
(and (not (eq py-honor-comment-indentation t))
(save-excursion
(back-to-indentation)
- (not (zerop (current-column)))))
+ (and (not (looking-at prefix-re))
+ (or (looking-at "[^#]")
+ (not (zerop (current-column)))
+ ))
+ ))
))
)))
;; if we landed inside a string, go to the beginning of that