comparison lisp/tooltip.el @ 90068:eac554634bfa

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-79 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-735 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-747 Update from CVS
author Miles Bader <miles@gnu.org>
date Sat, 25 Dec 2004 02:00:25 +0000
parents f2ebccfa87d4 3d934eda2724
children bf0d492ea2d5
comparison
equal deleted inserted replaced
90067:b481c5870e10 90068:eac554634bfa
1 ;;; tooltip.el --- show tooltip windows 1 ;;; tooltip.el --- show tooltip windows
2 2
3 ;; Copyright (C) 1997, 1999, 2000, 2001, 2004 Free Software Foundation, Inc. 3 ;; Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004
4 ;; Free Software Foundation, Inc.
4 5
5 ;; Author: Gerd Moellmann <gerd@acm.org> 6 ;; Author: Gerd Moellmann <gerd@acm.org>
6 ;; Keywords: help c mouse tools 7 ;; Keywords: help c mouse tools
7 8
8 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
474 "The last help message received via `tooltip-show-help-function'.") 475 "The last help message received via `tooltip-show-help-function'.")
475 476
476 (defun tooltip-show-help-function (msg) 477 (defun tooltip-show-help-function (msg)
477 "Function installed as `show-help-function'. 478 "Function installed as `show-help-function'.
478 MSG is either a help string to display, or nil to cancel the display." 479 MSG is either a help string to display, or nil to cancel the display."
479 (let ((previous-help tooltip-help-message)) 480 (let ((previous-help tooltip-help-message)
481 mp pos)
482 (if (and mouse-1-click-follows-link
483 (stringp msg)
484 (save-match-data
485 (string-match "^mouse-2" msg))
486 (setq mp (mouse-pixel-position))
487 (consp (setq pos (cdr mp)))
488 (setq pos (posn-at-x-y (car pos) (cdr pos) (car mp)))
489 (windowp (posn-window pos)))
490 (with-current-buffer (window-buffer (posn-window pos))
491 (if (mouse-on-link-p (posn-point pos))
492 (setq msg (concat
493 (cond
494 ((eq mouse-1-click-follows-link 'double) "double-")
495 ((and (integerp mouse-1-click-follows-link)
496 (< mouse-1-click-follows-link 0)) "Long ")
497 (t ""))
498 "mouse-1" (substring msg 7))))))
480 (setq tooltip-help-message msg) 499 (setq tooltip-help-message msg)
481 (cond ((null msg) 500 (cond ((null msg)
482 ;; Cancel display. This also cancels a delayed tip, if 501 ;; Cancel display. This also cancels a delayed tip, if
483 ;; there is one. 502 ;; there is one.
484 (tooltip-hide)) 503 (tooltip-hide))