首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Emacs抽象函数中传递arg

如何在Emacs抽象函数中传递arg
EN

Stack Overflow用户
提问于 2016-06-25 05:31:48
回答 1查看 83关注 0票数 1

我尝试编写一个函数来抽象要使用的helm-imenu变量:

代码语言:javascript
复制
(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:参数在哪里?

EN

回答 1

Stack Overflow用户

发布于 2016-06-25 17:06:39

遵循Drew的建议,这应该可以做到:

代码语言:javascript
复制
(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))))

至少,它是有效的!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38022404

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档