This doesn’t bring much to users, and would probably need to be accompanied
by some changes to the packages, though I believe I addressed most of them
around the time of
http://mid.gmane.org/19585.17108.616205.880365@parhasard.net . It makes the
documentation clearer and less ambiguous and makes life easier for
programmers.
src/ChangeLog addition:
2011-04-04 Aidan Kehoe <kehoea(a)parhasard.net>
* keymap.c (Fdefine_key):
Make the docstring here clearer; don't apply the ASCII hack to key
sequences specified with vectors of characters, which are
XEmacs-specific and should be expected to be sane from the
ASCII-confusion perspective.
lisp/ChangeLog addition:
2011-04-04 Aidan Kehoe <kehoea(a)parhasard.net>
* help.el (help-map):
* keydefs.el (global-map):
Don't assume #'define-key will apply the ASCII-equivalence hack to
keys specified with vectors of characters, construct strings
instead (where the ASCII hack will be accepted for the foreseeable
future).
diff -r ccf7e84fe265 lisp/help.el
--- a/lisp/help.el Mon Apr 04 20:34:17 2011 +0100
+++ b/lisp/help.el Mon Apr 04 22:53:34 2011 +0100
@@ -61,7 +61,7 @@
;; global-map definitions moved to keydefs.el
(fset 'help-command help-map)
-(define-key help-map (vector help-char) 'help-for-help)
+(define-key help-map (string help-char) 'help-for-help)
(define-key help-map "?" 'help-for-help)
(define-key help-map 'help 'help-for-help)
(define-key help-map '(f1) 'help-for-help)
diff -r ccf7e84fe265 lisp/keydefs.el
--- a/lisp/keydefs.el Mon Apr 04 20:34:17 2011 +0100
+++ b/lisp/keydefs.el Mon Apr 04 22:53:34 2011 +0100
@@ -156,7 +156,7 @@
;; FSFmacs help.el
-(define-key global-map (vector help-char) 'help-command)
+(define-key global-map (string help-char) 'help-command)
(define-key global-map 'help 'help-command)
(define-key global-map 'f1 'help-command)
;; This is a failsafe mechanism, esp. on TTY's, in case the terminal is
--- a/src/keymap.c Mon Apr 04 20:34:17 2011 +0100
+++ b/src/keymap.c Mon Apr 04 22:53:34 2011 +0100
@@ -1828,16 +1828,20 @@
`define-key' also accepts a number of abbreviations, aliases, and variants
for convenience, compatibility, and internal use.
-A keystroke may be represented by a key; this is treated as though it were a
-list containing that key as the only element. A keystroke may also be
-represented by an event object, as returned by the `next-command-event' and
-`read-key-sequence' functions. A key sequence may be represented by a
-single keystroke; this is treated as a vector containing that keystroke as
-its only element.
-
-A key may be represented by a character or its equivalent integer code,
-if and only if it is equivalent to a character with a code in the range
-32 - 255.
+A key sequence may be represented by a single keystroke. This is treated as
+a vector containing that keystroke as its only element. XEmacs refuses to
+accept key sequences represented by single keystrokes if those single
+keystrokes are characters or integers below #x20 (the code for space).
+
+A keystroke may be represented by a key; this is treated as though it were a
+list containing that key as the only element.
+
+A keystroke may also be represented by an event object, as returned by the
+`next-command-event' and `read-key-sequence' functions. A key sequence may
+be represented by a single keystroke; this is treated as a vector containing
+that keystroke as its only element.
+
+A key may be represented by a character or its equivalent integer code.
For backward compatibility, a key sequence may also be represented by a
string. In this case, it represents the key sequence(s) that would
@@ -1937,10 +1941,17 @@
Lisp_Object c;
Lisp_Key_Data raw_key1;
Lisp_Key_Data raw_key2;
- if (STRINGP (keys))
+ if (ascii_hack)
c = make_char (string_ichar (keys, idx));
else
- c = XVECTOR_DATA (keys) [idx];
+ {
+ c = XVECTOR_DATA (keys) [idx];
+ if (CHARP (c))
+ {
+ /* Avoid problems with meta-character identity. */
+ c = XVECTOR_DATA (keys) [idx] = list1 (c);
+ }
+ }
define_key_parser (c, &raw_key1);
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches