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: key binding only for minor mode Date: Thu, 27 Aug 2009 19:01:19 -0700 (PDT) Organization: http://groups.google.com Message-ID: <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 X-Trace: ger.gmane.org 1251432165 3136 80.91.229.12 (28 Aug 2009 04:02:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Aug 2009 04:02:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 28 06:02:39 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 1Mgsfe-000454-1H for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Aug 2009 06:02:38 +0200 Original-Received: from localhost ([127.0.0.1]:41126 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mgsfd-0003Gf-Kd for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Aug 2009 00:02:37 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!d4g2000prc.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 28 Original-NNTP-Posting-Host: 128.171.156.62 Original-X-Trace: posting.google.com 1251424879 11777 127.0.0.1 (28 Aug 2009 02:01:19 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 28 Aug 2009 02:01:19 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d4g2000prc.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:172460 X-Mailman-Approved-At: Thu, 27 Aug 2009 23:54:34 -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:67606 Archived-At: Hi emacs users, I'm quite new to emacs lisp and using it in a learn-as-you-go way. I'm now trying to disable C-x C-q (normally bound to toggle-read-only) in the view mode, but I haven't been entirely successful. So far, I've been using local-set-key in the view-mode-hook: (add-hook 'view-mode-hook (lambda () (local-set-key "\C-x\C-q" (lambda () (interactive) (message "C-x C-q disabled.") (ding))))) which woks---until you toggle off the view-mode by "M-x view-mode". Once I exit from the view mode, I want C-x C-q back, but the key binding is still disabled. As I understand, the code above doesn't quite work because the view mode isn't a major mode. (local-set-key is local to the major mode, if I understand it correctly.) So, my question is how to solve this problem? What's the standard procedure to disable keys for a minor mode? Thank you for your attention, Ryo