[O] [PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts
see attached patch. From 7037a45f3504a8d95019bd2b496a919081e85331 Mon Sep 17 00:00:00 2001 From: Suhail Shergill suhailsherg...@gmail.com Date: Sat, 23 Mar 2013 19:26:31 -0400 Subject: [PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts * lisp/ob.el (org-babel-temp-file): For remote hosts, modify the prefix and leave `temporary-file-directory' unchanged. The reason setting `temporary-file-directory' doesn't work here is because `make-temp-file' recursively calls itself (indirectly). Modifying `temporary-file-directly', affects the recursive calls as well, which results in a No such file file or directory error. The fix is to leave `temporary-file-directory' unaltered, for remote hosts, and instead modifying the 'prefix' argument to `make-temp-file' appropriately. TINYCHANGE --- lisp/ob.el | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/ob.el b/lisp/ob.el index 7245714..1493355 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -2547,14 +2547,17 @@ Emacs shutdown.)) Passes PREFIX and SUFFIX directly to `make-temp-file' with the value of `temporary-file-directory' temporarily set to the value of `org-babel-temporary-directory'. - (let ((temporary-file-directory - (if (file-remote-p default-directory) - (concat (file-remote-p default-directory) /tmp) + (if (file-remote-p default-directory) + (let ((prefix + (concat (file-remote-p default-directory) + (expand-file-name prefix temporary-file-directory +(make-temp-file prefix nil suffix)) +(let ((temporary-file-directory (or (and (boundp 'org-babel-temporary-directory) (file-exists-p org-babel-temporary-directory) org-babel-temporary-directory) - temporary-file-directory - (make-temp-file prefix nil suffix))) + temporary-file-directory))) + (make-temp-file prefix nil suffix (defun org-babel-remove-temporary-directory () Remove `org-babel-temporary-directory' on Emacs shutdown. -- 1.7.10.4 -- Suhail
Re: [O] org-html: subtree specific footnote references
Bastien b...@gnu.org writes: My view is that org-e-html.el should also make sure that we always have unique ids for all the footnotes of the current files, even when we export only part of it. This is not a trivial change though, because org-export.el has to change the way it retrieves the footnote number. Can you have a look at this? sure -- Suhail
Re: [O] org-html: subtree specific footnote references
Jambunathan K kjambunat...@gmail.com writes: Suhail Shergill suhailsherg...@gmail.com writes: i'm talking about a scenario where for one reason or another you may not want to do that, but may instead only want to export the most recent subtree which has been added (since the last time it was exported). You are trying to merge two /instances of export command/ and not two /instances of subtrees/. It only so happens that, in your specific case, you are selecting different subtrees for different export instances. yes What is the value of `org-footnote-section' in your case? the string Footnotes Wrt footnotes, what you see in the Org file is not what the exporter sees. Footnote definitions get collected in to the buffer at a suitable point as part of pre-processing (see `org-footnote-normalize'). Also footnote definitions can be placed by hand at arbitrary points through out your Org file. hmm right. I have a feeling that patch requires more additions. you're probably right. Furthermore, you also need to submit a patch to org-e-html.el which will replace org-html.el in the future. I will let the owners of org-html.el to take over from here. *if* this patch makes sense, i'm willing to submit a patch for org-e-html.el. does anyone have any views? does this patch 'make sense', and is this the right place for it? -- Suhail
Re: [O] org-html: subtree specific footnote references
Jambunathan K kjambunat...@gmail.com writes: running org-export-as-html on a subtree is currently problematic if the result is to be merged into a document which contains html-ized versions of other subtrees: the footnote references and definitions get clobbered. Do the subtrees come from the same org file? that is the use case, yes. Won't it look odd and confusing to a reader, when there are two different footnote definitions with the same number. yes i agree that would be very confusing. but why, pray tell, would there be two different definitions with the same number? Confusion is like to be pronounced, if the reader chooses to also print out the document as a pdf or into paper. again, i'm not sure what scenario you're describing. i was only describing a scenario where the patch is useful. allow me to try again. with the current patch, if the user selects the entire org file and exports it, there will only be *one* footnotes section, albeit the footnote references and definitions (which aren't visible unless someone inspects the source) will be annotated with the CUSTOM_ID property value should it be defined. the *only* behavioural change that this effects is that the links (and backlinks from the definitions to references) will continue to work properly even in the event the user decides to merge the result of multiple subtree exports into one single document. now whether or not someone wants to do that, is up to them, but this (the patch in question) at least makes the links more robust. -- Suhail
Re: [O] org-html: subtree specific footnote references
Jambunathan K kjambunat...@gmail.com writes: Suhail Shergill suhailsherg...@gmail.com writes: Jambunathan K kjambunat...@gmail.com writes: running org-export-as-html on a subtree is currently problematic if the result is to be merged into a document which contains html-ized versions of other subtrees: the footnote references and definitions get clobbered. Do the subtrees come from the same org file? that is the use case, yes. Try marking the subtrees with :export: tag. Lookup the following in the mailing list, worg or the info manual. #+EXPORT_SELECT_TAGS: Tags that select a tree for export #+EXPORT_EXCLUDE_TAGS: Tags that exclude a tree from export With this, do footnotes come out along the expected lines? *if* you were to generate the entire file again, things will be fine yes. i'm talking about a scenario where for one reason or another you may not want to do that, but may instead only want to export the most recent subtree which has been added (since the last time it was exported). earlier when you tried to do that, the footnote links would no longer work because of name attribute collisions. this patch provides a way to prevent that. Won't it look odd and confusing to a reader, when there are two different footnote definitions with the same number. yes i agree that would be very confusing. but why, pray tell, would there be two different definitions with the same number? ayou haven't modified the description have you?/a no, i haven't. also, you could look at the patch. the code is pretty self-explanatory. Confusion is like to be pronounced, if the reader chooses to also print out the document as a pdf or into paper. the *only* behavioural change that this effects is that the links (and backlinks from the definitions to references) will continue to work properly even in the event the user decides to merge the result of multiple subtree exports into one single document. Links are visible when stuff is printed out on paper. Is it? not sure what you mean by this. are links visible when you print them? yes, unless you're using invisible ink. the patch (if you cared to look) modifies the name attribute of the a tags in question (footnote definition and footnote references). the text within the a tag (the bit that is actually rendered on screen/print) is unchanged. -- Suhail
[O] org-html: subtree specific footnote references
running org-export-as-html on a subtree is currently problematic if the result is to be merged into a document which contains html-ized versions of other subtrees: the footnote references and definitions get clobbered. this patch uses the CUSTOM_ID property of the subtree to generate unique footnote references and definitions. if the subtree does not have the CUSTOM_ID property set the result is a nop. From 27f89f8bfff334810aba5c33af621e351fa0be79 Mon Sep 17 00:00:00 2001 From: Suhail Shergill suhailsherg...@gmail.com Date: Sun, 8 Apr 2012 10:49:51 -0400 Subject: [PATCH] org-html.el: Make footnotes unique to an entry * lisp/org-html.el (org-export-as-html): Assign unique ids to footnotes if possible If the entry (or its ancestor) has the CUSTOM_ID property defined, then use that as part of the generated footnote references and definitions. --- lisp/org-html.el | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index c9c9d78..8b79c39 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1248,6 +1248,9 @@ PUB-DIR is set, use this as the publishing directory. (org-export-have-math nil) (org-export-footnotes-seen nil) (org-export-footnotes-data (org-footnote-all-labels 'with-defs)) + (custom-id (or (org-entry-get nil CUSTOM_ID t) )) + (footnote-def-prefix (format fn-%s custom-id)) + (footnote-ref-prefix (format fnr-%s custom-id)) (lines (org-split-string (org-export-preprocess-string @@ -1685,8 +1688,8 @@ PUB-DIR is set, use this as the publishing directory. (format (concat %s (format org-export-html-footnote-format - (concat a class=\footref\ name=\fnr.%s%s\ href=\#fn.%s\%s/a))) - (or (match-string 1 org-line) ) n extra n n) + (concat a class=\footref\ name=\ footnote-ref-prefix .%s%s\ href=\# footnote-def-prefix .%s\%s/a))) + (or (match-string 1 line) ) n extra n n) ;; If another footnote is following the ;; current one, add a separator. (if (save-match-data @@ -1773,8 +1776,9 @@ PUB-DIR is set, use this as the publishing directory. (format (concat p class=\footnote\ (format org-export-html-footnote-format - a class=\footnum\ name=\fn.%s\ href=\#fnr.%s\%s/a)) - n n n) t t org-line) + (concat + a class=\footnum\ name=\ footnote-def-prefix .%s\ href=\# footnote-ref-prefix .%s\%s/a))) + n n n) t t line) ;; Check if the line break needs to be conserved (cond ((string-match [ \t]*$ org-line) -- 1.7.10 -- Suhail
Re: [O] org-html: subtree specific footnote references
oops. attached the wrong patch. amended patch follows. From b9192f5e9a3bbe9620d9f588313d7f62e33135a5 Mon Sep 17 00:00:00 2001 From: Suhail Shergill suhailsherg...@gmail.com Date: Sun, 8 Apr 2012 10:49:51 -0400 Subject: [PATCH] org-html.el: Make footnotes unique to an entry * lisp/org-html.el (org-export-as-html): Assign unique ids to footnotes if possible If the entry (or its ancestor) has the CUSTOM_ID property defined, then use that as part of the generated footnote references and definitions. --- lisp/org-html.el |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index c9c9d78..b9123a1 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1248,6 +1248,9 @@ PUB-DIR is set, use this as the publishing directory. (org-export-have-math nil) (org-export-footnotes-seen nil) (org-export-footnotes-data (org-footnote-all-labels 'with-defs)) + (custom-id (or (org-entry-get nil CUSTOM_ID t) )) + (footnote-def-prefix (format fn-%s custom-id)) + (footnote-ref-prefix (format fnr-%s custom-id)) (lines (org-split-string (org-export-preprocess-string @@ -1685,7 +1688,7 @@ PUB-DIR is set, use this as the publishing directory. (format (concat %s (format org-export-html-footnote-format - (concat a class=\footref\ name=\fnr.%s%s\ href=\#fn.%s\%s/a))) + (concat a class=\footref\ name=\ footnote-ref-prefix .%s%s\ href=\# footnote-def-prefix .%s\%s/a))) (or (match-string 1 org-line) ) n extra n n) ;; If another footnote is following the ;; current one, add a separator. @@ -1773,7 +1776,8 @@ PUB-DIR is set, use this as the publishing directory. (format (concat p class=\footnote\ (format org-export-html-footnote-format - a class=\footnum\ name=\fn.%s\ href=\#fnr.%s\%s/a)) + (concat + a class=\footnum\ name=\ footnote-def-prefix .%s\ href=\# footnote-ref-prefix .%s\%s/a))) n n n) t t org-line) ;; Check if the line break needs to be conserved (cond -- 1.7.10 Suhail Shergill suhailsherg...@gmail.com writes: running org-export-as-html on a subtree is currently problematic if the result is to be merged into a document which contains html-ized versions of other subtrees: the footnote references and definitions get clobbered. this patch uses the CUSTOM_ID property of the subtree to generate unique footnote references and definitions. if the subtree does not have the CUSTOM_ID property set the result is a nop. From 27f89f8bfff334810aba5c33af621e351fa0be79 Mon Sep 17 00:00:00 2001 From: Suhail Shergill suhailsherg...@gmail.com Date: Sun, 8 Apr 2012 10:49:51 -0400 Subject: [PATCH] org-html.el: Make footnotes unique to an entry * lisp/org-html.el (org-export-as-html): Assign unique ids to footnotes if possible If the entry (or its ancestor) has the CUSTOM_ID property defined, then use that as part of the generated footnote references and definitions. --- lisp/org-html.el | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index c9c9d78..8b79c39 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1248,6 +1248,9 @@ PUB-DIR is set, use this as the publishing directory. (org-export-have-math nil) (org-export-footnotes-seen nil) (org-export-footnotes-data (org-footnote-all-labels 'with-defs)) + (custom-id (or (org-entry-get nil CUSTOM_ID t) )) + (footnote-def-prefix (format fn-%s custom-id)) + (footnote-ref-prefix (format fnr-%s custom-id)) (lines (org-split-string (org-export-preprocess-string @@ -1685,8 +1688,8 @@ PUB-DIR is set, use this as the publishing directory. (format (concat %s (format org-export-html-footnote-format -(concat a class=\footref\ name=\fnr.%s%s\ href=\#fn.%s\%s/a))) -(or (match-string 1 org-line) ) n extra n n) +(concat a class=\footref\ name=\ footnote-ref-prefix .%s%s\ href=\# footnote-def-prefix .%s\%s/a))) +(or (match-string 1 line) ) n extra n n) ;; If another footnote is following the ;; current one, add a separator. (if (save-match-data @@ -1773,8 +1776,9 @@ PUB-DIR is set, use this as the publishing directory. (format (concat p class=\footnote\ (format org-export-html-footnote-format -a class=\footnum\ name=\fn.%s\ href=\#fnr.%s\%s/a)) -n n n) t t org-line) +(concat