propagating a coding setting across source files
Hi all. After a long period of working with other Schemes, I am returning to guile for some tests to see what Guile has achieved in recent years. My test program is made up of around 100 scheme files, all encoded in latin-1. I added to the master file the following comment: ; coding: iso-8859-1 which works as documented. How can I avoid to add this comment line to all the other files which are currently included by the master file using "load"? Ciao Sven
Re: propagating a coding setting across source files
-[ Fri, Dec 02, 2011 at 09:06:07AM +0100, Sven Hartrumpf ] > How can I avoid to add this comment line to all the other files > which are currently included by the master file using "load"? You very possibly have better reasons to refuse to add this line to your files than the mere trouble of the trouble doing it by hand, but anyway just in case you need a command to do this operation here it is: $ find where-your-files-are -type f -name '*.scm' | while read f; do echo '; coding: iso-8859-1' > $f ; done Although it may be shorter in scheme...
Re: propagating a coding setting across source files
On Fri, 2011-12-02 at 11:41 +0100, ri...@happyleptic.org wrote: > $ find where-your-files-are -type f -name '*.scm' | > while read f; do echo '; coding: iso-8859-1' > $f ; done Boy I _really_ don't think you want to do that. -- --- Paul D. Smith Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.net "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
Re: propagating a coding setting across source files
-[ Fri, Dec 02, 2011 at 07:41:40AM -0500, Paul Smith ] > On Fri, 2011-12-02 at 11:41 +0100, ri...@happyleptic.org wrote: > > $ find where-your-files-are -type f -name '*.scm' | > > while read f; do echo '; coding: iso-8859-1' > $f ; done > > Boy I _really_ don't think you want to do that. Sure! That's ">>" not ">" : echo '; coding...' >> $f ^^ !! I _really_ hope every one is using a versionning system these days :)
Re: propagating a coding setting across source files
> From: Sven Hartrumpf >My test program is made up of around 100 scheme files, all >encoded in latin-1. >I added to the master file the following comment: > >; coding: iso-8859-1 > >which works as documented. >How can I avoid to add this comment line to all the other files >which are currently included by the master file using "load"? I'm pretty sure that, for 2.0.x at least, if you don't specify an encoding, it presumes iso-8859-1 as the default. -Mike
Re: propagating a coding setting across source files
Fri, 2 Dec 2011 04:55:39 -0800 (PST), spk121 wrote: > I'm pretty sure that, for 2.0.x at least, if you don't > specify an encoding, it presumes iso-8859-1 as the default. Not when loading a file with Latin-1 characters: > cat aa.scm (define c #\ä) > guile GNU Guile 2.0.3 ... scheme@(guile-user)> (load "aa.scm") ;;; compiling /home/s/aa.scm ;;; WARNING: compilation of /home/s/aa.scm failed: ;;; ERROR: In procedure scm_lreadr: /home/s/aa.scm:1:13: unknown character name ERROR: In procedure primitive-load: ERROR: In procedure scm_lreadr: /home/s/aa.scm:1:13: unknown character name Sven
Re: propagating a coding setting across source files
>Not when loading a file with Latin-1 characters: > >> cat aa.scm >(define c #\ä) > >> guile >GNU Guile 2.0.3 >... >scheme@(guile-user)> (load "aa.scm") >;;; compiling /home/s/aa.scm >;;; WARNING: compilation of /home/s/aa.scm failed: >;;; ERROR: In procedure scm_lreadr: /home/s/aa.scm:1:13: unknown character >name >ERROR: In procedure primitive-load: >ERROR: In procedure scm_lreadr: /home/s/aa.scm:1:13: unknown character name I guess you're right. Looks like, at some point, the default for files with no 'coding:' line got hard set to UTF-8 in 'scm_primitive_load' and 'compile-file' and friends. At first, I thought you could do something with %load-hook, or by setting the %default-port-encoding, but that isn't going to work either. No workaround is obvious to me. Hrm. Unfortunate. -Mike