help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

key binding only for minor mode


From: Ryo Furue
Subject: key binding only for minor mode
Date: Thu, 27 Aug 2009 19:01:19 -0700 (PDT)
User-agent: G2/1.0

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]