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 for "Elec. 2a 01" and
#+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
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);
#+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.
>
> #+BEGIN_SRC C++ :fl
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;
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";
#+END_SRC
#+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
#+RESULTS:
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 10:54,
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
#+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 cannot be hidden.
>
> On
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.
I'm puzzled because, for y
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 r
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.
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
#+
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 inter
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
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
> started using
> html tags in
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 setting the variable l (see
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
(org-babel-expand-src-blo
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,
A
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/)
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 particular reason for this?
>
> No idea. Fixed. Thank you.
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 correction and explanation and
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/)
---
Hello,
Gary Cheng writes:
> 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/)
>
>
> -
25 matches
Mail list logo