我想使用helm
作为display-completion-list
的替代品。
唯一的问题是它在顶部显示这一行,我不想要:
C-z: I don't want this line here (keeping session)
。
以下是用于说明的代码:
(helm :sources `((name . "Do you have?")
(candidates . ("Red Leicester"
"Tilsit"
"Caerphilly"
"Bel Paese"
"Red Windsor"
"Stilton"))
(action . identity)
(persistent-help . "I don't want this line here"))
:buffer "*cheese shop*")
我已经尝试将persistent-help
设置为nil,或者根本不设置它,但是它
仍然出现。我怎么能把它关掉?
答案 0 :(得分:7)
属性helm-persistent-help-string
附带库helm-plugin
。如果你没有加载它,你得到没有帮助字符串。如果由于某种原因需要加载helm-plugin
,则可以通过以下方式禁用helm-persistent-help-string
函数:
(defadvice helm-persistent-help-string (around avoid-help-message activate)
"Avoid help message"
)
如果要完全删除灰色标题行,可以执行以下操作:
(defadvice helm-display-mode-line (after undisplay-header activate)
(setq header-line-format nil))
使用defadvice
,您可以全局更改helm
的行为。
如果您想暂时更改helm-display-mode-line
以执行helm
命令,可以使用:
(defmacro save-function (func &rest body)
"Save the definition of func in symbol ad-func and execute body like `progn'
Afterwards the old definition of func is restored."
`(let ((ad-func (if (autoloadp (symbol-function ',func)) (autoload-do-load (symbol-function ',func)) (symbol-function ',func))))
(unwind-protect
(progn
,@body
)
(fset ',func ad-func)
)))
(save-function helm-display-mode-line
(fset 'helm-display-mode-line '(lambda (source)
(apply ad-func (list source))
(setq header-line-format nil)))
(helm :sources `((name . "Do you have?")
(candidates . ("Red Leicester"
"Tilsit"
"Caerphilly"
"Bel Paese"
"Red Windsor"
"Stilton"))
(action . identity)
(persistent-help . "I don't want this line here"))
:buffer "*cheese shop*"))
(注意,像cl-flet
这样的东西不能这样工作。)