help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Replacement for string-as-unibyte-function


From: Joe Riel
Subject: Re: Replacement for string-as-unibyte-function
Date: Mon, 1 Feb 2021 08:33:52 -0800

On Mon, 01 Feb 2021 16:53:32 +0200
Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Sun, 31 Jan 2021 21:55:55 -0800
> > From: Joe Riel <joer@san.rr.com>
> > Cc: help-gnu-emacs@gnu.org
> >   
> > >     (set-process-coding-system <proc> 'binary)
> > > 
> > > (which you can also set directly when you launch the process, but how
> > > you do it depends on the function you use to create the process).  
> > 
> > I'm actually using make-network-process (to communicate via tls).    
> 
> make-network-process accepts the :coding attribute, which you could
> use instead of what Stefan suggests above.
> 
> > I tried using (set-buffer-multibyte nil) and (insert string), 
> > but that doesn't work.  
> 
> Please show how you tried that.  The effect could depend on the
> details and the timing of that call.
> 

I'm using the :filter option, not the :buffer option, in make-network-process.

 (make-network-process
                  :name "mds"
                  :family 'ipv4
                  :service mds-port
                  :sentinel 'mds-sentinel
                  :filter 'mds-filter
                  :server 't)

That is done because the server handles multiple clients, so the filter
function routes the data to the appropriate buffer.  It isn't clear to
me whether using :coding then has an effect; I haven't seen it.

I tried setting up each client buffer with

    (with-current-buffer buf (set-buffer-multibyte nil))

and, in the filter function, just calling

    (insert string)

but, as mentioned that doesn't do the same as skipping the call to 
set-buffer-multibyte
and doing

   (insert (encode-coding-string string 'utf-8-unix))


-- 
Joe Riel




reply via email to

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