【问题标题】:Emacs helm completion: how to turn off persistent-help_line?Emacs helm 完成:如何关闭 persistent-help_line?
【发布时间】:2013-11-13 08:47:41
【问题描述】:

我想使用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 设置为零,或者根本不设置它,但它 仍然出现。如何关闭它?

【问题讨论】:

    标签: emacs elisp emacs-helm


    【解决方案1】:

    属性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 这样的东西不能这样工作。)

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-22
    • 2012-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多