Share a solution to stop the echo area overwriting the minibuffer

Share a solution to stop the echo area overwriting the minibuffer

(defun clear-message (&rest args)
    (cancel-function-timers 'message)
    (advice-remove 'message  #'clear-message)
    (run-with-timer 4 nil
                    (lambda () (message nil)
                            (advice-add 'message :after #'clear-message))))
(advice-add 'message :after #'clear-message)

The original question:

https://www.reddit.com/r/emacs/comments/6mkv4h/how_to_stop_the_echo_area_overwriting_the/

Often, when I’m finding a file, or entering some command via M-x what I’m typing gets overwritten by a message being sent to the echo area. The messages don’t seem to vanish after a delay, and the only way I can get rid of them is to either C-f or some other movement or C-g.