summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1996-03-05 16:28:07 (GMT)
committerBarry Warsaw <barry@python.org>1996-03-05 16:28:07 (GMT)
commit33d6ec062e30c742f822278417e713dced28c64e (patch)
tree3c487227777a8663379b6df23fb0de6509f40551 /Misc
parent6245a3ca3fee8d588a3ac2c821b5365aa2cd2510 (diff)
downloadcpython-33d6ec062e30c742f822278417e713dced28c64e.zip
cpython-33d6ec062e30c742f822278417e713dced28c64e.tar.gz
cpython-33d6ec062e30c742f822278417e713dced28c64e.tar.bz2
(py-honor-comment-indentation): new variable.
(py-compute-indentation): use new variable.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/python-mode.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el
index bd75458..19e675f 100644
--- a/Misc/python-mode.el
+++ b/Misc/python-mode.el
@@ -99,6 +99,17 @@ that the indentation commands won't get confused (i.e., the string
should be of the form `#x...' where `x' is not a blank or a tab, and
`...' is arbitrary).")
+(defvar py-honor-comment-indentation t
+ "*If non-nil, single-# comments are a hint to subsequent line indentation.
+If the previous line is a comment which begins with a single `#'
+character (as opposed to `py-block-comment-prefix' -- normally `##'),
+then it's indentation is used as a hint for this line's indentation.
+When this variable is nil, all comments are skipped for indentation
+purposes, and a faster algorithm is used.
+
+Under Emacs 18, or old Emacs 19's, this variable has no effect, and
+the behavior is as if it were always non-nil.")
+
(defvar py-scroll-process-buffer t
"*Scroll Python process buffer as output arrives.
If nil, the Python process buffer acts, with respect to scrolling, like
@@ -853,7 +864,8 @@ the new line indented."
;; will skip a blank or non-indenting comment line that
;; happens to be a continuation line too. use fast Emacs 19
;; function if it's there.
- (if (fboundp 'forward-comment)
+ (if (and (not py-honor-comment-indentation)
+ (fboundp 'forward-comment))
(forward-comment (- (point-max)))
(re-search-backward "^[ \t]*\\([^ \t\n#]\\|#[ \t\n]\\)" nil 'move))
;; if we landed inside a string, go to the beginning of that