From: Dan Davison <dandavison7@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Vincent Beffara <vbeffara@ens-lyon.fr>, emacs-orgmode@gnu.org
Subject: Re: Babel, Python and UTF-8
Date: Thu, 02 Dec 2010 18:23:49 +0000 [thread overview]
Message-ID: <87oc94f2yy.fsf@gmail.com> (raw)
In-Reply-To: <87mxoo9r95.fsf@gmail.com> (Eric Schulte's message of "Thu, 02 Dec 2010 07:29:24 -0700")
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 2893 bytes --]
"Eric Schulte" <schulte.eric@gmail.com> writes:
> Hi,
>
> I've just pushed up a new prefix header argument.
"preamble" might be a better name? or "header"? prefix makes me think of
adding a string onto the front of a string[1]; preamble and header are
used by e.g. latex to refer to prelimary lines at the top of a file. For
obscure options like this it might be OK to use a longer name
(e.g. ":header-line"), especially now we have multiline header args
with #+header.
> This header argument
> only has meaning for python code blocks
but might in the future be used by others?
Dan
[1]: accurate i know, but many people won't think of a block as a
character string.
> (since it is tied into
> evaluation each language would have to handle it separately). This is
> only used during external evaluation (i.e. not when :session is
> specified) and the value of the :prefix argument is prepended to the
> temporary file evaluated by python.
>
> The following demonstrate its usage:
>
> ** Python requires a utf-8 coding prefix
> #+begin_src python :prefix # -*- coding: utf-8 -*- :return s
> s = "é"
> #+end_src
>
> #+results:
> : é
>
> #+begin_src python :prefix # -*- coding: utf-8 -*- :results output
> s = "é"
> print(s)
> #+end_src
>
> #+results:
> : é
>
> Best -- Eric
>
> Vincent Beffara <vbeffara@ens-lyon.fr> writes:
>
>> Hi,
>>
>>> I would suggest just trying it out first and seeing if you get an error
>>> without such a line.
>>
>> Well, I do, that's why I'm asking ;-)
>>
>>> Also, you could try adding the line to the beginning of your code
>>> block.
>>
>> I tried like this :
>>
>> #+begin_src python
>> # -*- coding: utf-8 -*-
>> s = "é"
>> #+end_src
>>
>> The error message tells me that the error happens on line 4, hence the
>> coding line ends up on line 3, and python only takes it into account if
>> it is one of the first two ... so it almost works, but it doesn't.
>>
>>> If there is definitely a problem please reply to this thread and we
>>> could easily add a header argument for this case, possibly named
>>> ":prefix" which could be used to specify such a code-block-prefix for
>>> code evaluation. This header argument could then be set globally or on
>>> the file, heading, or code block level.
>>
>> That would be fantastic ! (And possibly useful in other cases as well
>> ...)
>>
>> Thanks,
>>
>> /vincent
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2010-12-02 18:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-01 23:50 Babel, Python and UTF-8 Vincent Beffara
2010-12-02 1:18 ` Eric Schulte
2010-12-02 1:36 ` Vincent Beffara
2010-12-02 9:11 ` Sébastien Vauban
2010-12-02 19:34 ` Eric Schulte
2010-12-02 20:10 ` Sébastien Vauban
2010-12-03 10:27 ` Vincent Beffara
2010-12-03 11:27 ` Sébastien Vauban
2010-12-03 14:30 ` Eric Schulte
2010-12-03 15:43 ` Vincent Beffara
2010-12-05 15:30 ` Eric Schulte
2010-12-06 9:42 ` Dan Davison
2010-12-06 11:53 ` Eric S Fraga
2010-12-06 16:42 ` Thomas S. Dye
2010-12-06 18:07 ` Achim Gratz
2010-12-06 18:40 ` Thomas S. Dye
2010-12-06 18:23 ` Dan Davison
2010-12-02 14:29 ` Eric Schulte
2010-12-02 16:12 ` Vincent Beffara
2010-12-02 18:23 ` Dan Davison [this message]
2010-12-02 19:36 ` Eric Schulte
2010-12-02 20:05 ` Sébastien Vauban
2010-12-02 16:09 ` Sébastien Vauban
2010-12-02 16:44 ` Vincent Beffara
2010-12-03 14:56 ` Christopher Allan Webber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87oc94f2yy.fsf@gmail.com \
--to=dandavison7@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=schulte.eric@gmail.com \
--cc=vbeffara@ens-lyon.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.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).