diff options
| author | Kim F. Storm | 2004-12-17 15:16:33 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-12-17 15:16:33 +0000 |
| commit | f2a1c81bb16eb803e757cc77c8a1272028483363 (patch) | |
| tree | 7a5eaf5cc0f93d93c16c89a9bd1173d0a233f373 | |
| parent | 65f765817d67622ee7802f5bad8c7b18782f8937 (diff) | |
| download | emacs-f2a1c81bb16eb803e757cc77c8a1272028483363.tar.gz emacs-f2a1c81bb16eb803e757cc77c8a1272028483363.zip | |
(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.
| -rw-r--r-- | lisp/tooltip.el | 23 |
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 @@ | |||
| 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 |
| @@ -476,7 +477,25 @@ This function must return nil if it doesn't handle EVENT." | |||
| 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 |