summaryrefslogtreecommitdiff
path: root/lisp/tooltip.el
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2004-12-17 15:16:33 +0000
committerKim F. Storm <storm@cua.dk>2004-12-17 15:16:33 +0000
commitf2a1c81bb16eb803e757cc77c8a1272028483363 (patch)
tree7a5eaf5cc0f93d93c16c89a9bd1173d0a233f373 /lisp/tooltip.el
parent65f765817d67622ee7802f5bad8c7b18782f8937 (diff)
downloademacs-f2a1c81bb16eb803e757cc77c8a1272028483363.tar.gz
(tooltip-show-help-function): Replace "mouse-2"
prefix in tooltip text with "mouse-1" when this is a link recognized by mouse-1-click-follows-link functionality.
Diffstat (limited to 'lisp/tooltip.el')
-rw-r--r--lisp/tooltip.el23
1 files changed, 21 insertions, 2 deletions
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 5bcb28dde52..2e60df02459 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -1,6 +1,7 @@
;;; tooltip.el --- show tooltip windows
-;; Copyright (C) 1997, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004
+;; Free Software Foundation, Inc.
;; Author: Gerd Moellmann <gerd@acm.org>
;; Keywords: help c mouse tools
@@ -476,7 +477,25 @@ This function must return nil if it doesn't handle EVENT."
(defun tooltip-show-help-function (msg)
"Function installed as `show-help-function'.
MSG is either a help string to display, or nil to cancel the display."
- (let ((previous-help tooltip-help-message))
+ (let ((previous-help tooltip-help-message)
+ mp pos)
+ (if (and mouse-1-click-follows-link
+ (stringp msg)
+ (save-match-data
+ (string-match "^mouse-2" msg))
+ (setq mp (mouse-pixel-position))
+ (consp (setq pos (cdr mp)))
+ (setq pos (posn-at-x-y (car pos) (cdr pos) (car mp)))
+ (windowp (posn-window pos)))
+ (with-current-buffer (window-buffer (posn-window pos))
+ (if (mouse-on-link-p (posn-point pos))
+ (setq msg (concat
+ (cond
+ ((eq mouse-1-click-follows-link 'double) "double-")
+ ((and (integerp mouse-1-click-follows-link)
+ (< mouse-1-click-follows-link 0)) "Long ")
+ (t ""))
+ "mouse-1" (substring msg 7))))))
(setq tooltip-help-message msg)
(cond ((null msg)
;; Cancel display. This also cancels a delayed tip, if