Emacs掌舵完成:如何关闭persistent-help_line?

abo*_*abo 5 emacs elisp emacs-helm

我想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*")
Run Code Online (Sandbox Code Playgroud)

我已经尝试设置persistent-help为nil,或者根本没有设置它,但它仍然出现.我怎么能把它关掉?

Tob*_*ias 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"
  )
Run Code Online (Sandbox Code Playgroud)

如果要完全删除灰色标题行,可以执行以下操作:

(defadvice helm-display-mode-line (after undisplay-header activate)
  (setq header-line-format nil))
Run Code Online (Sandbox Code Playgroud)

随着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*"))
Run Code Online (Sandbox Code Playgroud)

(注意,像这样的东西cl-flet不起作用.)