+ "The last help message received via `show-help-function'.
+This is used by `tooltip-show-help' and
+`tooltip-show-help-non-mode'.")
+
+(defvar tooltip-previous-message nil
+ "The previous content of the echo area.")
+
+(defun tooltip-show-help-non-mode (help)
+ "Function installed as `show-help-function' when Tooltip mode is off.
+It is also called if Tooltip mode is on, for text-only displays."
+ (when (and (not (window-minibuffer-p)) ;Don't overwrite minibuffer contents.
+ (not cursor-in-echo-area)) ;Don't overwrite a prompt.
+ (cond
+ ((stringp help)
+ (setq help (replace-regexp-in-string "\n" ", " help))
+ (unless (or tooltip-previous-message
+ (string-equal help (current-message))
+ (and (stringp tooltip-help-message)
+ (string-equal tooltip-help-message
+ (current-message))))
+ (setq tooltip-previous-message (current-message)))
+ (setq tooltip-help-message help)
+ (let ((message-truncate-lines t)
+ (message-log-max nil))
+ (message "%s" help)))
+ ((stringp tooltip-previous-message)
+ (let ((message-log-max nil))
+ (message "%s" tooltip-previous-message)
+ (setq tooltip-previous-message nil)))
+ (t
+ (message nil)))))