[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/)




When using evil's substitute (:%s/string1/string2/c) in an org file, if the
string that is to be substituted is hidden under a headline, the cursor
will go to the end of the line of the headline of the string, as opposed to
expanding the headline automatically and putting the cursor on the string
the way evil's find (/) does. It should match evil's find behavior which is
more intuitive and useful by doing the same thing.


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 correction and explanation and to  
Grant for the link.


Charlie



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 particular reason for this?
>
> No idea. Fixed. Thank you.

Thanks to both of you: It used to work, then it didn't, only a
few days ago I realised there was a difference between M-RETURN
and M-RET but thought of this as a configuration error and now it
simply works again!

Regards, Gregor




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] 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,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables




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 
(org-babel-expand-src-block) in the last block. What I need is to get 
the final code (without references). Thanks!


-

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  



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 setting the variable l (see below, I didn't want the
> 120+ lines interrupting this text) , I get this result:
>
>
> "**   [[file: openbsd-pxe.org][OpenBSD deployment via PXE]]
>
> #+begin_article-info
> #+BEGIN_date
> 2017-09-10
> #+END_date
>
> #+BEGIN_tags
> OpenBSD, PXE, Installation, Deployment
> #+END_tags
>
> #+begin_article-info
>
> "
>
> where I expected all nine entries in the list.

This is because L is not a valid list. In particular, it contains two
consecutive blank lines, which breaks the list.

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
> started using
>  html tags instead of  so setting
> (setq org-html-keep-old-src t) fixed the issue for me.
>
> My question is why is this behavior not the default? It looks like Klipse
> supports very few languages (of which I use none) but the change affects
> every single language supported by Org mode.

I'm Cc'ing Matt, as the author of klipse integration, for some insight.

Regards,

-- 
Nicolas Goaziou



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



[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 interrupting this text) , I get this result:


"**   [[file: openbsd-pxe.org][OpenBSD deployment via PXE]]
#+begin_article-info
#+BEGIN_date
2017-09-10
#+END_date
#+BEGIN_tags
OpenBSD, PXE, Installation, Deployment
#+END_tags
#+begin_article-info

"

where I expected all nine entries in the list.


It works for simple lists, e.g.

  (setq l '(unordered
("alpha")
("beta")
("gamma")))

results in

"** alpha
** beta
** gamma"

which is about what I expect.

Any Ideas?


Thank you very much!

Best regards
Robert



(setq l
'(unordered ("
[[file: openbsd-pxe.org][OpenBSD deployment via PXE]]
#+begin_article-info
#+begin_date
2017-09-10
#+end_date
#+begin_tags
OpenBSD, PXE, Installation, Deployment
#+end_tags
#+begin_article-info


#+INCLUDE: \"openbsd-pxe.org::lead\"

[[file:openbsd-pxe.org]][Read more]]
") ("
[[file: dhcp-to-fixed-ip.org][Change from DHCP to fixed IP during
autoYaST]] #+begin_article-info
#+begin_date
2017-09-10
#+end_date
#+begin_tags
SUSE, autoYaST, DHCP, network configuration
#+end_tags
#+begin_article-info


#+INCLUDE: \"dhcp-to-fixed-ip.org::lead\"

[[file:dhcp-to-fixed-ip.org]][Read more]]
") ("
[[file: ksh93-getopts.org][Man-Page mit ksh93 getopts]]
#+begin_article-info
#+begin_date
2017-09-06
#+end_date
#+begin_tags
nil
#+end_tags
#+begin_article-info


#+INCLUDE: \"ksh93-getopts.org::lead\"

[[file:ksh93-getopts.org]][Read more]]
") ("
[[file: autoyast-group-ids.org][Assigning group IDs with autoYaST]]
#+begin_article-info
#+begin_date
2017-06-03
#+end_date
#+begin_tags
nil
#+end_tags
#+begin_article-info


#+INCLUDE: \"autoyast-group-ids.org::lead\"

[[file:autoyast-group-ids.org]][Read more]]
") ("
[[file: derived-exporter.org][Deriving a Back-End]]
#+begin_article-info
#+begin_date
2017-06-03
#+end_date
#+begin_tags
nil
#+end_tags
#+begin_article-info


#+INCLUDE: \"derived-exporter.org::lead\"

[[file:derived-exporter.org]][Read more]]
") ("
[[file: freebsd-pxe.org][FreeBSD deployment via PXE]]
#+begin_article-info
#+begin_date
2017-06-03
#+end_date
#+begin_tags
nil
#+end_tags
#+begin_article-info


#+INCLUDE: \"freebsd-pxe.org::lead\"

[[file:freebsd-pxe.org]][Read more]]
") ("
[[file: htdig.org][ht://Dig]]
#+begin_article-info
#+begin_date
2017-06-03
#+end_date
#+begin_tags
nil
#+end_tags
#+begin_article-info


#+INCLUDE: \"htdig.org::lead\"

[[file:htdig.org]][Read more]]
") ("
[[file: index.org][xyzzy.de — Robert's weblog]]
#+begin_article-info
#+begin_date
2017-06-03
#+end_date
#+begin_tags
nil
#+end_tags
#+begin_article-info


#+INCLUDE: \"index.org::lead\"

[[file:index.org]][Read more]]
") ("
[[file: ox-blog-example.org][ox-blog example post]]
#+begin_article-info
#+begin_date
2017-06-03
#+end_date
#+begin_tags
nil
#+end_tags
#+begin_article-info


#+INCLUDE: \"ox-blog-example.org::lead\"

[[file:ox-blog-example.org]][Read more]]
")))



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


#+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.


#+RESULTS:
_file:this.txt

_However, the file is empty. According to the documentation for :file 
I expected the following in "this.txt"


1
2
3

I tried :exports results but this.txt is still empty

A bug? Or what am I missing?

Charlie Millar





[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.


#+RESULTS:
_file:this.txt

_However, the file is empty. According to the documentation for :file I 
expected the following in "this.txt"


1
2
3

I tried :exports results but this.txt is still empty

A bug? Or what am I missing?

Charlie Millar
__


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 result.


This seems to be another topic. One that Babel is not concerned about. 
Are you trying to set up a work-flow where students submit their 
solutions to a teacher who is the "judge"? Isn't email between students 
and teacher just the simple and straightforward work-flow?



Thierry Banel  writes:

> 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

>
> class Solution {
> public:
> vector twoSum(vector& nums, int target) {
>
> }
> };

–
Amos Bird
amosb...@gmail.com






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.

I'm puzzled because, for years, it was behaving as I wanted. I believe the 
former behavior was "local" -- I have a slight shred of a doubt only because, 
when things are working as you expect, you take the behavior for granted and 
don't pay attention to all of the details.

I'm 100% certain that I was seeing at least the next sibling when jumping to an 
item from the agenda. If I had been seeing the "ancestors" behavior all along, 
I would have asked this question years ago and set it explicitly.

So, again, somehow this morning, one minute I had good behavior, and literally 
five minutes later (no restart, no software update, no quit/relaunch Emacs), it 
was a different, inconvenient behavior. I don't understand how that could 
happen.

Thanks for the tip, though. The behavior now is much better.

hjh




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 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
>
> class Solution {
> public:
>   vector twoSum(vector& nums, int target) {
>
>   }
> };


--
Amos Bird
amosb...@gmail.com


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
  
  
class Solution {
public:
  vector twoSum(vector& nums, int target) {

  }
};

  
  


  




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 10:54, Thierry Banel wrote:

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

#+RESULTS:
: hello


On 16/09/2017 10:37, Amos Bird wrote:


Thanks Thierry,

But I'd like to hide all those includes and the main function. I'm 
not sure if it's possible.












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

#+RESULTS:


Thierry Banel  writes:

> 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
>
> #+RESULTS:
> : hello
>
>
> On 16/09/2017 10:37, Amos Bird wrote:
>>
>> Thanks Thierry,
>>
>> But I'd like to hide all those includes and the main function. I'm not sure 
>> if
>> it's possible.
>>
>>


--
Amos Bird
amosb...@gmail.com


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";
#+END_SRC

#+RESULTS:
: hello


On 16/09/2017 10:37, Amos Bird wrote:


Thanks Thierry,

But I'd like to hide all those includes and the main function. I'm not 
sure if it's possible.








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;
  result.push_back(0);
  result.push_back(1);
  return result;
}
};

int main()
{
  Solution solution;
  vector nums;
  for (int* in : inputnums)
nums.push_back(*in);
  for (int x : solution.twoSum(nums,target))
cout<

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.
>
> #+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);
>   result.push_back(1);
>   return result;
> }
> };
>
> vector nums = {2, 7, 11, 15};
> int target = 9;
>
> int main()
> {
>   Solution solution;
>   for (int x : solution.twoSum(nums,target))
> cout< }
>
> #+END_SRC
>
> #+RESULTS:
> | 0 |
> | 1 |
>
>
>
> On 16/09/2017 09:50, Amos Bird wrote:
>>
>> Hi
>>
>> I'd like to write a blog about leetcode solutions in c++. How can I evaluate
>> those c++ code snippet using org babel?
>>
>>
>> 1 Array
>>
>>
>>   1.1 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 that each input would have exactly one solution, and you may
>> not use the same element twice.
>>
>> Example:
>> Given nums = [2, 7, 11, 15], target = 9,
>>
>> Because nums[0] + nums[1] = 2 + 7 = 9,
>> return [0, 1].
>>
>> |class  Solution  {
>> public:
>>  vector  twoSum(vector,int  target)  {
>>
>>  }
>> };
>> |
>>
>> I need to add default headers and pass arguments to the entry class.
>>
>> –
>> Amos Bird
>> amosb...@gmail.com
>>


--
Amos Bird
amosb...@gmail.com


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);
  result.push_back(1);
  return result;
}
};

vector nums = {2, 7, 11, 15};
int target = 9;

int main()
{
  Solution solution;
  for (int x : solution.twoSum(nums,target))
cout<

[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 that each input would have exactly one solution, and you may not 
use the same element twice.

Example:
Given nums = [2, 7, 11, 15], target = 9,

Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].


#+BEGIN_SRC cpp
class Solution {
public:
vector twoSum(vector& nums, int target) {

}
};
#+END_SRC

#+RESULTS:


I need to add default headers and pass arguments to the entry class.

--
Amos Bird
amosb...@gmail.com


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 for "Elec. 2a 01" and hit return. 
>
> A bit of poking around, and I found I can use C-c C-r as a workaround.
>
> But... I've been using this system for a few years now, and today is
> the first time I needed to look for C-c C-r.
>
> I'm quite sure in the past, when jumping from the agenda to a specific
> heading, org would show the heading *and* the next sibling (and hide
> the others, which is OK with me). But today, magically, in the middle
> of a session, the behavior changed. I didn't change any customization
> variables, just, one minute it was fine and the next it wasn't.

Does customizing `org-show-context-detail' fix your issues?

Regards,

-- 
Nicolas Goaziou



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 paste images into emacs buffer. I'd like org mode automatically 
>> show those images instead
>> of manually trigger it with org-redisplay-inline-images.
>
> You may want to transform the link right before inserting it. I think an
> Org extension, org-screenshot, does this.
>
> Regards,


--
Amos Bird
amosb...@gmail.com