helm-imenu-semantic 遇到斜杠

我在写python代码的时候发现如果代码中有\符号,则会导致后面的代码semantic都失效

def hhh():

    pass

def fun(tt):

    _key = _key.replace("\\", "_")

def tt():

    pass

例如,只会出现出现如下图内容:

image

这个是什么问题呢

imenu-create-index-function的值的那个函数没有正常工作。

python除了函数没有什么地方用def吧?那可以自己改回默认的正则的方式:

  • python-mode-hook加上(setq imenu-create-index-function 'imenu-default-create-index-function)

  • 同样在hook里,改一下imenu-generic-expression,用def之类的去匹配你要的imenu