From: Robin Hu <huxw@knight.6test.edu.cn>
Cc: emacs-devel@gnu.org
Subject: Re: Emacs failes to communicate with other X clients
Date: Mon, 26 May 2003 02:56:54 +0000 [thread overview]
Message-ID: <uznla2z61.fsf@knight.6test.edu.cn> (raw)
In-Reply-To: <7458-Sat24May2003203851+0300-eliz@elta.co.il> (Eli Zaretskii's message of "Sat, 24 May 2003 20:38:51 +0300")
[-- Attachment #1: Type: text/plain, Size: 1513 bytes --]
>>>>> "Eli" == Eli Zaretskii <eliz@elta.co.il> writes:
>> From: Robin Hu <huxw@knight.6test.edu.cn> Date: Sat, 24 May 2003
>> 11:10:06 +0000
>>
Eli> Sounds like a bug. Unfortunately, I don't know enough about
Eli> gbk to guess what might be wrong, and don't have time to debug
Eli> compound-text-with-extensions myself.
I'll try to clearify myself, and attachment is a dirty patch to
xselect.c, I also hope this can be any help out of my buggy english
;-(
My point is that compound-text decoding should be left to X itself,
rather then by emacs itself. It should be better be transparent to
emacs, for better portable and better extensible.
My patch implements this idea, it use XmbTextPropertyToTextList to
decode compound-text, then delegate the result to
selection_data_to_lisp_data, who will call decode_region with
chinese-gbk to translate gbk coding characters to emacs-mule. It
works fine for me these days.
But there is still some problems I am not so sure. First is that I
dont know whether this change of behavior will impact any other
packages exists. Second is that I still wonder if there are any
better places for this change.
Eli> Keyboard input is nowhere as transparent as you seem to think.
Eli> Emacs decodes keyboard input similarly to what it does with X
Eli> selections.
I mean decoding X selections should be seperated into 2 stages, then
compound text is transparent to emacs.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch to Xselect.c --]
[-- Type: text/x-patch, Size: 2193 bytes --]
--- xselect.c 2003-04-07 04:35:06.000000000 +0800
+++ /home/huxw/tmp_src/emacs/src/xselect.c 2003-05-26 10:29:46.641097720 +0800
@@ -1496,6 +1496,11 @@
Lisp_Object target_type; /* for error messages only */
Atom selection_atom; /* for error messages only */
{
+ // by huxw start here
+ XTextProperty text_prop;
+ char** local_list;
+ int local_number;
+ // by huxw end here
Atom actual_type;
int actual_format;
unsigned long actual_size;
@@ -1554,12 +1559,50 @@
/* It's been read. Now convert it to a lisp object in some semi-rational
manner. */
+ //by huxw start here
+ if (XSupportsLocale()) {
+ int local_status;
+
+ text_prop.value = (char*)data;
+ text_prop.encoding = actual_type;
+ text_prop.format = actual_format;
+ text_prop.nitems = actual_size;
+
+ local_status = XmbTextPropertyToTextList(display, &text_prop, &local_list, &local_number);
+ if (local_status < Success || !local_number || !*local_list ) {
+ printf("failed due to XmbTextPropertyToTextList\n");
+ printf("XNoMemory is %d, XLocaleNotSupported is %d, XConverterNotFound is %d\n", XNoMemory, XLocaleNotSupported, XConverterNotFound);
+ printf("status is %d, number is %d, \n", local_status, local_number );
+ } else {
+ printf("XmbTextPropertyToTextList successfullly\n");
+ xfree((char*)data);
+ printf("xfree data successfully\n");
+ data = strdup(*local_list);
+ printf("strdup data successfully, data is %s\n", (char*)data);
+ XFreeStringList(local_list);
+ printf("XFreeStringList successfully\n");
+ }
+ } else {
+ printf("no support this locale\n");
+ }
+ //by huxw end here
+
+#if 0
val = selection_data_to_lisp_data (display, data, bytes,
actual_type, actual_format);
+#else
+ val = selection_data_to_lisp_data (display, data, strlen(data), actual_type, actual_format);
+#endif
/* Use xfree, not XFree, because x_get_window_property
calls xmalloc itself. */
- xfree ((char *) data);
+
+ // by huxw start here
+// xfree ((char *) data);
+ printf("selection_data_to_lisp_data successfully\n");
+ free(data);
+ printf("free data successfully\n");
+ // by huxw end here
return val;
}
\f
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2003-05-26 2:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-23 9:19 Emacs failes to communicate with other X clients Robin Hu
2003-05-23 17:22 ` Eli Zaretskii
2003-05-24 11:10 ` Robin Hu
2003-05-24 17:38 ` Eli Zaretskii
2003-05-26 2:56 ` Robin Hu [this message]
2003-05-26 4:54 ` Kenichi Handa
2003-05-26 6:06 ` Robin Hu
2003-05-26 7:09 ` Kenichi Handa
2003-05-26 8:42 ` Robin Hu
2003-05-27 12:26 ` Kenichi Handa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=uznla2z61.fsf@knight.6test.edu.cn \
--to=huxw@knight.6test.edu.cn \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).