unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: emacs-devel@gnu.org
Subject: Re: finger-pointer curser as default for mouse-face text
Date: Tue, 26 Oct 2004 11:00:26 +0200	[thread overview]
Message-ID: <m3oeipq2fp.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <jwvwtxe6cnf.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 25 Oct 2004 11:35:34 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> If the time stamps for the clicks indeed come from the X server, then
>> Kim's timed scheme would probably not be very susceptible to system
>> load/traffic congestion effects.
>
> The problm with it is that it goes against what we're trying to do, which is
> to get Emacs's UI in line with "what non-Emacs users expect".
> I.e. such users will just do a simple click and expect it to follow
> the link.

Yes, that's what we are trying to achieve -- the fundamental problem
we discuss here is actually how to recognize when the stuff is a link
and when it is something else which has a mouse-face property.

In the examples given until now, the non-links have the mouse-face
on an overlay -- so maybe to fix would be to only follow link which
have the mouse-face as a text property in the buffer.

If we can safely differentiate between links and non-links I think
a short click should follow the link (double-clicks typically don't
make sense there anyway) and a long click should set point

Appended is a patch which uses get-text-property rather than
get-char-property to ignore overlay mouse-face properties.

The patch also allows you to double click on a link to get the normal
double-click action in the buffer rather than following the link.
To do that, I wait "double-click-time" milliseconds before following
the link -- if any input arrives in that period, I don't follow the
link.  May feel a little "slow", but it's worth a try.


>
> Adding a message saying "please keep the button pressed longer if you want
> to follow the link" is really not much better than adding a message that
> says "use mouse-2 if you want to follow the link".
>
> And if you add to the equation the extra code and conceptual complexity of
> using timing-dependent information, I find it ends up a loser.

I don't really want to add any message there -- if we leave the feature
disabled by default, the users who turn it on doesn't need to be told
how to get the alternative behaviour.

If we turn on the feature by default, there should at least be some
way to disable that message.

>
>> After all, we have the same problem with recognizing double-clicks.
>
> Sure.  But users have wanted double-clicks, so we gave it to them.
> Users's aren't asking for variable-duration clicks.  OTOH users are quite
> used to not being able to move cursor into a link by just left-clicking on
> it.  It may annoy them at times, but it seems to annoy them less than having
> to use mouse-2.

Variable length clicks are a new user interface invention in emacs :-)


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	26 Oct 2004 08:56:24 -0000
***************
*** 48,53 ****
--- 48,81 ----
    :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 command (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 command
+ is performed.
+ 
+ Otherwise, mouse-1 unconditionally follows the link, unless you
+ drag the mouse in the link to run the normal mouse-1 command."
+   :version "21.4"
+   :type '(choice (const :tag "Disabled" nil)
+                  (number :tag "Click time limit" :value 300)
+                  (other :tag "Enabled" t))
+   :group 'mouse)
+ 
  \f
  ;; Provide a mode-specific menu on a mouse button.
  
***************
*** 877,882 ****
--- 905,929 ----
  			 (or end-point
  			     (= (window-start start-window)
  				start-window-start)))
+ 		(if (and mouse-1-click-follows-link
+ 			 (not end-point)
+ 			 (consp event)
+ 			 (= click-count 0)
+ 			 (= (event-click-count event) 1)
+ 			 (not (input-pending-p))
+ 			 ;; Don't want to look at overlays here
+ 			 (get-text-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)))))
+ 			 (or (not double-click-time)
+ 			     (sit-for 0 (if (integerp double-click-time)
+ 					    double-click-time 500) t)))
+ 		    (setcar event 'mouse-2))
  		(setq unread-command-events
  		      (cons event unread-command-events)))))
  	(delete-overlay mouse-drag-overlay)))))

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

  reply	other threads:[~2004-10-26  9:00 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DNEMKBNJBGPAOPIJOOICAEKKCAAA.drew.adams@oracle.com>
2004-10-19  9:04 ` finger-pointer curser as default for mouse-face text Kim F. Storm
2004-10-19 15:31   ` Lennart Borgman
2004-10-19 16:12   ` Drew Adams
2004-10-21 13:56   ` Richard Stallman
2004-10-21 14:47     ` Kim F. Storm
2004-10-21 16:03       ` Lennart Borgman
2004-10-23  4:48       ` Richard Stallman
2004-10-24 12:42         ` Kim F. Storm
2004-10-24 12:59           ` Lennart Borgman
2004-10-24 19:40             ` Kim F. Storm
2004-10-24 20:06               ` Lennart Borgman
2004-10-25 13:13             ` Richard Stallman
2004-10-24 13:10           ` David Kastrup
2004-10-24 19:59             ` Kim F. Storm
2004-10-26  9:04               ` Richard Stallman
2004-10-26 17:05                 ` Lennart Borgman
2004-10-24 22:31           ` Stefan
2004-10-25  7:22             ` David Kastrup
2004-10-25 11:47               ` Stefan
2004-10-25 12:51                 ` David Kastrup
2004-10-25 13:50                   ` Stefan Monnier
2004-10-25 14:52                     ` Ralf Angeli
2004-10-25 15:08                       ` Stefan Monnier
2004-10-25 15:18                         ` David Kastrup
2004-10-25 15:35                           ` Stefan Monnier
2004-10-26  9:00                             ` Kim F. Storm [this message]
2004-10-26  9:25                               ` David Kastrup
2004-10-26 12:23                                 ` Kim F. Storm
2004-10-26 18:55                                   ` Drew Adams
2004-10-26 21:06                                     ` David Kastrup
2004-10-26 21:54                                     ` Kim F. Storm
2004-10-27  2:15                                       ` Luc Teirlinck
2004-10-27 12:52                                         ` Kim F. Storm
2004-10-27 13:02                                           ` Luc Teirlinck
2004-10-27 13:16                                           ` David Kastrup
2004-10-27 14:51                                             ` feature freeze (was: finger-pointer curser as default for mouse-face text) Reiner Steib
2004-10-27 15:15                                               ` Kim F. Storm
2004-10-27 15:15                                               ` feature freeze David Kastrup
2004-10-27 17:29                                           ` finger-pointer curser as default for mouse-face text Drew Adams
2004-10-28 14:05                                             ` Kim F. Storm
2004-10-27 17:35                                       ` Richard Stallman
2004-11-01 14:40                                         ` Karl Eichwalder
2004-11-01 15:44                                           ` Stefan
2004-11-02 14:08                                           ` Richard Stallman
2004-11-02 18:08                                             ` Karl Eichwalder
2004-11-02 21:51                                               ` Miles Bader
2004-11-02 23:41                                                 ` Drew Adams
2004-11-02 23:53                                                   ` Stefan
2004-11-03  1:27                                                     ` incrementor-decrementor commands and bindings (was: finger-pointer curser as default for mouse-face text) Drew Adams
2004-11-03  7:51                                                       ` incrementor-decrementor commands and bindings (was: finger-pointercurser " Stephan Stahl
2004-11-03 15:26                                                         ` Drew Adams
2004-11-04  9:51                                                           ` Richard Stallman
2004-11-03  1:34                                                     ` finger-pointer curser as default for mouse-face text Miles Bader
2004-11-03  9:31                                                       ` Kim F. Storm
2004-11-03  9:26                                                     ` Kim F. Storm
2004-11-03 10:20                                                       ` David Kastrup
2004-11-03 17:04                                                 ` Richard Stallman
2004-11-03  9:11                                               ` Kim F. Storm
2004-11-03 17:03                                               ` Richard Stallman
2004-10-27 17:34                                   ` Richard Stallman
2004-10-27 10:49                               ` Richard Stallman
2004-10-27 12:24                                 ` Kim F. Storm
2004-10-27 13:03                                   ` Stefan Monnier
2004-10-27 13:18                                   ` David Kastrup
2004-10-28  2:27                                 ` Miles Bader
2004-10-27  7:22                             ` Kai Grossjohann
2004-10-27  7:35                               ` David Kastrup
2004-10-27 12:32                                 ` Kim F. Storm
2004-10-28  6:24                                 ` Richard Stallman
2004-10-27 10:47                             ` Richard Stallman
2004-10-26  9:05               ` Richard Stallman
2004-10-25  8:31             ` Kim F. Storm
2004-10-25 10:01               ` David Kastrup
2004-10-25 12:32                 ` Kim F. Storm
2004-10-26  9:05               ` Richard Stallman
2004-10-25 13:13           ` Richard Stallman
2004-10-21 14:09   ` David Kastrup
2004-10-21 14:42     ` Kim F. Storm
2004-10-21 15:21       ` David Kastrup
2004-10-21 19:55         ` Kim F. Storm
2004-10-21 20:09           ` Drew Adams
2004-10-21 21:45             ` Stefan Monnier
2004-10-21 22:09               ` David Kastrup
2004-10-22  9:10                 ` Kim F. Storm
2004-10-22 12:45                   ` David Kastrup
2004-10-22 15:03                     ` Kim F. Storm
2004-10-22 15:56                       ` David Kastrup
2004-10-17 19:27 Drew Adams
2004-10-18 11:19 ` Kim F. Storm
2004-10-18 13:59 ` Richard Stallman
2004-12-07 13:16 ` Per Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3oeipq2fp.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).