emacs-diffs
[Top][All Lists]
Advanced

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

master 8e8d37aa32 1/2: Minor fixes to IM locale handling


From: Po Lu
Subject: master 8e8d37aa32 1/2: Minor fixes to IM locale handling
Date: Wed, 5 Oct 2022 22:58:54 -0400 (EDT)

branch: master
commit 8e8d37aa326870ebf0ff6c07b4e37ae6abcf79b6
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Minor fixes to IM locale handling
    
    * lisp/term/x-win.el (x-get-input-coding-system): Translate locales.
    * src/xterm.c (x_term_init): If the X library doesn't support
    the current locale, don't set up input methods.
---
 lisp/term/x-win.el | 2 +-
 src/xterm.c        | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 57c6b785e7..62684f52cc 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1623,7 +1623,7 @@ found."
   (if (equal x-locale "C")
       ;; Treat the C locale specially, as it means "ascii" under X.
       'ascii
-    (let ((locale (downcase x-locale)))
+    (let ((locale (locale-translate (downcase x-locale))))
       (or (locale-name-match locale locale-preferred-coding-systems)
          (when locale
            (if (string-match "\\.\\([^@]+\\)" locale)
diff --git a/src/xterm.c b/src/xterm.c
index f3bfae457b..37e7916486 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -29252,7 +29252,11 @@ x_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)
 #endif
 
 #ifdef HAVE_X_I18N
-  xim_initialize (dpyinfo, resource_name);
+  /* Avoid initializing input methods if the X library does not
+     support Emacs's locale.  When the current locale is not
+     supported, decoding input method strings becomes undefined.  */
+  if (!XSupportsLocale ())
+    xim_initialize (dpyinfo, resource_name);
 #endif
 
   xsettings_initialize (dpyinfo);



reply via email to

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