Mercurial > emacs
comparison lisp/mouse.el @ 59499:e13b943b7f9a
(mouse-on-link-p): Change functionality and doc
string to comply with latest description in lisp ref.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Wed, 12 Jan 2005 10:17:02 +0000 |
parents | f009f3970cd9 |
children | e7064c8273f5 |
comparison
equal
deleted
inserted
replaced
59498:294644b0fa30 | 59499:e13b943b7f9a |
---|---|
769 (defun mouse-on-link-p (pos) | 769 (defun mouse-on-link-p (pos) |
770 "Return non-nil if POS is on a link in the current buffer. | 770 "Return non-nil if POS is on a link in the current 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 | 776 or if there is a local key-binding or a keybinding at position |
777 2) 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 POS for the `follow-link' event, the binding of that event | 778 action code. |
779 determines whether POS is inside a link: | 779 |
780 | 780 The action code is used to determine whether POS is inside a link: |
781 - If the binding is `mouse-face', POS is inside a link if there | 781 |
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 |
792 - If it is a string, the mouse-1 event is translated into the | 793 - If it is a string, the mouse-1 event is translated into the |
793 first character of the string, i.e. the action of the mouse-1 | 794 first character of the string, i.e. the action of the mouse-1 |
797 first element of that vector, i.e. the action of the mouse-1 | 798 first element of that vector, i.e. the action of the mouse-1 |
798 click is the local or global binding of that event. | 799 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) |
815 (let* ((echo-keystrokes 0) | 817 (let* ((echo-keystrokes 0) |
816 (start-posn (event-start start-event)) | 818 (start-posn (event-start start-event)) |