Emacs helm completion: how to turn off persistent-help_line?
Asked Answered
F

1

5

I'd like to use helm as a drop-in replacement for display-completion-list. The only issue is that it displays this line on top, which I don't want:

C-z: I don't want this line here (keeping session).

Here's the code to illustrate:

(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*")

I've tried setting persistent-help to nil, or not setting it at all, but it still appears. How can I turn it off?

Folio answered 13/11, 2013 at 8:47 Comment(0)
O
7

The attribute helm-persistent-help-string comes with the library helm-plugin. If you do not load it you get no help string. If you need to load helm-plugin for some reason you can disable the function helm-persistent-help-string afterwards by:

(defadvice helm-persistent-help-string (around avoid-help-message activate)
  "Avoid help message"
  )

If you want to remove the gray header line completely you can do:

(defadvice helm-display-mode-line (after undisplay-header activate)
  (setq header-line-format nil))

With defadvice you change the behavior of helm globally. If you want to change helm-display-mode-line just temporarily for the execution of your helm command you could use:

(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*"))

(Note, that stuff like cl-flet does not work this way.)

Oracle answered 13/11, 2013 at 13:19 Comment(1)
There should be an option for hiding the header. Let the helm list know about it: groups.google.com/forum/#!forum/emacs-helmTrin

© 2022 - 2024 — McMap. All rights reserved.