1

I use Emacs with Evil mode, and while I entering the search pattern, the ElDoc message is displayed replace the current search pattern. It is quite annoying. I looked into ElDoc and see a function eldoc-display-message-p that check for conditions that ElDoc should not display the message.

I need some hint to advice this function to prevent ElDoc interference with Evil search.

tungd
  • 14,467
  • 5
  • 41
  • 45
  • I cannot reproduce your issue, can you provide additional information? When I position my cursor in a place that should trigger eldoc then start a :/s/foo/bar the eldoc message is not displayed. what command are you using? And what kind of source / eldoc are you using? A possible solution may be to include (active-minibuffer-window) inside the `eldoc-display-message-no-interference-p` condition. So eldoc won't display if there is an active minibuffer – Jordon Biondo Jun 17 '14 at 16:28
  • @JordonBiondo The problem occurred when searching with `/something`, and not Evil-ex. I tried including `(active-minibuffer-window)`, but it still the same. Thanks. – tungd Jun 19 '14 at 15:16
  • 1
    What eldoc implementation are you using? What code are you editing? This may make a big difference especially if your eldoc function is going out to an external process for information. Another possible solution is to check if `isearch-mode` is non-nil inside `eldoc-display-message-no-interference-p`, Searching in evil uses isearch so that variable will be non-nil in your buffer while you are searching. – Jordon Biondo Jun 19 '14 at 16:33
  • 1
    It happened to all of the mode I'm editing. Checking for `isearch-mode` in `eldoc-display-message-no-interference-p` solved the problem though. Could you please post an answer so I can approve it. Thanks. – tungd Jun 20 '14 at 02:20

1 Answers1

2

The function eldoc-display-message-no-interference-p is a predicate function that will determine whether or not to display an eldoc message at the time.

Searching in Evil uses isearch, so when you are searching, the variable isearch-mode will be non nil.

You can customize the behavior of eldoc-display-message-no-interference-p by editing it directly but that is often not the best choice, we can modify it's behavior instead by using "after advice". If you are unfamiliar with advice, read about it here.

(defadvice eldoc-display-message-no-interference-p (after dont-show-when-isearching activate)
  "Always return nil if isearch-mode is active."
  (setq ad-return-value (and ad-return-value (not isearch-mode))))
Jordon Biondo
  • 3,974
  • 1
  • 27
  • 37