User: aidan
Date: 05/12/17 20:47:05
Modified: xemacs/src ChangeLog console-x.c event-Xt.c file-coding.c
Log:
Fix self-insert-command with X11 input methods. Addresses Zhang Wei's
problem of 871x118lc4.fsf(a)gmail.com.
Revision Changes Path
1.710 +12 -0 XEmacs/xemacs/lisp/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/ChangeLog,v
retrieving revision 1.709
retrieving revision 1.710
diff -u -p -r1.709 -r1.710
--- ChangeLog 2005/12/16 23:52:22 1.709
+++ ChangeLog 2005/12/17 19:46:57 1.710
@@ -1,3 +1,15 @@
+2005-12-17 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * mule/mule-cmds.el (set-language-environment-coding-systems):
+ Initialise keyboard-coding-system, terminal-coding-system when
+ applying a language environment, together with the input and
+ output coding systems for any active TTY console.
+ * mule/mule-cmds.el (init-locale-at-early-startup):
+ If set-current-locale returns a `more-specified version' of the
+ current locale when passed a zero length argument, the magic used
+ to work out the current language environment from the C locale
+ will fail. Call current-locale instead.
+
2005-12-17 Adrian Aichner <adrian(a)xemacs.org>
* package-get.el (package-get-download-sites): Add Hong Kong
1.26 +15 -1 XEmacs/xemacs/lisp/mule/mule-cmds.el
Index: mule-cmds.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/mule/mule-cmds.el,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -p -r1.25 -r1.26
--- mule-cmds.el 2005/10/04 16:43:36 1.25
+++ mule-cmds.el 2005/12/17 19:47:00 1.26
@@ -1271,6 +1271,20 @@ of buffer-file-coding-system set by this
(warn "Invalid native-coding-system %s in language environment %s"
native language-name)))
(define-coding-system-alias 'file-name 'native)
+ ;; Set the default keyboard and terminal coding systems to the native
+ ;; coding system of the language environment.
+ ;;
+ (setq keyboard-coding-system native
+ terminal-coding-system native)
+
+ ;; And do the same for any TTYs.
+ (dolist (con (console-list))
+ (when (eq 'tty (device-type (car (console-device-list con))))
+ ;; Calling set-input-mode at the same time would be a sane thing
+ ;; to do here. I would prefer to default to accepting eight bit
+ ;; input and not using the top bit for Meta.
+ (set-console-tty-coding-system con native)))
+
;; process output should not have EOL conversion. under MS Windows
;; and Cygwin, this screws things up (`cmd' is fine with just LF and
;; `bash' chokes on CR-LF).
@@ -1327,7 +1341,7 @@ of buffer-file-coding-system set by this
;; locale but we should still use the right code page, etc.
(declare-fboundp (mswindows-set-current-locale userdef)))
;; Unix:
- (let ((locstring (set-current-locale "")))
+ (let ((locstring (current-locale)))
;; assume C lib locale and LANG env var are set correctly. use
;; them to find the langenv.
(setq langenv
1.903 +15 -0 XEmacs/xemacs/src/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.902
retrieving revision 1.903
diff -u -p -r1.902 -r1.903
--- ChangeLog 2005/11/30 11:28:56 1.902
+++ ChangeLog 2005/12/17 19:47:01 1.903
@@ -1,3 +1,18 @@
+2005-12-17 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * console-x.c (x_perhaps_init_unseen_key_defaults):
+ If the key name is a single character, and the keysym is NoSymbol,
+ give it a default binding, if that is possible. This addresses the
+ problem Zhang Wei points out in <871x118lc4.fsf(a)gmail.com>
+ * event-Xt.c (x_to_emacs_keysym):
+ Print the characters of a keysym's name directly if it's printable
+ ASCII, or as an octal escape if it's not.
+
+ Use keyboard-coding-system rather than undecided for decoding the
+ keysym name passed to us by an input method.
+ * file-coding.c (vars_of_file_coding):
+ Document that keyboard-coding-system is also used for X11.
+
2005-11-29 Marcus Crestani <crestani(a)xemacs.org>
* xemacs.def.in.in: Condition error_check_* symbols on
1.16 +20 -0 XEmacs/xemacs/src/console-x.c
Index: console-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/console-x.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -p -r1.15 -r1.16
--- console-x.c 2005/06/29 09:47:35 1.15
+++ console-x.c 2005/12/17 19:47:02 1.16
@@ -349,6 +349,26 @@ x_perhaps_init_unseen_key_defaults (stru
xkeysym = XStringToKeysym(keysym_ext);
if (NoSymbol == xkeysym)
{
+ /* Keysym is NoSymbol; this may mean the key event passed to us came
+ from an input method, which stored the actual character intended to
+ be inserted in the key name, and didn't trouble itself to set the
+ keycode to anything useful. Thus, if the key name is a single
+ character, and the keysym is NoSymbol, give it a default binding,
+ if that is possible. */
+ Lisp_Object keychar;
+
+ if (1 != string_char_length(key_name))
+ {
+ /* Don't let them pass us more than one character. */
+ return Qnil;
+ }
+ keychar = make_char(itext_ichar(XSTRING_DATA(key_name)));
+ if (NILP (Flookup_key (Vcurrent_global_map, keychar, Qnil)))
+ {
+ Fdefine_key (Vcurrent_global_map, keychar, Qself_insert_command);
+ Fputhash (keychar, Qt, DEVICE_X_KEYSYM_MAP_HASH_TABLE (d));
+ return Qt;
+ }
return Qnil;
}
1.90 +20 -3 XEmacs/xemacs/src/event-Xt.c
Index: event-Xt.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/event-Xt.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -p -r1.89 -r1.90
--- event-Xt.c 2005/11/26 11:46:07 1.89
+++ event-Xt.c 2005/12/17 19:47:03 1.90
@@ -898,7 +898,16 @@ x_to_emacs_keysym (XKeyPressedEvent *eve
int j;
stderr_out (" chars=\"");
for (j=0; j<len; j++)
- stderr_out ("%c", bufptr[j]);
+ {
+ if (040 <= bufptr[j] && bufptr[j] >= 0177)
+ {
+ stderr_out ("%c", bufptr[j]);
+ }
+ else
+ {
+ stderr_out ("\\%o", (unsigned)(bufptr[j]));
+ }
+ }
stderr_out ("\"");
}
else if (bufptr[0] <= 32 || bufptr[0] >= 127)
@@ -928,10 +937,18 @@ x_to_emacs_keysym (XKeyPressedEvent *eve
fb_instream = make_fixed_buffer_input_stream (bufptr, len);
- /* #### Use get_coding_system_for_text_file (Vcomposed_input_coding_system, 0) */
+ /* [[ Use get_coding_system_for_text_file
+ (Vcomposed_input_coding_system, 0) ]]
+
+ Nope. If it is possible for the X libraries to have multiple IM
+ connections on different DISPLAYs active at once, this should be
+ a console-specific variable (like a TTY's coding system) but I've
+ seen no evidence that that is possible. Aidan Kehoe,
+ 2005-12-17. */
+
instream =
make_coding_input_stream
- (XLSTREAM (fb_instream), Qundecided, CODING_DECODE, 0);
+ (XLSTREAM (fb_instream), Qkeyboard, CODING_DECODE, 0);
istr = XLSTREAM (instream);
1.50 +8 -2 XEmacs/xemacs/src/file-coding.c
Index: file-coding.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/file-coding.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -p -r1.49 -r1.50
--- file-coding.c 2005/10/25 11:16:24 1.49
+++ file-coding.c 2005/12/17 19:47:03 1.50
@@ -4600,8 +4600,14 @@ vars_of_file_coding (void)
#endif
DEFVAR_LISP ("keyboard-coding-system", &Vkeyboard_coding_system /*
-Coding system used for TTY keyboard input.
-Not used under a windowing system.
+Default coding system used for TTY and X11 keyboard input.
+Under X11, used only to interpet the character for a key event when that
+event has a KeySym of NoSymbol but does have an associated string keysym,
+something that's seen with input methods.
+
+If you need to set these things to different coding systems, call the
+function `set-console-tty-coding-system' for the TTY and use this variable
+for X11.
*/ );
Vkeyboard_coding_system = Qnil;