emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] Add new keyword :coding for #+include directive


From: Pierre Téchoueyres
Subject: Re: [O] [PATCH] Add new keyword :coding for #+include directive
Date: Tue, 15 May 2018 01:44:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hello,
And sorry for the delay.


Nicolas Goaziou <address@hidden> writes:

> Hello,
>
> address@hidden (Pierre Téchoueyres) writes:
>
>> Hello Nicolas,
>> Did you have time to review the patches ?
>
> Sorry for the delay, I have been sidetracked.
>
> I admit I don't fully understand your bugfix patch, i.e., "[PATCH]
> Correctly convert encoding of included files".
>
> For the record, here is the change:
>
>    (with-temp-buffer
> -    (insert-file-contents file)
> +    (let ((org-buffer-coding-system buffer-file-coding-system))
> +      (insert-file-contents file)
> +      (unless (eq org-buffer-coding-system buffer-file-coding-system)
> +     (set-buffer-file-coding-system org-buffer-coding-system)))
>
>
> You pretend `org-buffer-coding-system' is storing coding-system from the
> Org buffer, but the let-binding happens from within `with-temp-buffer'.
> So the coding system comes from the temporary buffer instead. 

Yes, that's true, but the coding system of the temporary buffer is
inherited of the one of the org file (At least it's what I've found in
my tests). But my be should I add a comment to explain that.

>
> Also, `insert-file-contents' is not supposed to change coding system, or
> is it? So when would the `unless' be triggered?
>

For the tests I've made and the examples I had sent, it seem to change
the coding system.

> Could you explain a bit the issue you are fixing here?
>
> Thank you.
>
> Regards,

I hoped the example Ive had sent was clear enough.

I'm using org on an Windows machine where the default encoding seem to
be iso-latin-1-dos.
But I edit my org files in utf-8 encoding and of course I want to
include some files as source files for reference. Thoses files are
sometime encoded wit an different coding system (espetially cmd files
with comments in french : cp850).

I use principally those coding  ystems :
- cmd : cp850
- org : utf-8 or iso8859-15
- sql : window1252-dos

But when I include thoses files their content isn't correctly inserted,
especially the accents.
Hope I'me clearer now.


I reattach the examples, but note that  the cmd.txt or sh.txt extensions
are only there to avoid my mail to be wiped out.

Regards,

Attachment: test.org
Description: test.org

Attachment: file.cmd.txt
Description: file.cmd

Attachment: file.sh.txt
Description: file.sh


reply via email to

[Prev in Thread] Current Thread [Next in Thread]