public inbox for guile-emacs@sourceware.org
 help / color / mirror / Atom feed
* New module (emacs io)
@ 2000-03-23  2:08 Kalle Olavi Niemitalo
  2000-03-26 11:07 ` Keisuke Nishida
  0 siblings, 1 reply; 4+ messages in thread
From: Kalle Olavi Niemitalo @ 2000-03-23  2:08 UTC (permalink / raw)
  To: guile-emacs

I have added a new module, (emacs io).  It redirects Scheme
input and output ports to Emacs functions so that
with-output-to-temp-buffer affects (display ...) too.
I think this redirection should be the default for Emacs Scheme.

In the current version, just loading the module redirects the
ports.  Should the module instead export a procedure which does
the redirection when it is called?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: New module (emacs io)
  2000-03-23  2:08 New module (emacs io) Kalle Olavi Niemitalo
@ 2000-03-26 11:07 ` Keisuke Nishida
  2000-03-27  9:08   ` Kalle Olavi Niemitalo
  0 siblings, 1 reply; 4+ messages in thread
From: Keisuke Nishida @ 2000-03-26 11:07 UTC (permalink / raw)
  To: guile-emacs

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

> I have added a new module, (emacs io).  It redirects Scheme
> input and output ports to Emacs functions so that
> with-output-to-temp-buffer affects (display ...) too.
> I think this redirection should be the default for Emacs Scheme.

Sounds good.

> In the current version, just loading the module redirects the
> ports.  Should the module instead export a procedure which does
> the redirection when it is called?

I think it is not necessary but this module should be optional;
the user should be able to choose whether or not to use it.
(I sometimes used display to the terminal for debugging...)
We will turn this to the default some time later on.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: New module (emacs io)
  2000-03-26 11:07 ` Keisuke Nishida
@ 2000-03-27  9:08   ` Kalle Olavi Niemitalo
  2000-03-27 17:48     ` Keisuke Nishida
  0 siblings, 1 reply; 4+ messages in thread
From: Kalle Olavi Niemitalo @ 2000-03-27  9:08 UTC (permalink / raw)
  To: Keisuke Nishida; +Cc: guile-emacs

Keisuke Nishida <kxn30@po.cwru.edu> writes:

> I think it is not necessary but this module should be optional;
> the user should be able to choose whether or not to use it.

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 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")))))

> We will turn this to the default some time later on.

I think it would be easier to do that now.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: New module (emacs io)
  2000-03-27  9:08   ` Kalle Olavi Niemitalo
@ 2000-03-27 17:48     ` Keisuke Nishida
  0 siblings, 0 replies; 4+ messages in thread
From: Keisuke Nishida @ 2000-03-27 17:48 UTC (permalink / raw)
  To: Kalle Olavi Niemitalo; +Cc: guile-emacs

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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-03-27 17:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-23  2:08 New module (emacs io) Kalle Olavi Niemitalo
2000-03-26 11:07 ` Keisuke Nishida
2000-03-27  9:08   ` Kalle Olavi Niemitalo
2000-03-27 17:48     ` Keisuke Nishida

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).