]> code.delx.au - gnu-emacs/blobdiff - lisp/mouse.el
Version 3.15
[gnu-emacs] / lisp / mouse.el
index fdc9920578006c3782b9d22a172562c6db172c8f..c928e04f8ed3b7585099664aa97e96765dffe034 100644 (file)
@@ -1,7 +1,7 @@
 ;;; mouse.el --- window system-independent mouse support
 
-;; Copyright (C) 1993, 94, 95, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003,
+;;   2004, 2005 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: hardware, mouse
@@ -20,8 +20,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -49,7 +49,7 @@
   :version "22.1"
   :group 'mouse)
 
-(defcustom mouse-1-click-follows-link 350
+(defcustom mouse-1-click-follows-link 450
   "Non-nil means that clicking Mouse-1 on a link follows the link.
 
 With the default setting, an ordinary Mouse-1 click on a link
@@ -64,7 +64,7 @@ or perform the normal Mouse-1 action (typically set point).
 The absolute numeric value specifices the maximum duration of a
 \"short click\" in milliseconds.  A positive value means that a
 short click follows the link, and a longer click performs the
-normal action.  A negative value gives the opposite behaviour.
+normal action.  A negative value gives the opposite behavior.
 
 If value is `double', a double click follows the link.
 
@@ -788,8 +788,7 @@ POS may be a mouse event location in any window.
 A clickable link is identified by one of the following methods:
 
 - If the character at POS has a non-nil `follow-link' text or
-overlay property, use the value of that property determines what
-to do.
+overlay property, the value of that property determines what to do.
 
 - If there is a local key-binding or a keybinding at position POS
 for the `follow-link' event, the binding of that event determines
@@ -837,6 +836,29 @@ at the same position."
            (funcall action pos))
           (t action)))))))
 
+(defun mouse-fixup-help-message (msg)
+  "Fix help message MSG for `mouse-1-click-follows-link'."
+  (let (mp pos)
+    (if (and mouse-1-click-follows-link
+            (stringp msg)
+            (save-match-data
+              (string-match "^mouse-2" msg))
+            (setq mp (mouse-pixel-position))
+            (consp (setq pos (cdr mp)))
+            (car pos) (>= (car pos) 0)
+            (cdr pos) (>= (cdr pos) 0)
+            (setq pos (posn-at-x-y (car pos) (cdr pos) (car mp)))
+            (windowp (posn-window pos)))
+       (with-current-buffer (window-buffer (posn-window pos))
+         (if (mouse-on-link-p pos)
+             (setq msg (concat
+                   (cond
+                    ((eq mouse-1-click-follows-link 'double) "double-")
+                    ((and (integerp mouse-1-click-follows-link)
+                          (< mouse-1-click-follows-link 0)) "Long ")
+                    (t ""))
+                   "mouse-1" (substring msg 7)))))))
+  msg)
 
 (defun mouse-drag-region-1 (start-event)
   (mouse-minibuffer-check start-event)
@@ -997,7 +1019,7 @@ at the same position."
                             (= (window-start start-window)
                                start-window-start)))
                (if (and on-link
-                        (not end-point)
+                        (or (not end-point) (= end-point start-point))
                         (consp event)
                         (or remap-double-click
                             (and
@@ -1835,7 +1857,7 @@ and selects that window."
                            (string< (buffer-name elt1) (buffer-name elt2))))))
     (setq tail buffers)
     (while tail
-      (or (eq ?\ (aref (buffer-name (car tail)) 0))
+      (or (eq ?\s (aref (buffer-name (car tail)) 0))
          (setq maxlen
                (max maxlen
                     (length (buffer-name (car tail))))))