emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/mouse.el,v


From: David Kastrup
Subject: [Emacs-diffs] Changes to emacs/lisp/mouse.el,v
Date: Fri, 15 Sep 2006 08:53:19 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     David Kastrup <dak>     06/09/15 08:53:18

Index: mouse.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/mouse.el,v
retrieving revision 1.300
retrieving revision 1.301
diff -u -b -r1.300 -r1.301
--- mouse.el    17 Aug 2006 03:36:17 -0000      1.300
+++ mouse.el    15 Sep 2006 08:53:18 -0000      1.301
@@ -775,6 +775,17 @@
       (mouse-drag-track start-event t))))
 
 
+(defun mouse-posn-property (pos property)
+  "Look for a property at click position."
+  (if (consp pos)
+      (let ((w (posn-window pos)) (pt (posn-point pos))
+           (str (posn-string pos)))
+       (or (and str
+                (get-text-property (cdr str) property (car str)))
+           (and pt
+                (get-char-property pt property w))))
+    (get-char-property pos property)))
+
 (defun mouse-on-link-p (pos)
   "Return non-nil if POS is on a link in the current buffer.
 POS must be a buffer position in the current buffer or a mouse
@@ -814,24 +825,18 @@
 
 - Otherwise, the mouse-1 event is translated into a mouse-2 event
 at the same position."
-  (let ((w (and (consp pos) (posn-window pos))))
-    (if (consp pos)
-       (setq pos (and (or mouse-1-click-in-non-selected-windows
-                          (eq (selected-window) w))
-                      (posn-point pos))))
-    (when pos
-      (with-current-buffer (window-buffer w)
        (let ((action
-              (or (get-char-property pos 'follow-link)
-                  (save-excursion
-                    (goto-char pos)
-                    (key-binding [follow-link] nil t)))))
+        (and (or (not (consp pos))
+                 mouse-1-click-in-non-selected-windows
+                 (eq (selected-window) (posn-window pos)))
+             (or (mouse-posn-property pos 'follow-link)
+                 (key-binding [follow-link] nil t pos)))))
          (cond
           ((eq action 'mouse-face)
-           (and (get-char-property pos 'mouse-face) t))
+      (and (mouse-posn-property pos 'mouse-face) t))
           ((functionp action)
            (funcall action pos))
-          (t action)))))))
+     (t action))))
 
 (defun mouse-fixup-help-message (msg)
   "Fix help message MSG for `mouse-1-click-follows-link'."
@@ -904,7 +909,7 @@
                        ;; Use start-point before the intangibility
                        ;; treatment, in case we click on a link inside an
                        ;; intangible text.
-                       (mouse-on-link-p start-point)))
+                       (mouse-on-link-p start-posn)))
         (click-count (1- (event-click-count start-event)))
         (remap-double-click (and on-link
                                  (eq mouse-1-click-follows-link 'double)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]