unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "rgb" <rbielaws@i1.net>
Subject: Re: translating mouse clicks
Date: 13 Jul 2005 17:46:53 -0700	[thread overview]
Message-ID: <1121302013.374747.217560@z14g2000cwz.googlegroups.com> (raw)
In-Reply-To: <1121277087.874449.299500@o13g2000cwo.googlegroups.com>

> 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.

  parent reply	other threads:[~2005-07-14  0:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-13 17:51 translating mouse clicks r3jsel
2005-07-13 19:42 ` Peter Dyballa
2005-07-14  0:46 ` rgb [this message]
2005-07-14  2:52 ` Stefan Monnier
2005-07-15 16:39 ` r3jsel

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=1121302013.374747.217560@z14g2000cwz.googlegroups.com \
    --to=rbielaws@i1.net \
    /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.
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).