Mercurial > hg > xemacs-beta
changeset 5529:3d1f8f0e690f
Add `function-key-map-parent', for non-console-specific `function-key-map' bindings
src/ChangeLog addition:
2011-06-25 Aidan Kehoe <kehoea@parhasard.net>
* console.c:
* console.c (allocate_console):
* console.c (vars_of_console):
* console.c (complex_vars_of_console):
* lisp.h:
Add a new keymap variable, function-key-map-parent; use it as the
parent of each console-specific function-key-map. This is
appropriate for things like x-compose processing.
lisp/ChangeLog addition:
2011-06-25 Aidan Kehoe <kehoea@parhasard.net>
* gtk-init.el:
* gtk-init.el (make-device-late-gtk-entry-point):
* gtk-init.el (gtk-initialize-compose): Removed.
* keymap.el:
* keymap.el (function-key-map-parent):
* x-init.el (x-initialize-compose): Removed.
* x-init.el (make-device-late-x-entry-point):
Make the bindings for dead-acute and friends in
function-key-map-parent, rather than function-key-map; do this in
keymap.el rather than in window-system-specific code, since the
compose processing is generally useful and not X11-specific.
It's probably reasonable to rename x-compose.el to compose.el at
this point, but I haven't done that.
man/ChangeLog addition:
2011-06-25 Aidan Kehoe <kehoea@parhasard.net>
* lispref/os.texi (Translating Input):
Document the just-added function-key-map-parent.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 25 Jun 2011 14:00:48 +0100 |
parents | dc88f282ddc3 |
children | 17bcc2aab111 |
files | lisp/ChangeLog lisp/gtk-init.el lisp/keymap.el lisp/x-init.el man/ChangeLog man/lispref/os.texi src/ChangeLog src/console.c src/lisp.h |
diffstat | 9 files changed, 198 insertions(+), 273 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Fri Jun 24 19:59:35 2011 +0100 +++ b/lisp/ChangeLog Sat Jun 25 14:00:48 2011 +0100 @@ -1,3 +1,19 @@ +2011-06-25 Aidan Kehoe <kehoea@parhasard.net> + + * gtk-init.el: + * gtk-init.el (make-device-late-gtk-entry-point): + * gtk-init.el (gtk-initialize-compose): Removed. + * keymap.el: + * keymap.el (function-key-map-parent): + * x-init.el (x-initialize-compose): Removed. + * x-init.el (make-device-late-x-entry-point): + Make the bindings for dead-acute and friends in + function-key-map-parent, rather than function-key-map; do this in + keymap.el rather than in window-system-specific code, since the + compose processing is generally useful and not X11-specific. + It's probably reasonable to rename x-compose.el to compose.el at + this point, but I haven't done that. + 2011-06-23 Didier Verna <didier@xemacs.org> From smitchel <smitchel@bnin.net>
--- a/lisp/gtk-init.el Fri Jun 24 19:59:35 2011 +0100 +++ b/lisp/gtk-init.el Sat Jun 25 14:00:48 2011 +0100 @@ -109,7 +109,6 @@ (defun make-device-late-gtk-entry-point (device) "Entry-Point to do any Lisp-level GTK device-specific initialization." - (gtk-initialize-compose device) (unless make-device-late-gtk-entry-point-called-p (setq make-device-late-gtk-entry-point-called-p t))) @@ -149,120 +148,3 @@ (push '("-geometry" . gtk-init-handle-geometry) command-switch-alist) -;;; Stuff to get compose keys working on GTK -(eval-when-compile - (defmacro gtk-define-dead-key (key map device) - `(when (gtk-keysym-on-keyboard-p ',key device) - (define-key function-key-map [,key] ',map)))) - -(defun gtk-initialize-compose (device) - "Enable compose processing" - (autoload 'compose-map "gtk-compose" nil t 'keymap) - (autoload 'compose-acute-map "gtk-compose" nil t 'keymap) - (autoload 'compose-grave-map "gtk-compose" nil t 'keymap) - (autoload 'compose-cedilla-map "gtk-compose" nil t 'keymap) - (autoload 'compose-diaeresis-map "gtk-compose" nil t 'keymap) - (autoload 'compose-circumflex-map "gtk-compose" nil t 'keymap) - (autoload 'compose-tilde-map "gtk-compose" nil t 'keymap) - - (when (gtk-keysym-on-keyboard-p 'multi-key device) - (define-key function-key-map [multi-key] 'compose-map)) - - ;; The dead keys might really be called just about anything, depending - ;; on the vendor. MIT thinks that the prefixes are "SunFA_", "D", and - ;; "hpmute_" for Sun, DEC, and HP respectively. However, OpenWindows 3 - ;; thinks that the prefixes are "SunXK_FA_", "DXK_", and "hpXK_mute_". - ;; And HP (who don't mention Sun and DEC at all) use "XK_mute_". - ;; Go figure. - - ;; Presumably if someone is running OpenWindows, they won't be using - ;; the DEC or HP keysyms, but if they are defined then that is possible, - ;; so in that case we accept them all. - - ;; If things seem not to be working, you might want to check your - ;; /usr/lib/X11/XKeysymDB file to see if your vendor has an equally - ;; mixed up view of what these keys should be called. - - ;; Canonical names: - (gtk-define-dead-key acute compose-acute-map device) - (gtk-define-dead-key grave compose-grave-map device) - (gtk-define-dead-key cedilla compose-cedilla-map device) - (gtk-define-dead-key diaeresis compose-diaeresis-map device) - (gtk-define-dead-key circumflex compose-circumflex-map device) - (gtk-define-dead-key tilde compose-tilde-map device) - (gtk-define-dead-key degree compose-ring-map device) - - ;; Sun according to MIT: - (gtk-define-dead-key SunFA_Acute compose-acute-map device) - (gtk-define-dead-key SunFA_Grave compose-grave-map device) - (gtk-define-dead-key SunFA_Cedilla compose-cedilla-map device) - (gtk-define-dead-key SunFA_Diaeresis compose-diaeresis-map device) - (gtk-define-dead-key SunFA_Circum compose-circumflex-map device) - (gtk-define-dead-key SunFA_Tilde compose-tilde-map device) - - ;; Sun according to OpenWindows 2: - (gtk-define-dead-key Dead_Grave compose-grave-map device) - (gtk-define-dead-key Dead_Circum compose-circumflex-map device) - (gtk-define-dead-key Dead_Tilde compose-tilde-map device) - - ;; Sun according to OpenWindows 3: - (gtk-define-dead-key SunXK_FA_Acute compose-acute-map device) - (gtk-define-dead-key SunXK_FA_Grave compose-grave-map device) - (gtk-define-dead-key SunXK_FA_Cedilla compose-cedilla-map device) - (gtk-define-dead-key SunXK_FA_Diaeresis compose-diaeresis-map device) - (gtk-define-dead-key SunXK_FA_Circum compose-circumflex-map device) - (gtk-define-dead-key SunXK_FA_Tilde compose-tilde-map device) - - ;; DEC according to MIT: - (gtk-define-dead-key Dacute_accent compose-acute-map device) - (gtk-define-dead-key Dgrave_accent compose-grave-map device) - (gtk-define-dead-key Dcedilla_accent compose-cedilla-map device) - (gtk-define-dead-key Dcircumflex_accent compose-circumflex-map device) - (gtk-define-dead-key Dtilde compose-tilde-map device) - (gtk-define-dead-key Dring_accent compose-ring-map device) - - ;; DEC according to OpenWindows 3: - (gtk-define-dead-key DXK_acute_accent compose-acute-map device) - (gtk-define-dead-key DXK_grave_accent compose-grave-map device) - (gtk-define-dead-key DXK_cedilla_accent compose-cedilla-map device) - (gtk-define-dead-key DXK_circumflex_accent compose-circumflex-map device) - (gtk-define-dead-key DXK_tilde compose-tilde-map device) - (gtk-define-dead-key DXK_ring_accent compose-ring-map device) - - ;; HP according to MIT: - (gtk-define-dead-key hpmute_acute compose-acute-map device) - (gtk-define-dead-key hpmute_grave compose-grave-map device) - (gtk-define-dead-key hpmute_diaeresis compose-diaeresis-map device) - (gtk-define-dead-key hpmute_asciicircum compose-circumflex-map device) - (gtk-define-dead-key hpmute_asciitilde compose-tilde-map device) - - ;; Empirically discovered on Linux XFree86 MetroX: - (gtk-define-dead-key usldead_acute compose-acute-map device) - (gtk-define-dead-key usldead_grave compose-grave-map device) - (gtk-define-dead-key usldead_diaeresis compose-diaeresis-map device) - (gtk-define-dead-key usldead_asciicircum compose-circumflex-map device) - (gtk-define-dead-key usldead_asciitilde compose-tilde-map device) - - ;; HP according to OpenWindows 3: - (gtk-define-dead-key hpXK_mute_acute compose-acute-map device) - (gtk-define-dead-key hpXK_mute_grave compose-grave-map device) - (gtk-define-dead-key hpXK_mute_diaeresis compose-diaeresis-map device) - (gtk-define-dead-key hpXK_mute_asciicircum compose-circumflex-map device) - (gtk-define-dead-key hpXK_mute_asciitilde compose-tilde-map device) - - ;; HP according to HP-UX 8.0: - (gtk-define-dead-key XK_mute_acute compose-acute-map device) - (gtk-define-dead-key XK_mute_grave compose-grave-map device) - (gtk-define-dead-key XK_mute_diaeresis compose-diaeresis-map device) - (gtk-define-dead-key XK_mute_asciicircum compose-circumflex-map device) - (gtk-define-dead-key XK_mute_asciitilde compose-tilde-map device) - - ;; Xfree86 seems to use lower case and a hyphen - (gtk-define-dead-key dead-acute compose-acute-map device) - (gtk-define-dead-key dead-grave compose-grave-map device) - (gtk-define-dead-key dead-cedilla compose-cedilla-map device) - (gtk-define-dead-key dead-diaeresis compose-diaeresis-map device) - (gtk-define-dead-key dead-circum compose-circumflex-map device) - (gtk-define-dead-key dead-circumflex compose-circumflex-map device) - (gtk-define-dead-key dead-tilde compose-tilde-map device)) -
--- a/lisp/keymap.el Fri Jun 24 19:59:35 2011 +0100 +++ b/lisp/keymap.el Sat Jun 25 14:00:48 2011 +0100 @@ -510,18 +510,141 @@ (error "Event has no character equivalent: %s" event)))) (vector (intern (concat "" (nreverse list)))))) -;; This looks dirty. The following code should maybe go to another -;; file, and `create-console-hook' should maybe default to nil. -(add-hook - 'create-console-hook - #'(lambda (console) - (letf (((selected-console) console)) - (define-key function-key-map [?\C-x ?@ ?h] 'event-apply-hyper-modifier) - (define-key function-key-map [?\C-x ?@ ?s] 'event-apply-super-modifier) - (define-key function-key-map [?\C-x ?@ ?m] 'event-apply-meta-modifier) - (define-key function-key-map [?\C-x ?@ ?S] 'event-apply-shift-modifier) - (define-key function-key-map [?\C-x ?@ ?c] 'event-apply-control-modifier) - (define-key function-key-map [?\C-x ?@ ?a] 'event-apply-alt-modifier) - (define-key function-key-map [?\C-x ?@ ?k] 'synthesize-keysym)))) +(define-key function-key-map-parent [?\C-x ?@ ?h] 'event-apply-hyper-modifier) +(define-key function-key-map-parent [?\C-x ?@ ?s] 'event-apply-super-modifier) +(define-key function-key-map-parent [?\C-x ?@ ?m] 'event-apply-meta-modifier) +(define-key function-key-map-parent [?\C-x ?@ ?S] 'event-apply-shift-modifier) +(define-key function-key-map-parent [?\C-x ?@ ?c] 'event-apply-control-modifier) +(define-key function-key-map-parent [?\C-x ?@ ?a] 'event-apply-alt-modifier) +(define-key function-key-map-parent [?\C-x ?@ ?k] 'synthesize-keysym) + +;; The autoloads for the compose map, and their bindings in +;; function-key-map-parent are used by GTK as well as X11. And Julian +;; Bradfield, at least, uses x-compose on the TTY, it's reasonable to make +;; them generally available. + +(loop for map in '(compose-acute-map compose-breve-map compose-caron-map + compose-cedilla-map compose-circumflex-map + compose-diaeresis-map compose-dot-map + compose-doubleacute-map compose-grave-map + compose-hook-map compose-horn-map compose-macron-map + compose-map compose-ogonek-map compose-ring-map + compose-stroke-map compose-tilde-map) + do (autoload map "x-compose" nil t 'keymap)) + +(loop + for (key map) + ;; The dead keys might really be called just about anything, depending + ;; on the vendor. MIT thinks that the prefixes are "SunFA_", "D", and + ;; "hpmute_" for Sun, DEC, and HP respectively. However, OpenWindows 3 + ;; thinks that the prefixes are "SunXK_FA_", "DXK_", and "hpXK_mute_". + ;; And HP (who don't mention Sun and DEC at all) use "XK_mute_". Go + ;; figure. + + ;; Presumably if someone is running OpenWindows, they won't be using the + ;; DEC or HP keysyms, but if they are defined then that is possible, so + ;; in that case we accept them all. + + ;; If things seem not to be working, you might want to check your + ;; /usr/lib/X11/XKeysymDB file to see if your vendor has an equally + ;; mixed up view of what these keys should be called. + + ;; Canonical names: + in '((acute compose-acute-map) + (grave compose-grave-map) + (cedilla compose-cedilla-map) + (diaeresis compose-diaeresis-map) + (circumflex compose-circumflex-map) + (tilde compose-tilde-map) + (degree compose-ring-map) + (multi-key compose-map) + + ;; Sun according to MIT: + (SunFA_Acute compose-acute-map) + (SunFA_Grave compose-grave-map) + (SunFA_Cedilla compose-cedilla-map) + (SunFA_Diaeresis compose-diaeresis-map) + (SunFA_Circum compose-circumflex-map) + (SunFA_Tilde compose-tilde-map) + + ;; Sun according to OpenWindows 2: + (Dead_Grave compose-grave-map) + (Dead_Circum compose-circumflex-map) + (Dead_Tilde compose-tilde-map) + + ;; Sun according to OpenWindows 3: + (SunXK_FA_Acute compose-acute-map) + (SunXK_FA_Grave compose-grave-map) + (SunXK_FA_Cedilla compose-cedilla-map) + (SunXK_FA_Diaeresis compose-diaeresis-map) + (SunXK_FA_Circum compose-circumflex-map) + (SunXK_FA_Tilde compose-tilde-map) + + ;; DEC according to MIT: + (Dacute_accent compose-acute-map) + (Dgrave_accent compose-grave-map) + (Dcedilla_accent compose-cedilla-map) + (Dcircumflex_accent compose-circumflex-map) + (Dtilde compose-tilde-map) + (Dring_accent compose-ring-map) + + ;; DEC according to OpenWindows 3: + (DXK_acute_accent compose-acute-map) + (DXK_grave_accent compose-grave-map) + (DXK_cedilla_accent compose-cedilla-map) + (DXK_circumflex_accent compose-circumflex-map) + (DXK_tilde compose-tilde-map) + (DXK_ring_accent compose-ring-map) + + ;; HP according to MIT: + (hpmute_acute compose-acute-map) + (hpmute_grave compose-grave-map) + (hpmute_diaeresis compose-diaeresis-map) + (hpmute_asciicircum compose-circumflex-map) + (hpmute_asciitilde compose-tilde-map) + + ;; Empirically discovered on Linux XFree86 MetroX: + (usldead_acute compose-acute-map) + (usldead_grave compose-grave-map) + (usldead_diaeresis compose-diaeresis-map) + (usldead_asciicircum compose-circumflex-map) + (usldead_asciitilde compose-tilde-map) + + ;; HP according to OpenWindows 3: + (hpXK_mute_acute compose-acute-map) + (hpXK_mute_grave compose-grave-map) + (hpXK_mute_diaeresis compose-diaeresis-map) + (hpXK_mute_asciicircum compose-circumflex-map) + (hpXK_mute_asciitilde compose-tilde-map) + + ;; HP according to HP-UX 8.0: + (XK_mute_acute compose-acute-map) + (XK_mute_grave compose-grave-map) + (XK_mute_diaeresis compose-diaeresis-map) + (XK_mute_asciicircum compose-circumflex-map) + (XK_mute_asciitilde compose-tilde-map) + + ;; XFree86 uses lower case and an underscore. XEmacs converts the + ;; underscore to a hyphen in x_keysym_to_emacs_keysym because the + ;; keysym is in the "Keyboard" character set, which seems a very + ;; arbitrary approach. + (dead-acute compose-acute-map) + (dead-grave compose-grave-map) + (dead-cedilla compose-cedilla-map) + (dead-diaeresis compose-diaeresis-map) + (dead-circum compose-circumflex-map) + (dead-circumflex compose-circumflex-map) + (dead-tilde compose-tilde-map) + (dead-abovering compose-ring-map) + (dead-caron compose-caron-map) + (dead-macron compose-macron-map) + (dead-breve compose-breve-map) + (dead-abovedot compose-dot-map) + (dead-doubleacute compose-doubleacute-map) + (dead-ogonek compose-ogonek-map) + (dead-hook compose-hook-map) + (dead-horn compose-horn-map) + (dead-stroke compose-stroke-map)) + do (define-key function-key-map-parent (vector key) map)) ;;; keymap.el ends here
--- a/lisp/x-init.el Fri Jun 24 19:59:35 2011 +0100 +++ b/lisp/x-init.el Sat Jun 25 14:00:48 2011 +0100 @@ -79,143 +79,6 @@ (interactive) (ow-find t)) -;; Load X-server specific code. -;; Specifically, load some code to repair the grievous damage that MIT and -;; Sun have done to the default keymap for the Sun keyboards. -(defun x-initialize-compose (device) - "Enable compose key and dead key processing on DEVICE." - (loop for map in '(compose-map compose-acute-map compose-grave-map - compose-cedilla-map compose-diaeresis-map - compose-circumflex-map compose-tilde-map - compose-ring-map compose-caron-map compose-macron-map - compose-breve-map compose-dot-map - compose-doubleacute-map compose-ogonek-map - compose-hook-map compose-horn-map compose-stroke-map) - do (autoload map "x-compose" nil t 'keymap)) - - (loop - for (key map) - ;; The dead keys might really be called just about anything, depending - ;; on the vendor. MIT thinks that the prefixes are "SunFA_", "D", and - ;; "hpmute_" for Sun, DEC, and HP respectively. However, OpenWindows 3 - ;; thinks that the prefixes are "SunXK_FA_", "DXK_", and "hpXK_mute_". - ;; And HP (who don't mention Sun and DEC at all) use "XK_mute_". Go - ;; figure. - - ;; Presumably if someone is running OpenWindows, they won't be using the - ;; DEC or HP keysyms, but if they are defined then that is possible, so - ;; in that case we accept them all. - - ;; If things seem not to be working, you might want to check your - ;; /usr/lib/X11/XKeysymDB file to see if your vendor has an equally - ;; mixed up view of what these keys should be called. - - ;; Canonical names: - in '((acute compose-acute-map) - (grave compose-grave-map) - (cedilla compose-cedilla-map) - (diaeresis compose-diaeresis-map) - (circumflex compose-circumflex-map) - (tilde compose-tilde-map) - (degree compose-ring-map) - (multi-key compose-map) - - ;; Sun according to MIT: - (SunFA_Acute compose-acute-map) - (SunFA_Grave compose-grave-map) - (SunFA_Cedilla compose-cedilla-map) - (SunFA_Diaeresis compose-diaeresis-map) - (SunFA_Circum compose-circumflex-map) - (SunFA_Tilde compose-tilde-map) - - ;; Sun according to OpenWindows 2: - (Dead_Grave compose-grave-map) - (Dead_Circum compose-circumflex-map) - (Dead_Tilde compose-tilde-map) - - ;; Sun according to OpenWindows 3: - (SunXK_FA_Acute compose-acute-map) - (SunXK_FA_Grave compose-grave-map) - (SunXK_FA_Cedilla compose-cedilla-map) - (SunXK_FA_Diaeresis compose-diaeresis-map) - (SunXK_FA_Circum compose-circumflex-map) - (SunXK_FA_Tilde compose-tilde-map) - - ;; DEC according to MIT: - (Dacute_accent compose-acute-map) - (Dgrave_accent compose-grave-map) - (Dcedilla_accent compose-cedilla-map) - (Dcircumflex_accent compose-circumflex-map) - (Dtilde compose-tilde-map) - (Dring_accent compose-ring-map) - - ;; DEC according to OpenWindows 3: - (DXK_acute_accent compose-acute-map) - (DXK_grave_accent compose-grave-map) - (DXK_cedilla_accent compose-cedilla-map) - (DXK_circumflex_accent compose-circumflex-map) - (DXK_tilde compose-tilde-map) - (DXK_ring_accent compose-ring-map) - - ;; HP according to MIT: - (hpmute_acute compose-acute-map) - (hpmute_grave compose-grave-map) - (hpmute_diaeresis compose-diaeresis-map) - (hpmute_asciicircum compose-circumflex-map) - (hpmute_asciitilde compose-tilde-map) - - ;; Empirically discovered on Linux XFree86 MetroX: - (usldead_acute compose-acute-map) - (usldead_grave compose-grave-map) - (usldead_diaeresis compose-diaeresis-map) - (usldead_asciicircum compose-circumflex-map) - (usldead_asciitilde compose-tilde-map) - - ;; HP according to OpenWindows 3: - (hpXK_mute_acute compose-acute-map) - (hpXK_mute_grave compose-grave-map) - (hpXK_mute_diaeresis compose-diaeresis-map) - (hpXK_mute_asciicircum compose-circumflex-map) - (hpXK_mute_asciitilde compose-tilde-map) - - ;; HP according to HP-UX 8.0: - (XK_mute_acute compose-acute-map) - (XK_mute_grave compose-grave-map) - (XK_mute_diaeresis compose-diaeresis-map) - (XK_mute_asciicircum compose-circumflex-map) - (XK_mute_asciitilde compose-tilde-map) - - ;; [[ XFree86 seems to use lower case and a hyphen ]] Not true; - ;; they use lower case and an underscore. XEmacs converts the - ;; underscore to a hyphen in x_keysym_to_emacs_keysym because the - ;; keysym is in the "Keyboard" character set, which is just totally - ;; fucking random, considering it doesn't happen for any other - ;; character sets. - (dead-acute compose-acute-map) - (dead-grave compose-grave-map) - (dead-cedilla compose-cedilla-map) - (dead-diaeresis compose-diaeresis-map) - (dead-circum compose-circumflex-map) - (dead-circumflex compose-circumflex-map) - (dead-tilde compose-tilde-map) - (dead-abovering compose-ring-map) - (dead-caron compose-caron-map) - (dead-macron compose-macron-map) - (dead-breve compose-breve-map) - (dead-abovedot compose-dot-map) - (dead-doubleacute compose-doubleacute-map) - (dead-ogonek compose-ogonek-map) - (dead-hook compose-hook-map) - (dead-horn compose-horn-map) - (dead-stroke compose-stroke-map)) - - ;; Get the correct value for function-key-map - with function-key-map = (symbol-value-in-console 'function-key-map - (device-console device) - function-key-map) - do (when (x-keysym-on-keyboard-p key device) - (define-key function-key-map (vector key) map)))) - (eval-when-compile (load "x-win-sun" nil t) (load "x-win-xfree86" nil t)) @@ -291,7 +154,6 @@ "Entry point to do any Lisp-level X device-specific initialization." ;; General code, called on every X device created: (x-initialize-keyboard device) - (x-initialize-compose device) ;; And the following code is to be called once, the first time an X11 ;; device is created: (unless make-device-late-x-entry-point-called-p
--- a/man/ChangeLog Fri Jun 24 19:59:35 2011 +0100 +++ b/man/ChangeLog Sat Jun 25 14:00:48 2011 +0100 @@ -1,3 +1,8 @@ +2011-06-25 Aidan Kehoe <kehoea@parhasard.net> + + * lispref/os.texi (Translating Input): + Document the just-added function-key-map-parent. + 2011-05-20 Jerry James <james@xemacs.org> * Makefile (DESTDIR): New variable for all Makefiles, unused in this
--- a/man/lispref/os.texi Fri Jun 24 19:59:35 2011 +0100 +++ b/man/lispref/os.texi Sat Jun 25 14:00:48 2011 +0100 @@ -1301,10 +1301,10 @@ @end ignore @defvar function-key-map -This variable holds a keymap that describes the character sequences -sent by function keys on an ordinary character terminal. This keymap -uses the same data structure as other keymaps, but is used differently: it -specifies translations to make while reading events. +This console-local variable holds a keymap that describes the character +sequences sent by function keys on an ordinary character terminal. This +keymap uses the same data structure as other keymaps, but is used +differently: it specifies translations to make while reading events. If @code{function-key-map} ``binds'' a key sequence @var{k} to a vector @var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a @@ -1337,6 +1337,14 @@ the character sequences that represent function keys. @end defvar +@defvar function-key-map-parent +The parent keymap of @code{function-key-map} is a non-console-local keymap, +@code{function-key-map-parent}, and any additions to +@code{function-key-map} that are not specific to a given console should +normally go into @code{function-key-map-parent} rather than +@code{function-key-map}. +@end defvar + @defvar key-translation-map This variable is another keymap used just like @code{function-key-map} to translate input events into other events. It differs from
--- a/src/ChangeLog Fri Jun 24 19:59:35 2011 +0100 +++ b/src/ChangeLog Sat Jun 25 14:00:48 2011 +0100 @@ -1,3 +1,14 @@ +2011-06-25 Aidan Kehoe <kehoea@parhasard.net> + + * console.c: + * console.c (allocate_console): + * console.c (vars_of_console): + * console.c (complex_vars_of_console): + * lisp.h: + Add a new keymap variable, function-key-map-parent; use it as the + parent of each console-specific function-key-map. This is + appropriate for things like x-compose processing. + 2011-06-19 Aidan Kehoe <kehoea@parhasard.net> * fns.c:
--- a/src/console.c Fri Jun 24 19:59:35 2011 +0100 +++ b/src/console.c Sat Jun 25 14:00:48 2011 +0100 @@ -45,6 +45,8 @@ Lisp_Object Vcreate_console_hook, Vdelete_console_hook; +Lisp_Object Vfunction_key_map_parent; + Lisp_Object Qconsolep, Qconsole_live_p; Lisp_Object Qcreate_console_hook; Lisp_Object Qdelete_console_hook; @@ -203,6 +205,7 @@ con->contype = get_console_variant (type); con->command_builder = allocate_command_builder (console, 1); con->function_key_map = Fmake_sparse_keymap (Qnil); + Fset_keymap_parents (con->function_key_map, Vfunction_key_map_parent); set_quit_events (con, make_char (7)); /* C-g */ UNGCPRO; @@ -1306,6 +1309,15 @@ */ ); Vdelete_console_hook = Qnil; + DEFVAR_LISP ("function-key-map-parent", &Vfunction_key_map_parent /* +Parent keymap for `function-key-map'. + +This keymap is appropriate for bindings that are not console-specific, but +yet should take advantage of the substitution made by `read-key-sequence' +for bindings in `function-key-map'. +*/ ); + Vfunction_key_map_parent = Fmake_sparse_keymap (Qnil); + #ifdef HAVE_WINDOW_SYSTEM Fprovide (intern ("window-system")); #endif @@ -1530,6 +1542,11 @@ \[#<keypress-event control-X> #<keypress-event f1>]. If [f1] were a prefix key, typing `ESC O P x' would return \[#<keypress-event f1> #<keypress-event x>]. + +The parent keymap of `function-key-map' when created is +`function-key-map-parent', which is not a console-local variable. Bindings +appropriate for `function-key-map' but which are likely to be relevant to +every created console should be created in `function-key-map-parent'. */ ); #ifdef HAVE_TTY