我尝试编写一个函数来抽象要使用的helm-imenu变量:
(defun my/helm-menu ()
"For Org mode buffers, show Org headlines.
For programming mode buffers, show functions, variables, etc."
(interactive)
(cond ((derived-mode-p 'org-mode)
(helm-org-in-buffer-headings))
(t
(helm-semantic-or-imenu))))但是,当在非Org模式的缓冲区中使用它时,它会失败,因为它需要一个参数。
实际上,helm-semantic-or-imenu需要arg。
我该怎么通过呢?
为什么要使用M-x helm-semantic-or-imenu:参数在哪里?
发布于 2016-06-25 17:06:39
遵循Drew的建议,这应该可以做到:
(defun my/helm-menu (arg)
"For Org mode buffers, show Org headlines.
For programming mode buffers, show functions, variables, etc."
(interactive "P")
(cond ((derived-mode-p 'org-mode)
(helm-org-in-buffer-headings))
(t
(helm-semantic-or-imenu arg))))至少,它是有效的!
https://stackoverflow.com/questions/38022404
复制相似问题