From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Elena Newsgroups: gmane.emacs.help Subject: Re: Clearing keybindings when redefining a minor mode map Date: Mon, 27 Dec 2010 05:58:45 -0800 (PST) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1293460841 27980 80.91.229.12 (27 Dec 2010 14:40:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 27 Dec 2010 14:40:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 27 15:40:33 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PXEFT-0002yC-22 for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Dec 2010 15:40:31 +0100 Original-Received: from localhost ([127.0.0.1]:47894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXEFS-00022E-Dw for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Dec 2010 09:40:30 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!j3g2000vbi.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 22 Original-NNTP-Posting-Host: 89.96.190.244 Original-X-Trace: posting.google.com 1293458325 27608 127.0.0.1 (27 Dec 2010 13:58:45 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 27 Dec 2010 13:58:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j3g2000vbi.googlegroups.com; posting-host=89.96.190.244; posting-account=AFCLjAoAAABJAOf_HjgEEEi3ty-lG5m2 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:183679 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:77913 Archived-At: On Dec 27, 7:19=A0am, Leo Alekseyev wrote: > Greetings all, > > Suppose I have a keybinding that is shared by two minor modes (mode A > and mode B). =A0I want to accomplish the following: if both modes A and B= are > active, then the keybinding should only invoke mode A's command. > > My original approach was to insert code in mode B's commands that checks = if > mode A is active, and if so, it creates a new keymap for mode B, with > conflicts removed. =A0Unfortunately, even though the new map is created > properly, it > doesn't remove the old keybindings that are in conflict with mode A. =A0I= s > there an easy way to clear those keybindings? > > --Leo Maybe you could put some code in mode B's hook to disable mode A if enabled already and then enable it? This way you would be ensuring mode A always gets enabled after mode B, thus shadowing mode B's map.