summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1996-03-04 17:15:40 (GMT)
committerBarry Warsaw <barry@python.org>1996-03-04 17:15:40 (GMT)
commitfd0fb38055f030b3947179d0f362b97c7bf06c72 (patch)
tree26edfa8fc490356f425ba1a8502e353c864e5f92 /Misc
parent76a0589986caef9c88cef75174d6c44358293c2e (diff)
downloadcpython-fd0fb38055f030b3947179d0f362b97c7bf06c72.zip
cpython-fd0fb38055f030b3947179d0f362b97c7bf06c72.tar.gz
cpython-fd0fb38055f030b3947179d0f362b97c7bf06c72.tar.bz2
(py-compute-indentation): fix skipping backwards over comments by
using forward-comment (and Emacs 19 function) if available.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/python-mode.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el
index 9d5f514..3dd533b 100644
--- a/Misc/python-mode.el
+++ b/Misc/python-mode.el
@@ -895,8 +895,11 @@ the new line indented."
(t
;; skip back over blank & non-indenting comment lines note:
;; will skip a blank or non-indenting comment line that
- ;; happens to be a continuation line too
- (re-search-backward "^[ \t]*\\([^ \t\n#]\\|#[ \t\n]\\)" nil 'move)
+ ;; happens to be a continuation line too. use fast Emacs 19
+ ;; function if it's there.
+ (if (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
;; string. this handles triple quoted, multi-line spanning
;; strings.