Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 736
abo-abo Avatar asked Nov 13 '13 08:11

abo-abo


1 Answers

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.)

like image 105
Tobias Avatar answered Nov 15 '22 08:11

Tobias