[Top][All Lists]

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

prefix key with its own map as binding?

From: Joost Kremers
Subject: prefix key with its own map as binding?
Date: 25 Mar 2007 20:55:58 GMT
User-agent: slrn/ (Linux)

is there a "conventional" way of binding a prefix key to the very same
keymap it is in? basically thus:

(defvar some-mode-map (make-keymap))
(suppress-keymap some-mode-map)
(define-key some-mode-map "a" 'some-function)
(define-key some-mode-map "b" 'some-other-function)
(define-key some-mode-map "c" 'yet-some-other-function)
(define-key some-mode-map ...)
(define-key some-mode-map ":" 'some-mode-map)

(fset 'some-mode-map some-mode-map)

the idea is that every function that is bound to a key in some-mode-map can
be called either by pressing its command key, or by pressing `:' followed
by its command key. the function called can then use this-command-keys to
determine how it was called, and determine its behaviour accordingly.

alternatively, if all this sounds like A Bad Idea(TM), is there another way
to get this (or similar) behaviour? (using a prefix argument is not really
an option, btw.)


Joost Kremers                                      address@hidden
Selbst in die Unterwelt dringt durch Spalten Licht

reply via email to

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