mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
(py-compute-indentation): fix skipping backwards over comments by
using forward-comment (and Emacs 19 function) if available.
This commit is contained in:
parent
76a0589986
commit
fd0fb38055
1 changed files with 5 additions and 2 deletions
|
|
@ -895,8 +895,11 @@ the new line indented."
|
||||||
(t
|
(t
|
||||||
;; skip back over blank & non-indenting comment lines note:
|
;; skip back over blank & non-indenting comment lines note:
|
||||||
;; will skip a blank or non-indenting comment line that
|
;; will skip a blank or non-indenting comment line that
|
||||||
;; happens to be a continuation line too
|
;; happens to be a continuation line too. use fast Emacs 19
|
||||||
(re-search-backward "^[ \t]*\\([^ \t\n#]\\|#[ \t\n]\\)" nil 'move)
|
;; 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
|
;; if we landed inside a string, go to the beginning of that
|
||||||
;; string. this handles triple quoted, multi-line spanning
|
;; string. this handles triple quoted, multi-line spanning
|
||||||
;; strings.
|
;; strings.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue