From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jpkotta Newsgroups: gmane.emacs.help Subject: undoing define-key Date: Tue, 18 Dec 2012 09:46:41 -0800 (PST) Message-ID: <6461229b-84bb-4d42-a075-5ab5ffe11e4a@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1355853017 7024 80.91.229.3 (18 Dec 2012 17:50:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Dec 2012 17:50:17 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 18 18:50:32 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tl1JF-0001kn-4b for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Dec 2012 18:50:29 +0100 Original-Received: from localhost ([::1]:45535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tl1J0-00051K-J6 for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Dec 2012 12:50:14 -0500 X-Received: by 10.66.80.41 with SMTP id o9mr383245pax.4.1355852801468; Tue, 18 Dec 2012 09:46:41 -0800 (PST) Original-Received: by 10.50.37.232 with SMTP id b8mr1433437igk.4.1355852801394; Tue, 18 Dec 2012 09:46:41 -0800 (PST) Original-Path: usenet.stanford.edu!kr7no10438203pbb.0!news-out.google.com!6ni51730pbd.1!nntp.google.com!kr7no10438196pbb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.97.12.233; posting-account=EwI0QQoAAADdqmqX_mVfawBNtwyks2YE Original-NNTP-Posting-Host: 70.97.12.233 User-Agent: G2/1.0 Injection-Date: Tue, 18 Dec 2012 17:46:41 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:195878 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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 Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88197 Archived-At: How can I unbind a key in a keymap such that it acts like it was never defined? The docs make it sound like binding to nil, e.g. (define-key map (kbd "") nil), will do what I want, but it doesn't. Example (works with emacs -q): (define-minor-mode foo-mode :global t :keymap (let ((map (make-sparse-keymap))) (define-key map (kbd "M-j") 'left-char) (define-key map (kbd "M-k") 'next-line) (define-key map (kbd "M-l") 'right-char) (define-key map (kbd "M-i") 'previous-line) map) ) (foo-mode 1) ;; Now M-[ijkl] act like the arrow keys ;; I can do an isearch and they will exit the search just like the arrows (define-key isearch-mode-map (kbd "M-j") nil) ;; Now M-j does not exit isearch, and it behaves like whatever it was bound to outside of foo-mode. M-j still does left-char outside of isearch-mode.