This is the mail archive of the guile-emacs@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: New module (emacs io)


Kalle Olavi Niemitalo <tosi@ees2.oulu.fi> writes:

> Do you mean the default output port should be `emacs-port' in
> modules which use (emacs io), and stdout in others?  I don't know
> how that could be done.
> 
> In the current Guile Emacs, the (emacs io) module is loaded when
> it is first used, and at that moment the default ports change in
> all modules.  This is quite bad.  I see two ways around it:
> 
> a) Always load (emacs io), and do that as early as possible.
>    Then there won't be a sudden change later.
> 
> b) Do not change ports when loading (emacs io).  Anything that
>    wants to read or write through Emacs, must do something like:
> 
>      (use-modules (emacs io))
>      (with-output-to-port emacs-port
>        (lambda ()
>          (display "This goes to Emacs.")
> 	 (newline)))
> 
> Which alternative do you prefer?

I see.  a) is probably OK.

> > (I sometimes used display to the terminal for debugging...)
> 
> You could do that even if (emacs io) were always loaded:
> 
> (use-modules (emacs io))
> (with-output-to-port terminal-output-port
>   (lambda ()	
>     (let ((esc (string #\esc)))
>       (display (string-append esc "[32m"
>                               "This goes straight to the terminal."
> 	                      esc "[m")))))

Right.  And I guess I don't need that debugging any more.

> > We will turn this to the default some time later on.
> 
> I think it would be easier to do that now.

OK.  So, we have to think about the default behaviors now and
let the user notice that.  Could you document that?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]