all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* translating mouse clicks
@ 2005-07-13 17:51 r3jsel
  2005-07-13 19:42 ` Peter Dyballa
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: r3jsel @ 2005-07-13 17:51 UTC (permalink / raw)


I have a trackball with four buttons which emacs sees as buttons
mouse-1, mouse-3, mouse-4, and mouse-5.  I would like emacs to
treat mouse-4 clicks as though they were mouse-2 clicks.

Googling finds suggestions to try

(global-set-key [mouse-4] [mouse-2])
(define-key key-translation-map [mouse-4] [mouse-2])
(keyboard-translate 'mouse-4 'mouse-2)

but none of these work for me.

Doing the first or second and clicking the mouse-4 button causes
emacs to complain that "mouse-yank-at-click must be bound to an
event with parameters"

Doing the third causes emacs to complain that mouse-4 should be an
integer.

(This is with a relatively recent version of CVS emacs on MS Windows
from nqmacs.sourceforge.net, GNU Emacs 22.0.50.2.)

Can anyone suggest a method that works?

Thanks,
David

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: translating mouse clicks
  2005-07-13 17:51 translating mouse clicks r3jsel
@ 2005-07-13 19:42 ` Peter Dyballa
  2005-07-14  0:46 ` rgb
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2005-07-13 19:42 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 13.07.2005 um 19:51 schrieb r3jsel@yahoo.com:

> Can anyone suggest a method that works?
>

Binding mouse-4 to the same binding(s) as mouse2?

Since you have a modern Emacs you could try to determine with grep-find 
in which non-global modes mouse-2 is re-bound ... to bind mouse-4 too!

--
Greetings

              ~  O
   Pete       ~~_\\_/%
              ~  O  o

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: translating mouse clicks
  2005-07-13 17:51 translating mouse clicks r3jsel
  2005-07-13 19:42 ` Peter Dyballa
@ 2005-07-14  0:46 ` rgb
  2005-07-14  2:52 ` Stefan Monnier
  2005-07-15 16:39 ` r3jsel
  3 siblings, 0 replies; 5+ messages in thread
From: rgb @ 2005-07-14  0:46 UTC (permalink / raw)


> I have a trackball with four buttons which emacs sees as buttons
> mouse-1, mouse-3, mouse-4, and mouse-5.  I would like emacs to
> treat mouse-4 clicks as though they were mouse-2 clicks.
>
> Googling finds suggestions to try
>
> (global-set-key [mouse-4] [mouse-2])

This essentially makes mouse-4 a keyboard macro which,
when executed, doesn't carry the proper associated events.
There are 2 things you can do with global-set-key.

(global-set-key [mouse-4] (lookup-key global-map [mouse-2]))

But you would need similar commands for shift, control,
meta, shift-control, shift-meta... versions of mouse-4.
And maybe down-mouse-4 ... as well depending on how many
variations of the key you wanted to remap.

A consequence of doing it this way is that it's static.
Once the global-set-key is done re-assignment of mouse-2
won't change what mouse-4 does.
The other way would be to write a function and map it to
all the mouse-4 events, like above.  The function would
look up and called the mouse-2 event currently in effect.

> (define-key key-translation-map [mouse-4] [mouse-2])
> (keyboard-translate 'mouse-4 'mouse-2)

The doc seems to carefully exclude mentioning mouse events
concerning these methods (and function-key-map too).  I
wouldn't expect them to help based on the doc I looked at.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: translating mouse clicks
  2005-07-13 17:51 translating mouse clicks r3jsel
  2005-07-13 19:42 ` Peter Dyballa
  2005-07-14  0:46 ` rgb
@ 2005-07-14  2:52 ` Stefan Monnier
  2005-07-15 16:39 ` r3jsel
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2005-07-14  2:52 UTC (permalink / raw)


> I have a trackball with four buttons which emacs sees as buttons
> mouse-1, mouse-3, mouse-4, and mouse-5.  I would like emacs to
> treat mouse-4 clicks as though they were mouse-2 clicks.

> (global-set-key [mouse-4] [mouse-2])
> (define-key key-translation-map [mouse-4] [mouse-2])
> (keyboard-translate 'mouse-4 'mouse-2)

> but none of these work for me.

I think it's reasonable to expect the second to work (and it's reasonable for
Emacs to mishandle the first and last).  Please file a bug report with
M-x report-emacs-bug.


        Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: translating mouse clicks
  2005-07-13 17:51 translating mouse clicks r3jsel
                   ` (2 preceding siblings ...)
  2005-07-14  2:52 ` Stefan Monnier
@ 2005-07-15 16:39 ` r3jsel
  3 siblings, 0 replies; 5+ messages in thread
From: r3jsel @ 2005-07-15 16:39 UTC (permalink / raw)


Thanks to everyone for their help.  On Stefan's suggestion I've
submitted a bug report on this.  In the mean time, I'm using
variations on rgb's

  (global-set-key [mouse-4] (lookup-key global-map [mouse-2]))

as workarounds.


r3jsel@yahoo.com wrote:
> I have a trackball with four buttons which emacs sees as buttons
> mouse-1, mouse-3, mouse-4, and mouse-5.  I would like emacs to
> treat mouse-4 clicks as though they were mouse-2 clicks.
>
> Googling finds suggestions to try
>
> (global-set-key [mouse-4] [mouse-2])
> (define-key key-translation-map [mouse-4] [mouse-2])
> (keyboard-translate 'mouse-4 'mouse-2)
> 
> but none of these work for me.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-07-15 16:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-13 17:51 translating mouse clicks r3jsel
2005-07-13 19:42 ` Peter Dyballa
2005-07-14  0:46 ` rgb
2005-07-14  2:52 ` Stefan Monnier
2005-07-15 16:39 ` r3jsel

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.