Kévin Le Gouguec writes: > Bastien <b...@gnu.org> writes: > >> Brandon Guttersohn <bran...@guttersohn.org> writes: >> >>> Hey all, I think I may have a small fix for executing C source blocks >>> in org-babel. Or, possibly just a bad case of user error. >>> >>> The issue (in emacs 27 with -q) is that it doesn't seem possible to >>> specify non-system header files with the :includes header argument. >>> >>> [...] >>> >>> The attached patch will wrap filenames in quotes if they do not begin >>> with "<", and works for me. >> >> Thanks for reporting this and for suggesting this patch, I think it is >> good enough. I have applied it to the master branch of Org: >> >> https://code.orgmode.org/bzg/org-mode/commit/44cb98fdb6
I think this discussion was on emacs-devel only, so here are some links for others who might go looking for more context: https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg01880.html https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg03051.html > I think this commit might have broken test ob-C/string-var: running > "make test" on master (516c038e5) right now I get: > >> Test ob-C/string-var condition: >> (wrong-type-argument sequencep <iostream>) >> FAILED 8/834 ob-C/string-var (0.004651 sec) Thanks. I started seeing that as well but hadn't looked into it yet. > The following patch fixes the test: > > diff --git a/lisp/ob-C.el b/lisp/ob-C.el > index c3e72c680..ae7b2ed1c 100644 > --- a/lisp/ob-C.el > +++ b/lisp/ob-C.el > @@ -233,6 +233,7 @@ its header arguments." > ;; includes > (mapconcat > (lambda (inc) > + (when (symbolp inc) (setq inc (symbol-name inc))) > (if (string-prefix-p "<" inc) > (format "#include %s" inc) > (format "#include \"%s\"" inc))) > > I don't know if it's the best way forward; another way to make the test > pass is double-quoting "<iostream>" and "<cstring>" in ob-C-test.org: The above looks reasonable to me... > diff --git a/testing/examples/ob-C-test.org b/testing/examples/ob-C-test.org > index 0faf630b9..efae02a19 100644 > --- a/testing/examples/ob-C-test.org > +++ b/testing/examples/ob-C-test.org > @@ -38,7 +38,7 @@ > #+end_src > > #+source: string_var > -#+begin_src cpp :var q="word" :includes '(<iostream> <cstring>) :results > silent > +#+begin_src cpp :var q="word" :includes '("<iostream>" "<cstring>") :results > silent > std::cout << q << ' ' << std::strlen(q); > return 0; > #+end_src ...given this test seems to be explicitly checking that case. > I guess there might be some people out there who will expect things to > keep working without double-quotes? I have never used Babel, so I have > no idea… I don't know either, but the test does make me think so. Hopefully Brandon, Bastien, or someone else will chime in if that's not the case. Could you send the first patch with a commit message tacked on? Thanks again!