emacs-devel
[Top][All Lists]
Advanced

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

Re: Customizing key bindings


From: Alex Schroeder
Subject: Re: Customizing key bindings
Date: Tue, 10 Sep 2002 00:06:39 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.90 (i686-pc-linux-gnu)

I included the changes by Per for the :key-sequence-keymap property,
reverted my changes to widget-get-ancestor, etc.

I also allow nil for the command widget, atm.  Perhaps a better
solution needs to be found (a choice widget?).  The benefit of
allowing nil is that this automatically results in that key being
undefined (since the code eventually calls define-key with DEF being
nil).  I like this much better than having two lists, one with keys to
add and one with keys to remove...

While playing around with emacs-lisp-mode-map (see below), I was still
vexed a few times.  At one time, it seemed that setting customizations
for the current session did not change the keybindings for all
emacs-lisp-mode buffers.  I had to run M-x emacs-lisp-mode to achieve
that.  The next time it worked, however.  Adding bindings, deleting
them again, and defining them to nil seemed to work as well, but
suddenly I had a situation where I thought I had undone all
customizations, but my test-key still had one of the bindings I had
added before.  So I hope other people will take the example below and
spend a few minutes fooling around with it.

To test saving and loading, I proceeded as follows, with an emacs that
had no customizations set and custom-file set to "~/.custom.el".

Store the value of a keymap in a variable.
Load the code.

(setq test emacs-lisp-mode-map)
(load-file "~/elisp/cus-key.el")

Now simulate a call to defkeymap.

(defkeymap emacs-lisp-mode-map test "foo")

Customize it, add a new keybinding, save for future sessions.

(customize-option 'emacs-lisp-mode-map)

Now save the following in test.el and start emacs -q -l test.el:

(require 'lisp-mode)
(setq test emacs-lisp-mode-map)
(load-file "~/elisp/cus-key.el")
(defkeymap emacs-lisp-mode-map test "foo")
(load-file "~/.custom.el")
;; (customize-option 'emacs-lisp-mode-map)

The new emacs-lisp-mode-map should contain your new binding, and
it should be customizable.

Now switch between the Customization buffer and *scratch* to test
stuff using C-h k.

Alex.




reply via email to

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