Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 32a0396

Browse files
committed
(py-imenu-create-index-function): Skip over stuff that looks like code
but which is in a comment or string. Closes SF bug # 572341 reported by Adrian van den Dries.
1 parent 5086e49 commit 32a0396

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Misc/python-mode.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,8 @@ of the first definition found."
945945
;; what level is the next definition on? must be same, deeper
946946
;; or shallower indentation
947947
(cond
948+
;; Skip code in comments and strings
949+
((py-in-literal))
948950
;; at the same indent level, add it to the list...
949951
((= start-indent cur-indent)
950952
(push (cons def-name def-pos) index-alist))

0 commit comments

Comments
 (0)