Emacs:默认情况下如何切换仅缓冲区菜单文件
在 buff-menu+.el
中(以及buff-menu.el
)有一个名为 Buffer-menu-toggle-files-only
的函数,它设置变量 Buffer-menu-files-only
code> 到 t
/nil
。
显示缓冲区列表时,我可以使用键 T 进行切换,这样我就可以防止非文件缓冲区显示在列表中。我希望默认设置此过滤器(仅文件)。我如何在我的 init.el
文件中实现这一点?
我尝试过:
(add-hook 'buffer-menu-mode-hook 'Buffer-menu-toggle-files-only 1)
但是当我显示缓冲区列表时,它说:
run-hooks:参数数量错误:#[(arg) "..." [arg Buffer-menu-files-only prefix-numeric-value 0 t revert-buffer] 2 578818 "P"], 0
任何人都可以给出我给个提示?
In buff-menu+.el
(and also in buff-menu.el
) there is a function called Buffer-menu-toggle-files-only
which sets the variable Buffer-menu-files-only
to t
/nil
.
When showing the buffer list, I can toggle this with the key T so I can prevent non-file-buffers from being shown in the list. I would like to have this filter (files-only) set by default. How could I implement this in my init.el
file?
I tried:
(add-hook 'buffer-menu-mode-hook 'Buffer-menu-toggle-files-only 1)
but when I then show the buffer list, it says:
run-hooks: Wrong number of arguments: #[(arg) "..." [arg Buffer-menu-files-only prefix-numeric-value 0 t revert-buffer] 2 578818 "P"], 0
Can anybody give me a hint?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个:
我不使用缓冲区菜单,所以这是未经测试的。但这是我所有模式钩子遵循的形式,并且它们都有效。
Try this:
I don't use buffer-menu, so this is untested. But this is the form all my mode-hooks follow, and they all work.
模式挂钩建议应该可以正常工作。
另一种方法是这样的:
另外,我假设您已经知道 Cu Cx Cb 仅列出文件缓冲区。
The mode hook suggestion should work fine.
Another way to go is this:
Also, I assume you already know that C-u C-x C-b lists only file buffers.
这很有效,并且正是您所需要的。
This works and makes exactly what you need.