Re: [O] evaluate cpp snippet in org babel with default includes and customized entry point

2017-09-16 Thread Thierry Banel
You may use the :includes header parameter. Also, you may omit the main() function. In this case, all your code will become the body of a default main function. Type C-c C-v v on the following example to understand what is happening. #+BEGIN_SRC C++ :includes std::cout<<"hello";

Re: [O] evaluate cpp snippet in org babel with default includes and customized entry point

2017-09-16 Thread Thierry Banel
You may further hide the includes with a property drawer. An additional benefit is that those includes are shared among all babels under the same section. * Example :PROPERTIES: :includes: :END: #+BEGIN_SRC C++ std::cout<<"hello"; #+END_SRC #+RESULTS: : hello On 16/09/2017

Re: [O] Sibling visibility when accessing an item from the agenda

2017-09-16 Thread James Harkins
On Sat, 16 Sep 2017 15:30:52 +0800 Nicolas Goaziou wrote > Does customizing `org-show-context-detail' fix your issues? Hi, Thanks, it would have taken me quite some time to find that. The default was "ancestors." Changing it to "local" works well for me.

Re: [O] evaluate cpp snippet in org babel with default includes and customized entry point

2017-09-16 Thread Thierry Banel
On 16/09/2017 11:14, Amos Bird wrote: Hmm, is it possible to customize babel's c++ backend to achieve this? You mean, hiding the call to twoSum() somewhere? I am not aware of any basic way to achieve that. I may also want a evaluation that submits the code to online judge and returns the

[O] evaluate cpp snippet in org babel with default includes and customized entry point

2017-09-16 Thread Amos Bird
#+OPTIONS: latex:t toc:nil H:3 Hi I'd like to write a blog about leetcode solutions in c++. How can I evaluate those c++ code snippet using org babel? * Array ** Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume

Re: [O] evaluate cpp snippet in org babel with default includes and customized entry point

2017-09-16 Thread Amos Bird
#+OPTIONS: latex:t toc:nil H:3 Thanks Thierry, But I'd like to hide all those includes and the main function. I'm not sure if it's possible. Thierry Banel writes: > A starting point could be as follows. > Type C-c C-c to evaluate. > Type C-c C-v v to expand the source.

Re: [O] How can I trigger org-redisplay-inline-images automatically when '[[..]]' is shown as a link.

2017-09-16 Thread Amos Bird
#+OPTIONS: latex:t toc:nil H:3 Hi Nicolas, Um, ok. I think I'll switch to manual trigger then. How can I make ctrl-c ctrl-c toggle current image display when in image context? Nicolas Goaziou writes: > Hello, > > Amos Bird writes: > >> I usually

Re: [O] Sibling visibility when accessing an item from the agenda

2017-09-16 Thread Nicolas Goaziou
Hello, James Harkins writes: >> What is the setting to control the visibility of the 4th-level siblings >> here? >> >> How I got to this point: >> >> - All headings collapsed (only top-level visible) >> - Go to the agenda week view >> - Put the cursor on the entry

Re: [O] evaluate cpp snippet in org babel with default includes and customized entry point

2017-09-16 Thread Amos Bird
#+OPTIONS: latex:t toc:nil H:3 Ok, i get the idea. So how can I customized the default code expansion so that it can directly evaluate this #+BEGIN_SRC cpp class Solution { public: vector twoSum(vector& nums, int target) { } }; #+END_SRC

Re: [O] evaluate cpp snippet in org babel with default includes and customized entry point

2017-09-16 Thread Thierry Banel
A starting point could be as follows. Type C-c C-c to evaluate. Type C-c C-v v to expand the source. #+BEGIN_SRC C++ :flags -std=c++11 #include #include using namespace std; class Solution { public: vector twoSum(vector& nums, int target) { vector result; result.push_back(0);

Re: [O] evaluate cpp snippet in org babel with default includes and customized entry point

2017-09-16 Thread Thierry Banel
Another starting point without hard-coding inputs: #+name: NUMS | 2 | | 7 | | 11 | | 15 | #+BEGIN_SRC C++ :flags -std=c++11 :var target=9 :var inputnums=NUMS #include #include using namespace std; class Solution { public: vector twoSum(vector& nums, int target) { vector result;

Re: [O] evaluate cpp snippet in org babel with default includes and customized entry point

2017-09-16 Thread Amos Bird
#+OPTIONS: latex:t toc:nil H:3 Hmm, is it possible to customize babel's c++ backend to achieve this? I may also want a evaluation that submits the code to online judge and returns the result. Thierry Banel writes: > You still need to explicitly call twoSum(), and that

Re: [O] evaluate cpp snippet in org babel with default includes and customized entry point

2017-09-16 Thread Thierry Banel
You still need to explicitly call twoSum(), and that cannot be hidden. On 16/09/2017 10:58, Amos Bird wrote: Ok, i get the idea. So how can I customized the default code expansion so that it can directly evaluate this

Re: [O] Bug?? #+begin_src sh :file

2017-09-16 Thread Grant Rettke
On Sat, Sep 16, 2017 at 9:09 AM, Charles Millar wrote: > The following ECL is based on Grant Rettke's Org Scraps - Correction: They are Eric Schulte's (https://www.cs.unm.edu/~eschulte/)

Re: [O] org-meta-return not on M-RET

2017-09-16 Thread Nicolas Goaziou
Hello, Allen Li writes: > When I could not get org-meta-return to work in terminal Emacs, I > realized that org-meta-return is only bound to M-return and not M-RET. > Is there any particular reason for this? No idea. Fixed. Thank you. Regards, -- Nicolas Goaziou

Re: [O] Klipse change removed line breaks in html export of code blocks

2017-09-16 Thread Nicolas Goaziou
Hello, Alexander Vorobiev writes: > I noticed that at some point source code blocks lost the line breaks in the > html export. Closer investigation revealed that the reason was the change ( > https://www.mail-archive.com/emacs-orgmode@gnu.org/msg113099.html) which

Re: [O] library of babel ingest interferes with noweb

2017-09-16 Thread edgar
On 2017-09-14 21:26, Nicolas Goaziou wrote: I have #+BEGIN_EXAMPLE <> #+END_EXAMPLE However, it seems wrong to have #+BEGIN_EXAMPLE a=2 #+END_EXAMPLE because you no longer know what part you are editing. Ooops, I should have said that I did C-c C-v v

Re: [O] Bug?? #+begin_src sh :file

2017-09-16 Thread Achim Gratz
Charles Millar writes: > A bug? Or what am I missing? You are creating a file that Org is supposed to fill with the output from your script. Your script doesn't produce output, but instead writes to the same file. When the script returns, Org dutifully truncates the file to nothing. Regards,

Re: [O] org-list-to-subtree strange behaviour

2017-09-16 Thread Nicolas Goaziou
Hello, Robert Klein writes: > I'm trying to use org-list-to-subtree in a publishing projects > sitemap-function. > > However, the org-list-to-subtree function only returns the first entry. > > That is, when I run > > (org-list-to-subtree l '(:istart "** ")) > > after

[O] Bug?? #+begin_src sh :file

2017-09-16 Thread Charles Millar
Hi, The following ECL is based on Grant Rettke's Org Scraps - https://eschulte.github.io/org-scraps/scraps/2011-02-15-recutils.html #+begin_src sh :file this.txt cat << EOF > this.txt 1 2 3 EOF #+end_src When I execute the code block the file "this.txt" is created and so is a link, i.e.

[O] org-list-to-subtree strange behaviour

2017-09-16 Thread Robert Klein
Hi, I'm trying to use org-list-to-subtree in a publishing projects sitemap-function. However, the org-list-to-subtree function only returns the first entry. That is, when I run (org-list-to-subtree l '(:istart "** ")) after setting the variable l (see below, I didn't want the 120+ lines

Re: [O] Bug?? #+begin_src sh :file

2017-09-16 Thread Thierry Banel
I get the expected result without the redirection: #+begin_src sh :file this.txt cat << EOF 1 2 3 EOF #+end_src On 16/09/2017 15:09, Charles Millar wrote: Hi, The following ECL is based on Grant Rettke's Org Scraps - https://eschulte.github.io/org-scraps/scraps/2011-02-15-recutils.html

Re: [O] org-meta-return not on M-RET

2017-09-16 Thread Gregor Zattler
Hi Nicolas, Allen, * Nicolas Goaziou [2017-09-16; 17:20]: > Allen Li writes: > >> When I could not get org-meta-return to work in terminal Emacs, I >> realized that org-meta-return is only bound to M-return and not M-RET. >> Is there any

Re: [O] Bug?? #+begin_src sh :file

2017-09-16 Thread Charles Millar
On 09/16/17 14:55, Grant Rettke wrote: On Sat, Sep 16, 2017 at 9:09 AM, Charles Millar wrote: The following ECL is based on Grant Rettke's Org Scraps - Correction: They are Eric Schulte's (https://www.cs.unm.edu/~eschulte/) Thanks to Thierry and Achim for the

[O] Bug: Evil's evil-ex-substitute does not expand headlines as necessary. [8.2.10 (release_8.2.10 @ /usr/share/emacs/25.2/lisp/org/)]

2017-09-16 Thread Gary Cheng
Emacs : GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.16) of 2017-07-15 Package: Org-mode version 8.2.10 (release_8.2.10 @ /usr/share/emacs/25.2/lisp/org/)