Emacs helm自动补全: 如何关闭persistent-help_line?

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设置为nil,或者不设置,但它仍然出现。如何关闭它?

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这样的内容不适用于此方法。)

应该有一个隐藏标题的选项。让helm列表知道它:https://groups.google.com/forum/#!forum/emacs-helm - Tom
太好了!非常感谢。 - abo-abo

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接