Re: [O] Bug: regression with :export both :noweb strip-export [9.2 (9.2-elpa @ /home/adl/.emacs.d/elpa/org-20181230/)]

2019-01-19 Thread Nicolas Goaziou
Hello,

Alexandre Duret-Lutz  writes:

> On Tue, Jan 15, 2019 at 11:50 PM Alexandre Duret-Lutz  
> wrote:
>> Since I updated to org 9.2, the following idiom stopped working.
>>
>> --
>> #+NAME: context
>> #+BEGIN_SRC C++ :exports none
>> #include 
>> int u = 0;
>> #+END_SRC
>>
>> #+BEGIN_SRC C++ :exports both :noweb strip-export :results verbatim
>> <>
>> int main()
>> {
>>   std::cout << "bar\n";
>>   return u;
>> }
>> #+END_SRC
>> --
>>
>> Upon export to html I'm expecting to see the second block of code with
>> <> stripped away, followed by a block of text containing the
>> result (bar).  With Org 9.2 I don't get the latter, because the
>> compilation of this small program fails during the export.  Inspection
>> of the temporary file passed to the compiler reveals that <>
>> has been stripped away from the code passed as input to the compiler,
>> not just from the code displayed in html.
>
> FWIW, reverting the change made to org-babel-exp-results in the following
> patch seems to fix my issue.
>
>
> commit 8e54cafeb286ea5eb25565a637b121a2f597c48b
> Author: Nicolas Goaziou 
> Date:   Sat Jun 23 23:04:45 2018 +0200

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: regression with :export both :noweb strip-export [9.2 (9.2-elpa @ /home/adl/.emacs.d/elpa/org-20181230/)]

2019-01-16 Thread Alexandre Duret-Lutz
On Tue, Jan 15, 2019 at 11:50 PM Alexandre Duret-Lutz  
wrote:
> Since I updated to org 9.2, the following idiom stopped working.
>
> --
> #+NAME: context
> #+BEGIN_SRC C++ :exports none
> #include 
> int u = 0;
> #+END_SRC
>
> #+BEGIN_SRC C++ :exports both :noweb strip-export :results verbatim
> <>
> int main()
> {
>   std::cout << "bar\n";
>   return u;
> }
> #+END_SRC
> --
>
> Upon export to html I'm expecting to see the second block of code with
> <> stripped away, followed by a block of text containing the
> result (bar).  With Org 9.2 I don't get the latter, because the
> compilation of this small program fails during the export.  Inspection
> of the temporary file passed to the compiler reveals that <>
> has been stripped away from the code passed as input to the compiler,
> not just from the code displayed in html.

FWIW, reverting the change made to org-babel-exp-results in the following
patch seems to fix my issue.


commit 8e54cafeb286ea5eb25565a637b121a2f597c48b
Author: Nicolas Goaziou 
Date:   Sat Jun 23 23:04:45 2018 +0200

Fix noweb expansion during export

* lisp/ob-core.el (org-babel-sha1-hash): Add optional argument to
  specify context.
(org-babel-execute-src-block): Use new argument.
* lisp/ob-exp.el (org-babel-exp-src-block): Use new argument.
(org-babel-exp-results): Fix context.

Reported-by: Ken Mankoff 


-- 
Alexandre Duret-Lutz



[O] Bug: regression with :export both :noweb strip-export [9.2 (9.2-elpa @ /home/adl/.emacs.d/elpa/org-20181230/)]

2019-01-15 Thread Alexandre Duret-Lutz


Hi!

I have some documentation where I use the noweb syntax to include some
common context in some code fragment I want to discuss.  On export
I'd like to display the code fragments without the common context,
followed by their output. 

Since I updated to org 9.2, the following idiom stopped working.

--
#+NAME: context
#+BEGIN_SRC C++ :exports none
#include 
int u = 0;
#+END_SRC

#+BEGIN_SRC C++ :exports both :noweb strip-export :results verbatim
<>
int main()
{
  std::cout << "bar\n";
  return u;
}
#+END_SRC
--

Upon export to html I'm expecting to see the second block of code with
<> stripped away, followed by a block of text containing the
result (bar).  With Org 9.2 I don't get the latter, because the
compilation of this small program fails during the export.  Inspection
of the temporary file passed to the compiler reveals that <>
has been stripped away from the code passed as input to the compiler,
not just from the code displayed in html.

Changing ":exports both" to ":exports results" has the same issue.
Evaluating the code block with C-c C-c works correctly.  So it seems to
me that the meaning of "strip-export" was changed from "strip noweb
markers before exporting source blocks" to "strip noweb markers for
source blocks before exporting or even when evaluating them via
:export".  Was this meant?

One workaround I have found is to evaluate such code fragments via noweb
instead of via :exports.

--
#+NAME: context2
#+BEGIN_SRC C++ :exports none
#include 
int u = 0;
#+END_SRC

#+NAME: bar2
#+BEGIN_SRC C++ :exports code :noweb strip-export :results verbatim
<>
int main()
{
  std::cout << "bar\n";
  return u;
}
#+END_SRC

#+BEGIN_SRC text :noweb yes
<>
#+END_SRC
--

(This is not exactly equivalent from a CSS point of view, but at least
it exports the output.)




Emacs  : GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.2)
 of 2018-12-18, modified by Debian
Package: Org mode version 9.2 (9.2-elpa @ /home/adl/.emacs.d/elpa/org-20181230/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-listings 'minted
 org-babel-after-execute-hook '((lambda nil (org-redisplay-inline-images)))
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-protocol-default-template-key "w"
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-html-format-inlinetask-function 
'org-html-format-inlinetask-default-function
 org-src-tab-acts-natively t
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-special-ctrl-a/e t
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-startup-with-inline-images t
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300.\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-file-apps '(("\\.pdf::\\([[:digit:]]+\\)\\'" . org-pdfview-open) 
("\\.pdf\\'" . org-pdfview-open)
 (auto-mode . emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" . 
default)
 ("\\.pdf\\'" . default))
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)
 org-babel-load-languages '((shell . t) (python . t) (plantuml . t) (dot . t) 
(R . t) (C . t))
 org-babel-python-command "/usr/bin/python3"
 org-src-lang-modes '(("arduino" . arduino) ("redis" . redis) ("php" . php) 
("C" . c) ("C++" . c++)
  ("asymptote" . asy) ("bash" . sh) ("beamer" . latex) 
("calc" . fundamental)
  ("cpp" . c++) ("ditaa" . artist) ("dot" . fundamental) 
("elisp" . emacs-lisp)
  ("ocaml" . tuareg) ("screen" . shell-script) ("shell" . 
sh) ("sqlite" . sql))
 org-occur-hook '(org-first-headline-recenter)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-speed-command-hook '(org-speed-command-activate 
org-babel-speed-command-activate)
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 org-babel-tangle-lang-exts '(("D" . "d") ("C++" . "cpp") ("python" . "py") 
("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-return-follows-link t
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("id" :follow org-id-open) ("eww" :follow eww :store 
org-eww-store-link)
   ("rmail" :follow org-rmail-open :store 
org-rm