all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* key binding only for minor mode
@ 2009-08-28  2:01 Ryo Furue
  2009-08-28  5:37 ` Ivan Kanis
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ryo Furue @ 2009-08-28  2:01 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-09-01 19:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-28  2:01 key binding only for minor mode Ryo Furue
2009-08-28  5:37 ` Ivan Kanis
2009-08-28  6:14 ` Teemu Likonen
     [not found] ` <mailman.5564.1251441387.2239.help-gnu-emacs@gnu.org>
2009-08-29  0:05   ` Ryo Furue
2009-08-29  8:04     ` Bernardo
     [not found]     ` <mailman.5621.1251533091.2239.help-gnu-emacs@gnu.org>
2009-09-01 19:10       ` Ryo Furue

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.