From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alex Schroeder Newsgroups: gmane.emacs.help Subject: Re: elisp mouse programming problems Date: Wed, 20 Aug 2003 12:34:38 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <873cfwvcqp.fsf@emacswiki.org> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1061401082 15012 80.91.224.253 (20 Aug 2003 17:38:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 20 Aug 2003 17:38:02 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 20 19:38:00 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19pWuG-0002ye-00 for ; Wed, 20 Aug 2003 19:38:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19pQVC-0001yo-Tb for geh-help-gnu-emacs@m.gmane.org; Wed, 20 Aug 2003 06:47:42 -0400 Original-Newsgroups: gnu.emacs.help Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACkElEQVR42s1a0bLsIAgzjv// y7kPd9pVKxKVdk6fzux2C4EAwR6QZBpcQEopIf3Fq3a52Lfh0Mjjk99zcWYBwA2ihEen9jVxfAf/ u0+Y2HQwNoVw4Dx34trRV6NSjiLPmfPt77jwiBxB/3PnZ3B2AGxzHnGu0wcBwAIAyQwZGvQhiFcy YLOFQcSB/MS82n3ec37vykNqRFTX9rVWR2U5+pZNIggll0CUOQN9BDdm1LfBmcZxIEqjL6r2JU/D galaB7Zg4jlY2ulnIx9OR4iMRl38CAFyKaA8jAxE7lNn650VKMULZ/54crqn0YQCJGQliebXkFIK hwqmGm28cgsSjz/hzRCMneQEwMjVoH3gWTtMPgIslJUV5uIluvUEkyzU+gUGQO62e9NuSdZCzNOM fDPC87iCqfE9gHinsIrSL16TPBfrYIeHzqKU90a50jCh54EcrgAUFo5ibzvebgr/I66USQ0CspQp IVSoBQK3WswDDIndIraHxoglqOjM1d044PQvu1NY0EHtqQR/XwJ+PeCs0x2dSlApZVw4MPER23PD 7JekoHxrqTRod/2Gx5nhx5dfAJhqPt7tDMIZxNN/7lOIaparPn7ZQ88drlORC2eLWXowxIq4gHTh VN1BSmsHoxYAbPWDTuGQuuecS+aYQUYpfr0YqPQOuuUk5tApK077+2xfOYP+XyWEIwPcE49lvT9N y2+wU2KylGGp4yxlALcm6fSlmgk62yfSsfNunDl5d6W91MBUoZw679YAJoMMkhijuXdFOL+khaL2 s+g3zy4APQuQvSc/BNAYnkl6E8ivYtEHJXa1dihE3zgnKMdNgN8DiIwgA17NykUMvFDQ+LALvXXI BuBLAHv/DvBmc/0HzR03PqXmLcQAAAAASUVORK5CYII= User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:mPA6cvPvRdC+4g7AG1FP+ivQcJw= Original-NNTP-Posting-Host: 80.218.248.83 Original-X-Trace: news.swissonline.ch 1061375678 80.218.248.83 (20 Aug 2003 12:34:38 +0200) Original-Lines: 46 Original-X-Complaints-To: abuse@swissonline.ch Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!nntp.theplanet.net!inewsm1.nntp.theplanet.net!zen.net.uk!news.imp.ch!news.imp.ch!news-zh.switch.ch!switch.ch!news.swissonline.ch!not-for-mail Original-Xref: shelby.stanford.edu gnu.emacs.help:116017 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:11936 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11936 "David Vanderschel" 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.