Jack Kamm <[email protected]> writes:

>> Just two comments from me:
>> 1. That code inside a string is getting very long. It may be a time for
>>    us to move it into a separate .py file for easier editing. Jack, WDYT?
>
> Yes I think that would be good.
>
> Where should the .py file go? Maybe under etc or a subfolder thereof?

/etc sounds reasonable.
I am adding Kyle to the discussion.
Kyle, on Emacs repository side, we have /etc/org/. Do you think it will
be OK to put a .py file in there?

> Also I'm not sure yet how to get the path and/or contents of the .py
> file into an elisp variable...the couple ideas that come to mind are:
>
> 1. Use a relative path from `load-file-name' from within
>    ob-python.el. We can then import or source this path from the Python
>    side. But this assumes the .py file will also get installed with the
>    elisp files which I am not sure is a good assumption.
>
> 2. Generate a elisp file by copying the Python file into a string in
>    it. The elisp file would need to be regenerated whenever the Python
>    file was updated. It would just contain a single defconst string
>    containing the contents of the .py file. When ob-python.el runs, it
>    would create a new tmpfile containing this string which would be
>    sourced from the Python shell.

I think (1) is reasonable, because it is something we already do in
ox-odt:

(defconst org-odt-lib-dir
  (file-name-directory (or load-file-name (buffer-file-name)))
  "Location of ODT exporter.
Use this to infer values of `org-odt-styles-dir' and
`org-odt-schema-dir'.")

(defvar org-odt-data-dir (expand-file-name "../../etc/" org-odt-lib-dir)
  "Data directory for ODT exporter.
Use this to infer values of `org-odt-styles-dir' and
`org-odt-schema-dir'.")

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to