unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* decoding error
@ 2015-06-16 10:03 Federico Beffa
  2015-06-16 10:07 ` Ricardo Wurmus
  2015-06-16 11:20 ` Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: Federico Beffa @ 2015-06-16 10:03 UTC (permalink / raw)
  To: Guix-devel

Hi,

in a package for AUCTeX that I'm preparing, I'm trying to replace any
reference to '/bin/sh' in '.el' files with

(with-directory-excursion el-dir
      (substitute* (find-files "." "\\.el$") (("/bin/sh") (which "sh"))))

A particular file causes Guile to produce the following error:

ice-9/boot-9.scm:106:20: Throw to key `decoding-error' with args
`("scm_getc" "input decoding error" 84 #<input: ./font-latex.el 11>)'.

This appears to be due to the following characters: "«" "»". The build
environment includes (by default):

export LC_ALL="en_US.UTF-8"
export LOCPATH="/gnu/store/...-glibc-utf8-locales-2.21/lib/locale"

Emacs says that the file is encoded with iso-8859-1-unix, so I've
tried unsetting the above two variables or setting '(setenv "LC_ALL"
"C")' or '(setlocale LC_ALL "C")' with no effect.

Any suggestion?

Thanks,
Fede

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

* Re: decoding error
  2015-06-16 10:03 decoding error Federico Beffa
@ 2015-06-16 10:07 ` Ricardo Wurmus
  2015-06-16 11:20   ` Federico Beffa
  2015-06-16 11:20 ` Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Ricardo Wurmus @ 2015-06-16 10:07 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

> in a package for AUCTeX that I'm preparing, I'm trying to replace any
> reference to '/bin/sh' in '.el' files with
>
> (with-directory-excursion el-dir
>       (substitute* (find-files "." "\\.el$") (("/bin/sh") (which "sh"))))
>
> A particular file causes Guile to produce the following error:
>
> ice-9/boot-9.scm:106:20: Throw to key `decoding-error' with args
> `("scm_getc" "input decoding error" 84 #<input: ./font-latex.el 11>)'.

How about this:

(with-directory-excursion el-dir
  (with-fluids ((%default-port-encoding #f))
    (substitute* (find-files "." "\\.el$") (("/bin/sh") (which "sh")))))

~~ Ricardo

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

* Re: decoding error
  2015-06-16 10:07 ` Ricardo Wurmus
@ 2015-06-16 11:20   ` Federico Beffa
  0 siblings, 0 replies; 7+ messages in thread
From: Federico Beffa @ 2015-06-16 11:20 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix-devel

On Tue, Jun 16, 2015 at 12:07 PM, Ricardo Wurmus
<ricardo.wurmus@mdc-berlin.de> wrote:
> How about this:
>
> (with-directory-excursion el-dir
>   (with-fluids ((%default-port-encoding #f))
>     (substitute* (find-files "." "\\.el$") (("/bin/sh") (which "sh")))))

That did the trick.

Thanks!
Fede

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

* Re: decoding error
  2015-06-16 10:03 decoding error Federico Beffa
  2015-06-16 10:07 ` Ricardo Wurmus
@ 2015-06-16 11:20 ` Ludovic Courtès
  2015-06-16 16:12   ` Federico Beffa
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2015-06-16 11:20 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Federico Beffa <beffa@ieee.org> skribis:

> Emacs says that the file is encoded with iso-8859-1-unix

In that case the solution is to tell Guile to use ISO-8859-1 as the
default encoding where you fiddle with that file:

  (paramaterize ((%default-port-encoding "ISO-8859-1"))
    (substitute* ...))

(This is equivalent to what Ricardo suggested, but making the encoding
name explicit is clearer in this case.)

Ludo’.

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

* Re: decoding error
  2015-06-16 11:20 ` Ludovic Courtès
@ 2015-06-16 16:12   ` Federico Beffa
  2015-06-17  8:09     ` Federico Beffa
  0 siblings, 1 reply; 7+ messages in thread
From: Federico Beffa @ 2015-06-16 16:12 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

On Tue, Jun 16, 2015 at 1:20 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>   (paramaterize ((%default-port-encoding "ISO-8859-1"))
>     (substitute* ...))
>
> (This is equivalent to what Ricardo suggested, but making the encoding
> name explicit is clearer in this case.)

Agreed,
Thanks!

Fede

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

* Re: decoding error
  2015-06-16 16:12   ` Federico Beffa
@ 2015-06-17  8:09     ` Federico Beffa
  2015-06-17 19:39       ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Federico Beffa @ 2015-06-17  8:09 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

On Tue, Jun 16, 2015 at 6:12 PM, Federico Beffa <beffa@ieee.org> wrote:
> On Tue, Jun 16, 2015 at 1:20 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>>   (paramaterize ((%default-port-encoding "ISO-8859-1"))
>>     (substitute* ...))

By the way, '%default-port-encoding' is a fluid and therefore, if I
use 'parameterize' instead of 'with-fluids', I get an error.

Regards,
Fede

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

* Re: decoding error
  2015-06-17  8:09     ` Federico Beffa
@ 2015-06-17 19:39       ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2015-06-17 19:39 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Federico Beffa <beffa@ieee.org> skribis:

> On Tue, Jun 16, 2015 at 6:12 PM, Federico Beffa <beffa@ieee.org> wrote:
>> On Tue, Jun 16, 2015 at 1:20 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>>>   (paramaterize ((%default-port-encoding "ISO-8859-1"))
>>>     (substitute* ...))
>
> By the way, '%default-port-encoding' is a fluid and therefore, if I
> use 'parameterize' instead of 'with-fluids', I get an error.

Indeed, sorry for the confusion.

Ludo’.

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

end of thread, other threads:[~2015-06-17 19:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-16 10:03 decoding error Federico Beffa
2015-06-16 10:07 ` Ricardo Wurmus
2015-06-16 11:20   ` Federico Beffa
2015-06-16 11:20 ` Ludovic Courtès
2015-06-16 16:12   ` Federico Beffa
2015-06-17  8:09     ` Federico Beffa
2015-06-17 19:39       ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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