From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: Unicode support for the MS Windows clipboard Date: Thu, 3 Jun 2004 22:21:41 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200406031321.WAA26421@etlken.m17n.org> References: <9681-Thu27May2004100522+0300-eliz@gnu.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1086268952 30519 80.91.224.253 (3 Jun 2004 13:22:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 3 Jun 2004 13:22:32 +0000 (UTC) Cc: eliz@gnu.org, jasonr@gnu.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Jun 03 15:22:16 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BVsAi-0008OR-00 for ; Thu, 03 Jun 2004 15:22:16 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BVsAh-0008SC-00 for ; Thu, 03 Jun 2004 15:22:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BVsB2-0001Z6-Ge for emacs-devel@quimby.gnus.org; Thu, 03 Jun 2004 09:22:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BVsAt-0001Z1-O4 for emacs-devel@gnu.org; Thu, 03 Jun 2004 09:22:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BVsAs-0001YV-CA for emacs-devel@gnu.org; Thu, 03 Jun 2004 09:22:27 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BVsAs-0001YL-4s for emacs-devel@gnu.org; Thu, 03 Jun 2004 09:22:26 -0400 Original-Received: from [192.47.44.130] (helo=tsukuba.m17n.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BVsAJ-00024l-O4; Thu, 03 Jun 2004 09:21:52 -0400 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2]) by tsukuba.m17n.org (8.11.6p2/8.11.6) with ESMTP id i53DLhQ00941; Thu, 3 Jun 2004 22:21:43 +0900 (JST) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) by fs.m17n.org (8.11.6p2/8.11.6) with ESMTP id i53DLfW23112; Thu, 3 Jun 2004 22:21:41 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id WAA26421; Thu, 3 Jun 2004 22:21:41 +0900 (JST) Original-To: Benjamin.Riefenstahl@epost.de In-reply-to: (message from Benjamin Riefenstahl on Thu, 03 Jun 2004 11:17:29 +0200) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:24473 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:24473 In article , Benjamin Riefenstahl writes: > The C code constructs it's own cpXXXX-dos coding system > names in one place. I would like to check that the > constructed coding system actually exists, but I don't > know how yet. > I didn't worry about the console encoding (CF_OEMTEXT) too > much, but I added support for it, where it seemed > straight-forward to me. > I get the feeling that the C code does too much, and that > it should delegate major parts of the processing to Lisp. > I am not yet sure how to structure that, though. As I've never read w32select.c, the following may be out of point, but I'll briefly explain how X selection is handled. All decoding and encoding of X selection is done in select.el. For reading a selection data: The entry point is x-get-selection. It calls x-get-selection-internal of xselect.c. It at first tries to get a locale selection value (i.e. Emacs is the owner of the selection) by calling x_get_local_selection with `local_request' 1.. If that fails, it tries to get a selection from some other client by x_get_foreign_selection. This function receives a selection data and convert it to a Lispy data via selection_data_to_lisp_data. This function generate a unibyte string and put `foreign-selection' property on it. After a string is returned to x-get-selection, it checks `foreign-selection' property and if it is on, decode the unibyte string according to data-type and selection-coding-system. For sending a selection data: The entry point is x_handle_selection_request of xselect.c which is called from swallow_events of keyboard.c when Emacs gets SELECTION_REQUEST_EVENT. x_handle_selection_request calls x_get_local_selection too but with `local_request' 0. If Emacs owns a selection data, it calls one of Lisp handler registered in selection-converter-alist. Typical case is xselect-convert-to-string of select.el called with TYPE non-nil. This function does all encoding work (if TYPE is non-nil) and return an encoded unibyte string. --- Ken'ichi HANDA handa@m17n.org