From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.help Subject: Re: Can one define global-set-key to override mode-based keymap? Date: Thu, 21 Dec 2006 14:17:39 +0100 Message-ID: <458A8973.8040802@gmx.at> NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1166707359 2329 80.91.229.10 (21 Dec 2006 13:22:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 21 Dec 2006 13:22:39 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 21 14:22:35 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1GxNsZ-0003TI-JV for geh-help-gnu-emacs@m.gmane.org; Thu, 21 Dec 2006 14:22:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GxNsY-0003yT-Vt for geh-help-gnu-emacs@m.gmane.org; Thu, 21 Dec 2006 08:22:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GxNrI-0003I3-5b for help-gnu-emacs@gnu.org; Thu, 21 Dec 2006 08:21:16 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GxNrF-0003GU-2p for help-gnu-emacs@gnu.org; Thu, 21 Dec 2006 08:21:15 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GxNrE-0003GO-UQ for help-gnu-emacs@gnu.org; Thu, 21 Dec 2006 08:21:13 -0500 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.52) id 1GxNrE-0004Yo-FF for help-gnu-emacs@gnu.org; Thu, 21 Dec 2006 08:21:12 -0500 Original-Received: (qmail invoked by alias); 21 Dec 2006 13:21:10 -0000 Original-Received: from N720P030.adsl.highway.telekom.at (EHLO [62.47.33.254]) [62.47.33.254] by mail.gmx.net (mp041) with SMTP; 21 Dec 2006 14:21:10 +0100 X-Authenticated: #14592706 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en Original-To: engeler@gmail.com X-Y-GMX-Trusted: 0 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:39806 Archived-At: >> Not really recommended: >> >> (defvar my-map (make-sparse-keymap) >> "My keymap.") >> >> (defvar my-map-alist `((t . ,my-map)) >> "My keymap alist.") >> >> (add-to-ordered-list 'emulation-mode-map-alists 'my-map-alist 100) >> >> (define-key my-map [(control n)] 'other-window) > > I tried this and it works great so far. Why is it not recommended? It might interact badly with other modes using this - like cua-mode. If you use them, you should study their keymaps in order to avoid any bad interactions. Alternatively you could try `overriding-local-map'.