diff options
| -rw-r--r-- | lisp/mouse.el | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index ea6aa90e3c7..53bfc38d508 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -771,21 +771,22 @@ If the click is in the echo area, display the `*Messages*' buffer." | |||
| 771 | 771 | ||
| 772 | A clickable link is identified by one of the following methods: | 772 | A clickable link is identified by one of the following methods: |
| 773 | 773 | ||
| 774 | 1) If the character at POS has a non-nil `follow-link' text or | 774 | If the character at POS has a non-nil `follow-link' text or |
| 775 | overlay property, the value of that property is returned. | 775 | overlay property, use the value of that property as action code, |
| 776 | or if there is a local key-binding or a keybinding at position | ||
| 777 | POS for the `follow-link' event, use the binding of that event as | ||
| 778 | action code. | ||
| 776 | 779 | ||
| 777 | 2) If there is a local key-binding or a keybinding at position | 780 | The action code is used to determine whether POS is inside a link: |
| 778 | POS for the `follow-link' event, the binding of that event | ||
| 779 | determines whether POS is inside a link: | ||
| 780 | 781 | ||
| 781 | - If the binding is `mouse-face', POS is inside a link if there | 782 | - If the action code is `mouse-face', POS is inside a link if there |
| 782 | is a non-nil `mouse-face' property at POS. Return t in this case. | 783 | is a non-nil `mouse-face' property at POS. Return t in this case. |
| 783 | 784 | ||
| 784 | - If the binding is a function, FUNC, POS is inside a link if | 785 | - If the action code is a function, FUNC, POS is inside a link if |
| 785 | the call \(FUNC POS) returns non-nil. Return the return value | 786 | the call \(FUNC POS) returns non-nil. Return the return value |
| 786 | from that call. | 787 | from that call. |
| 787 | 788 | ||
| 788 | - Otherwise, return the binding of the `follow-link' binding. | 789 | - Otherwise, return the action code itself. |
| 789 | 790 | ||
| 790 | The return value is interpreted as follows: | 791 | The return value is interpreted as follows: |
| 791 | 792 | ||
| @@ -799,16 +800,17 @@ click is the local or global binding of that event. | |||
| 799 | 800 | ||
| 800 | - Otherwise, the mouse-1 event is translated into a mouse-2 event | 801 | - Otherwise, the mouse-1 event is translated into a mouse-2 event |
| 801 | at the same position." | 802 | at the same position." |
| 802 | (or (get-char-property pos 'follow-link) | 803 | (let ((action |
| 803 | (save-excursion | 804 | (or (get-char-property pos 'follow-link) |
| 804 | (goto-char pos) | 805 | (save-excursion |
| 805 | (let ((b (key-binding [follow-link] nil t))) | 806 | (goto-char pos) |
| 806 | (cond | 807 | (key-binding [follow-link] nil t))))) |
| 807 | ((eq b 'mouse-face) | 808 | (cond |
| 808 | (and (get-char-property pos 'mouse-face) t)) | 809 | ((eq action 'mouse-face) |
| 809 | ((functionp b) | 810 | (and (get-char-property pos 'mouse-face) t)) |
| 810 | (funcall b pos)) | 811 | ((functionp action) |
| 811 | (t b)))))) | 812 | (funcall action pos)) |
| 813 | (t action)))) | ||
| 812 | 814 | ||
| 813 | (defun mouse-drag-region-1 (start-event) | 815 | (defun mouse-drag-region-1 (start-event) |
| 814 | (mouse-minibuffer-check start-event) | 816 | (mouse-minibuffer-check start-event) |