5

我想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为零,或者根本不设置,但它仍然出现。我怎样才能关闭它?

4

1 回答 1

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不能以这种方式工作。)

于 2013-11-13T13:19:52.437 回答