]> code.delx.au - gnu-emacs/blobdiff - lisp/mouse.el
* lisp/progmodes/ruby-mode.el (ruby-mode): Add `ruby-mode-set-encoding'
[gnu-emacs] / lisp / mouse.el
index 51601bca8df679b3042134f3a8d52e5d10853cb9..219287c4767e39cf0aafe9ceba99ace4740eec3b 100644 (file)
@@ -128,7 +128,11 @@ Expects to be bound to `down-mouse-1' in `key-translation-map'."
                 (put newup 'event-kind (get (car event) 'event-kind))
                 (put newdown 'event-kind (get (car this-event) 'event-kind))
                 (push (cons newup (cdr event)) unread-command-events)
-                (vector (cons newdown (cdr this-event))))
+                ;; Modify the event in place, so read-key-sequence doesn't
+                ;; generate a second fake prefix key (see fake_prefixed_keys in
+                ;; src/keyboard.c).
+                (setcar this-event newdown)
+                (vector this-event))
             (push event unread-command-events)
             nil))))))
 
@@ -759,6 +763,9 @@ at the same position."
                  mouse-1-click-in-non-selected-windows
                  (eq (selected-window) (posn-window pos)))
              (or (mouse-posn-property pos 'follow-link)
+                  (let ((area (posn-area pos)))
+                    (when area
+                      (key-binding (vector area 'follow-link) nil t pos)))
                  (key-binding [follow-link] nil t pos)))))
     (cond
      ((eq action 'mouse-face)
@@ -1140,22 +1147,21 @@ regardless of where you click."
       (deactivate-mark)))
   (or mouse-yank-at-point (mouse-set-point click))
   (let ((primary
-        (cond
-         ((eq (framep (selected-frame)) 'w32)
-          ;; MS-Windows emulates PRIMARY in x-get-selection, but not
-          ;; in x-get-selection-value (the latter only accesses the
-          ;; clipboard).  So try PRIMARY first, in case they selected
-          ;; something with the mouse in the current Emacs session.
-          (or (x-get-selection 'PRIMARY)
-              (x-get-selection-value)))
-         ((fboundp 'x-get-selection-value) ; MS-DOS and X.
-          ;; On X, x-get-selection-value supports more formats and
-          ;; encodings, so use it in preference to x-get-selection.
-          (or (x-get-selection-value)
-              (x-get-selection 'PRIMARY)))
-         ;; FIXME: What about xterm-mouse-mode etc.?
-         (t
-          (x-get-selection 'PRIMARY)))))
+         (if (fboundp 'x-get-selection-value)
+             (if (eq (framep (selected-frame)) 'w32)
+                 ;; MS-Windows emulates PRIMARY in x-get-selection, but not
+                 ;; in x-get-selection-value (the latter only accesses the
+                 ;; clipboard).  So try PRIMARY first, in case they selected
+                 ;; something with the mouse in the current Emacs session.
+                 (or (x-get-selection 'PRIMARY)
+                     (x-get-selection-value))
+               ;; Else MS-DOS or X.
+               ;; On X, x-get-selection-value supports more formats and
+               ;; encodings, so use it in preference to x-get-selection.
+               (or (x-get-selection-value)
+                   (x-get-selection 'PRIMARY)))
+           ;; FIXME: What about xterm-mouse-mode etc.?
+           (x-get-selection 'PRIMARY))))
     (unless primary
       (error "No selection is available"))
     (push-mark (point))