emacs-devel
[Top][All Lists]
Advanced

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

Re: finger-pointer curser as default for mouse-face text


From: Kim F. Storm
Subject: Re: finger-pointer curser as default for mouse-face text
Date: Sun, 24 Oct 2004 21:59:57 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> address@hidden (Kim F. Storm) writes:
>
>> So a "fast" click follows the link, a slightly slower click sets the
>> point (or whatever mouse-1 does).  Dragging the mouse also inhibits
>> following the link.
>
> Actually, for me this is somewhat backward: I use a touchpad, and
> setting the cursor is naturally done by tapping (which is short),
> while following a link currently is done by pressing both mouse keys
> together (which by necessity is longer).  Since setting the cursor is
> usually followed by typing ahead soon, one wants to continue fast
> (because you continue at the point at which you usually look).
> Whereas if you follow the link, you are waiting for something to
> happen.

Normally, I would not expect a user to type anything in the middle of
a link, but YMMV.

> So I'd very much prefer making the long press follow the link, even
> though a long press is more likely to get interpreted as a drag
> instead.
>
> Perhaps the sign of that variable can be used for specifying whether
> the long or the short duration means following the link?  Positive
> means longer than given duration, negative means shorter?

Like this:

Index: mouse.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mouse.el,v
retrieving revision 1.251
diff -c -r1.251 mouse.el
*** mouse.el    18 Oct 2004 09:29:26 -0000      1.251
--- mouse.el    24 Oct 2004 19:06:25 -0000
***************
*** 48,53 ****
--- 48,72 ----
    :type 'boolean
    :group 'mouse)
  
+ (defcustom mouse-1-click-follows-link 300
+   "Non-nil means that clicking mouse-1 on a link follows the link.
+ This is only done for links which have the mouse-face property.
+ 
+ If value is an positive integer, it specifies the maximum duration in
+ milli-seconds of the mouse-1 click to be recognized as a mouse-2 click.
+ If the time between pressing and releasing the mouse button is
+ longer, the normal mouse-1 action (typically set point) is performed.
+ 
+ If value is an negative integer, its absolute value specifies the
+ minimum duration in milli-seconds of the mouse-1 click to be recognized
+ as a mouse-2 click.  If the time between pressing and releasing the
+ mouse button is longer, the normal mouse-1 action is performed."
+   :version "21.4"
+   :type '(choice (const :tag "Disabled" nil)
+                  (number :tag "Click time limit" :value 300)
+                  (other :tag "Enabled" t))
+   :group 'mouse)
+ 
  
  ;; Provide a mode-specific menu on a mouse button.
  
***************
*** 877,882 ****
--- 896,914 ----
                         (or end-point
                             (= (window-start start-window)
                                start-window-start)))
+               (if (and mouse-1-click-follows-link
+                        (not end-point)
+                        (consp event)
+                        (get-char-property start-point 'mouse-face)
+                        (or (not (integerp mouse-1-click-follows-link))
+                            (let ((t0 (posn-timestamp (event-start 
start-event)))
+                                  (t1 (posn-timestamp (event-end event))))
+                              (and (integerp t0) (integerp t1)
+                                   (if (> mouse-1-click-follows-link 0)
+                                       (<= (- t1 t0) 
mouse-1-click-follows-link)
+                                     (< (- t0 t1) 
mouse-1-click-follows-link))))))
+ 
+                   (setcar event 'mouse-2))
                (setq unread-command-events
                      (cons event unread-command-events)))))
        (delete-overlay mouse-drag-overlay)))))

-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

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