From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ryo Furue Newsgroups: gmane.emacs.help Subject: Re: key binding only for minor mode Date: Fri, 28 Aug 2009 17:05:26 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <54a4a183-adb0-4a20-a3b8-776e676018e4@d4g2000prc.googlegroups.com> 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: ger.gmane.org 1251525002 17100 80.91.229.12 (29 Aug 2009 05:50:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Aug 2009 05:50:02 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 29 07:49:55 2009 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.50) id 1MhGp1-0002sn-JY for geh-help-gnu-emacs@m.gmane.org; Sat, 29 Aug 2009 07:49:55 +0200 Original-Received: from localhost ([127.0.0.1]:52340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhGp0-0004op-Uy for geh-help-gnu-emacs@m.gmane.org; Sat, 29 Aug 2009 01:49:55 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!13g2000prl.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 27 Original-NNTP-Posting-Host: 128.171.156.62 Original-X-Trace: posting.google.com 1251504329 22690 127.0.0.1 (29 Aug 2009 00:05:29 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 29 Aug 2009 00:05:29 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 13g2000prl.googlegroups.com; posting-host=128.171.156.62; posting-account=5HDL_QoAAAChem0F3_r7-K91L8nAM3kN User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.80 (X11; Linux i686; U; en) Presto/2.2.15 Version/10.00,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:172485 X-Mailman-Approved-At: Sat, 29 Aug 2009 01:46:35 -0400 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:67631 Archived-At: Thank you, Teemu and Ivan. Your solutions work. Except . . . On Aug 27, 7:37=A0pm, Ivan Kanis wrote: > > So, my question is how to solve this problem? =A0What's the standard > > procedure to disable keys for a minor mode? > > Find the keymap for view-mode and set the key to nil. > > (add-hook 'view-mode-hook > =A0 =A0(lambda () (define-key view-mode-map (kbd "C-x C-q") nil))) This one doesn't appear to have any effect. I guess: This one removes the key C-x C-q from the local keymap (view-mode-map). Therefore, when you pressthe key combination, the global binding is invoked which is toggle-read-only. So, I guess we have to bind C-x C-q to something rather than to undefine it, as in Teemu's example. By the way, I'm wondering what #' is. I vaguely know what a single quote means (quote or don't evaluate it now) but I don't remember seeing #' . I tried the official emacs lisp reference manual, but unless I read it from the top, I wouldn't find it. (Google isn't of much use when you want to search for something like '# . . . ). Anyway, I'm completely happy with the solution you showed. Thanks again, Ryo