Next: , Up: Configuring Guile for Guile-CV   [Contents][Index]


2.1.1 Configuring Guile’s repl-print procedure

Guile’s repl-print procedure calls (write val), which is inadequate for images, even very small images4. Fortunately, Guile provides us both a simple mechanism to alter the default repl printer and the alternate repl printer procedure we need: truncated-print.

To modify the default repl printer, you have to modify your $HOME/.guile or, if you are working in a multi-user environmet, you may choose to add (or modify if it exists) the file named init.scm in the so-called Guile global site directory5, here (evaluate the following expression in a terminal): guile -c "(display (%global-site-dir))(newline)".

Which ever solution you choose, add the following lines:

(use-modules (ice-9 pretty-print)
             (system repl common))

(repl-default-option-set! 'print
                          (lambda (repl obj)
                            (truncated-print obj) (newline)))

Footnotes

(4)

Even for very small images, using write is inadequate, in a terminal, and will definitely kill your Emacs/Geiser session. Not to mention it will raise your electricity bill :) - till you succeed to delete its process, Emacs will use one core at more then 100%, desperately trying to display hundreds of thousands of floating point values, heating your laptop (if you have a laptop) up to the point you’ll be able to cook an egg on it, and get its fans crasy... You’ve been warned :).

(5)

You need write privileges to add or modify this file, contact your system administrator if you’re not in charge of the system you are working on.