all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex Schroeder <alex@emacswiki.org>
Subject: Re: elisp mouse programming problems
Date: Wed, 20 Aug 2003 12:34:38 +0200	[thread overview]
Message-ID: <873cfwvcqp.fsf@emacswiki.org> (raw)
In-Reply-To: TqWcnRRLgfHedd-iRTvUqg@texas.net

"David Vanderschel" <DJV1@Austin.RR.com> writes:

> I am having a problem with overriding the global map
> for some mouse events.  For example, I can bind
> C-mouse-1 in a major mode mode-map for a major mode I
> created.  Yet when that mode is in effect, such a
> mouse click still goes to mouse-select-buffer (as it
> is correctly bound globally) and never reaches the
> function I bound to the key for the mode.  I do not
> have this problem with all mouse events, and I cannot
> figure out what is going wrong.  I am consistently
> successful in overriding the global binding of
> ordinary key sequences (as opposed to mouse events) in
> this manner.  Extra details appended.

One mouse click will generate not only the mouse click event, but also
a button-down event.  And if somebody binds a command to the
button-down event, then the command bound to the click event is never
called.

See (elisp)Button-Down Events.

> Also, in testing such things, I am confused by the
> fact that I cannot seem to redefine the bindings of a
> mode-map by simply setting it to nil and rerunning the
> (modified) code which builds the mode-map.  The old
> bindings seem to remain in effect.  If I kill emacs
> and restart it, the changed bindings do take effect.
> Not even killing the buffer with the new mode,
> reloading the file which defines the program, and
> rerunning the program which creates the special mode
> buffer helps.  What is it that I do not understand
> here?

A keymap is a list that starts with the symbol `keymap'.  Only the cdr
of that list is used by Emacs when looking up keys.  When you just
change the value of a mode-map, the old cdr will still be used.
(Maybe you need to draw box diagrams to see this.)

The correct solution depends on where the bindings are:  Global map?
Local map?  Overlays?  Text properties?

Alex.
-- 
http://www.emacswiki.org/alex/
There is no substitute for experience.

  reply	other threads:[~2003-08-20 10:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-20  3:17 elisp mouse programming problems David Vanderschel
2003-08-20 10:34 ` Alex Schroeder [this message]
2003-08-21  1:46   ` David Vanderschel
2003-08-21  2:37     ` Johan Bockgård
2003-08-21  3:24       ` David Vanderschel
2003-08-21 17:44     ` Kevin Rodgers
2003-08-22  0:50       ` David Vanderschel
2003-08-22 15:24         ` Kevin Rodgers
2003-08-20 11:40 ` Eli Zaretskii
     [not found] ` <mailman.542.1061395718.29551.help-gnu-emacs@gnu.org>
2003-08-21  3:12   ` David Vanderschel
2003-08-21 12:19     ` Alex Schroeder
2003-08-22  0:34       ` David Vanderschel
2003-08-22 15:20         ` Kevin Rodgers
2003-08-27 17:45         ` Kai Großjohann
2003-08-27 20:27           ` Kai Großjohann

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

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

  git send-email \
    --in-reply-to=873cfwvcqp.fsf@emacswiki.org \
    --to=alex@emacswiki.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 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.