comparison lisp/tooltip.el @ 102871:c1df06373080

* tooltip.el (tooltip-show-help-non-mode): Don't save the last message if it was also a help message (Bug#2895).
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 06 Apr 2009 23:52:41 +0000
parents 38cce541a3bd
children c3181c5efa5a
comparison
equal deleted inserted replaced
102870:40bfde9cb004 102871:c1df06373080
317 317
318 318
319 ;;; Tooltip help. 319 ;;; Tooltip help.
320 320
321 (defvar tooltip-help-message nil 321 (defvar tooltip-help-message nil
322 "The last help message received via `tooltip-show-help'.") 322 "The last help message received via `show-help-function'.
323 This is used by `tooltip-show-help' and
324 `tooltip-show-help-non-mode'.")
323 325
324 (defvar tooltip-previous-message nil 326 (defvar tooltip-previous-message nil
325 "The previous content of the echo area.") 327 "The previous content of the echo area.")
326 328
327 (defun tooltip-show-help-non-mode (help) 329 (defun tooltip-show-help-non-mode (help)
328 "Function installed as `show-help-function' when tooltip is off." 330 "Function installed as `show-help-function' when tooltip is off."
329 (when (and (not (window-minibuffer-p)) ;Don't overwrite minibuffer contents. 331 (when (and (not (window-minibuffer-p)) ;Don't overwrite minibuffer contents.
330 ;; Don't know how to reproduce it in Elisp: 332 (not cursor-in-echo-area)) ;Don't overwrite a prompt.
331 ;; Don't overwrite a keystroke echo.
332 ;; (NILP (echo_message_buffer) || ok_to_overwrite_keystroke_echo)
333 (not cursor-in-echo-area)) ;Don't overwrite a prompt.
334 (cond 333 (cond
335 ((stringp help) 334 ((stringp help)
336 (setq help (replace-regexp-in-string "\n" ", " help)) 335 (setq help (replace-regexp-in-string "\n" ", " help))
337 (unless (or tooltip-previous-message 336 (unless (or tooltip-previous-message
338 (string-equal help (current-message))) 337 (string-equal help (current-message))
338 (and (stringp tooltip-help-message)
339 (string-equal tooltip-help-message
340 (current-message))))
339 (setq tooltip-previous-message (current-message))) 341 (setq tooltip-previous-message (current-message)))
342 (setq tooltip-help-message help)
340 (let ((message-truncate-lines t) 343 (let ((message-truncate-lines t)
341 (message-log-max nil)) 344 (message-log-max nil))
342 (message "%s" help))) 345 (message "%s" help)))
343 ((stringp tooltip-previous-message) 346 ((stringp tooltip-previous-message)
344 (let ((message-log-max nil)) 347 (let ((message-log-max nil))