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: [HELP] (bug?) Saving a buffer without any conversion? Date: Fri, 17 Jan 2003 20:07:36 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200301171107.UAA13147@etlken.m17n.org> References: <87fzrxszs8.fsf@lexx.delysid.org> <200301150116.KAA09223@etlken.m17n.org> <5xk7h67k1b.fsf@kfs2.cua.dk> <200301151059.TAA09873@etlken.m17n.org> <5xbs2i7dc4.fsf@kfs2.cua.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1042801862 25908 80.91.224.249 (17 Jan 2003 11:11:02 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 17 Jan 2003 11:11:02 +0000 (UTC) Cc: storm@cua.dk Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18ZUOp-0006jQ-00 for ; Fri, 17 Jan 2003 12:10:59 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18ZUYD-0004Nh-00 for ; Fri, 17 Jan 2003 12:20:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18ZUOS-0005CK-05 for emacs-devel@quimby.gnus.org; Fri, 17 Jan 2003 06:10:36 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18ZUNd-00044f-00 for emacs-devel@gnu.org; Fri, 17 Jan 2003 06:09:45 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18ZULl-0002L9-00 for emacs-devel@gnu.org; Fri, 17 Jan 2003 06:07:56 -0500 Original-Received: from tsukuba.m17n.org ([192.47.44.130]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18ZULa-00024f-00; Fri, 17 Jan 2003 06:07:39 -0500 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2])h0HB7ak04282; Fri, 17 Jan 2003 20:07:36 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) h0HB7aR19441; Fri, 17 Jan 2003 20:07:36 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id UAA13147; Fri, 17 Jan 2003 20:07:36 +0900 (JST) Original-To: rms@gnu.org In-reply-to: (message from Richard Stallman on Fri, 17 Jan 2003 04:23:07 -0500) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) Original-cc: emacs-devel@gnu.org Original-cc: mlang@delysid.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:10800 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10800 In article , Richard Stallman writes: > If the process' input coding system is no-conversion or raw-text, the > string argument to the filter function is a unibyte string; otherwise > it is a multibyte string. Use `string-as-multibyte' on a unibyte > string before inserting it in a multibyte buffer. > You might or might no want to use string-as-multibyte, depending > on what results you want to get. Right. > In any case, I have just confirmed that if you DON'T use a filter > function, but rather relies on emacs itself to insert received data > into the buffer, it works nicely even with a multibyte buffer. > Does that mean it does the equivalent of using string-as-multibyte? Yes. This is the relevant code (in read_process_output). /* Adjust the multibyteness of TEXT to that of the buffer. */ if (NILP (current_buffer->enable_multibyte_characters) != ! STRING_MULTIBYTE (text)) text = (STRING_MULTIBYTE (text) ? Fstring_as_unibyte (text) : Fstring_as_multibyte (text)); nbytes = SBYTES (text); nchars = SCHARS (text); /* Insert before markers in case we are inserting where the buffer's mark is, and the user's next command is Meta-y. */ insert_from_string_before_markers (text, 0, 0, nchars, nbytes, 0); --- Ken'ichi HANDA handa@m17n.org