Re: [O] Bug header argumednt :file does not produce a file or a link to the file

2019-08-23 Thread Nicolas Goaziou
Hello,

Charles Millar via Emacs-orgmode  writes:

> Now a "just curious," comment and question:
>
> I had a few files that used the ECM source code block, just many more
> entries in each. The last time that I evaluated any of them was last
> October and it produced the results I expected, i.e. I did not specify
> ":results file"
>
> So, up until October was I just lucky or did something change in Org
> that affected the sh language?

It changed between Org 9.2 and Org 9.3, for every language. There is an
ORG-NEWS entry about it, namely:

  *** ~:file~ header argument no longer assume "file" ~:results~


Regards,

-- 
Nicolas Goaziou



Re: [O] Agenda: Display projects and 3 todo subtasks

2019-08-23 Thread Nathan Neff
I ran into another possible solution for the request of seeing the first
X TODO tasks for a project in the Agenda:

Let's say I simply run an org-tags-todo query looking for :project:

The Agenda now shows this:

Project1
Project2
Project3

Another possible solution would be to simply TAB to one of the projects, and
run org-todo-list with the restriction on the current subtree.

I'm trying to find a way to create a function to do this . . . . . . I guess
a macro-like function would work

Thanks,
--Nate


On Wed, Jul 31, 2019 at 8:59 AM Sacha Chua  wrote:

> Hmm, you're right, that project subtask snippet isn't working any more. I
> don't think I can sort that out while I'm away from my computer, so it may
> take me a few weeks until I can poke around. If anyone happens to have a
> better config, please feel free to share!
>
> On Wed., Jul. 31, 2019, 10:37 Nathan Neff,  wrote:
>
>> I forgot to mention that I have PROJECT tag as not inheritable:
>> (setq org-tags-exclude-from-inheritance (quote ("PROJECT")))
>>
>> And here's the agenda custom-command addition:
>>  ("2" "List projects with tasks" my/org-agenda-projects-and-tasks
>>  "+PROJECT"
>>  ((org-agenda-max-entries 3))
>>
>>
>>
>> On Tue, Jul 30, 2019 at 9:32 PM Nathan Neff 
>> wrote:
>>
>>> Hello all,
>>>
>>> I found this cool snippet at Sacha Chua's website: [1].
>>>
>>> It creates an agenda view with headings marked with tag "project",
>>> and for each of those headings, it displays up to 3 sub headings marked
>>> TODO.
>>>
>>> I like this idea of seeing my projects (plus a few TODO entries under
>>> each project)
>>> in the agenda is a cool idea, so I copy/pasted the snippet at [1].
>>>
>>> I created an example org file:
>>> * Project 1:PROJECT:
>>> ** todo task 1.1
>>> ** todo task 1.2
>>> ** todo task 1.3
>>> ** todo task 1.4
>>> * Project 2:PROJECT:
>>> ** todo task 2.1
>>> ** todo task 2.2
>>> ** todo task 2.3
>>> ** todo task 2.4
>>>
>>> And ran the custom agenda command on only that file.
>>>
>>> The output which is produced lists each project correctly.
>>> However the sub-tasks under each project are the *same 3 subtasks*
>>> from Project 1
>>>
>>>   foo:Project 1
>>>   foo:todo task 1.1
>>>   foo:todo task 1.2
>>>   foo:todo task 1.3
>>>   foo:Project 2
>>>   foo:todo task 1.1
>>>   foo:todo task 1.2
>>>   foo:todo task 1.3
>>>
>>> The snippet at [1] is a bit more complex than I thought would be
>>> necessary for such
>>> an agenda view.  Does someone have any snippets or suggestions for how to
>>> accomplish the idea above?  Is there something obvious that I'm missing
>>> about
>>> the setup of my test org file?
>>>
>>> Thanks,
>>> --Nate
>>>
>>> [1]
>>> https://github.com/sachac/.emacs.d/blob/gh-pages/Sacha.org#display-projects-with-associated-subtasks
>>> The associated blog entry is:
>>>
>>> https://sachachua.com/blog/2013/01/emacs-org-display-projects-with-a-few-subtasks-in-the-agenda-view/
>>>
>>>
>>>
>>>


Re: [O] join two or more tables

2019-08-23 Thread Achim Gratz
Uwe Brauer writes:
> Hm, thanks but could you post an example (the one I finally used is
> based on R and goes as follows

There's a whole tutorial on table manipulation on Worg:
https://orgmode.org/worg/org-contrib/babel/examples/lob-table-operations.html

It's a bit old so some of the functions may be named differently now,
but the principles should still apply.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds




Re: [O] Bug header argumednt :file does not produce a file or a link to the file

2019-08-23 Thread Charles Millar via Emacs-orgmode

On 8/23/19 4:15 AM, Nicolas Goaziou wrote:

Hello,

Charles Millar via Emacs-orgmode  writes:


#+begin_src sh :file test.rec
cat << EOF
# -*- mode: rec -*-

%rec: somerecord

Account: something
Amount: 0.00

 end of file
EOF

#+end_src

I expect that when I execute the above code block that

1. An external file test.rec is produced with contents

# -*- mode: rec -*-

%rec: somerecord

Account: something
Amount: 0.00

 end of file

   and

2. A link to that file is placed below the source code block

Instead all I get is a table and no external file is created


You probably need to specify that the output is a file, which is not the
default for "sh" language. You may want to add ":results file" to the
header of the source block.

Regards,


Thank you, Nicolas. That solved it.

Now a "just curious," comment and question:

I had a few files that used the ECM source code block, just many more 
entries in each. The last time that I evaluated any of them was last 
October and it produced the results I expected, i.e. I did not specify 
":results file"


So, up until October was I just lucky or did something change in Org 
that affected the sh language?


Regards,

Charlie Millar






Re: [O] join two or more tables

2019-08-23 Thread Uwe Brauer


   > What about:

   > #+begin_src emacs-lisp :var t1=nut :var t2=nut2 :colnames yes
   > (append t1 t2)
   > #+end_src

   > #+RESULTS:
   > | type | Fiber | Sugar | Protein | Carb |
   > |--+---+---+-+--|
   > | eggplant |   2.5 |   3.2 | 0.8 |  8.6 |
   > | tomatoe  |   0.6 |   2.1 | 0.8 |  3.4 |
   > | onion|   1.3 |   4.4 | 1.3 |  9.0 |
   > | egg  | 0 |  18.3 |31.9 | 18.3 |
   > | rice |   0.2 | 0 | 1.5 | 16.0 |
   > | bread|   0.7 |   0.7 | 3.3 | 16.0 |
   > | orange   |   3.1 |  11.9 | 1.3 | 17.6 |
   > | banana   |   2.1 |   9.9 | 0.9 | 18.5 |
   > | tofu |   0.7 |   0.5 | 6.6 |  1.4 |
   > | nut  |   2.6 |   1.3 | 4.9 |  7.2 |
   > | corn |   4.7 |   1.8 | 2.8 | 21.3 |

   > Of course, this works because both tables have headers, which can be
   > handled by the ":colnames yes" header-argument. If both are headerless,
   > "colnames: no" would do the trick.


Thanks very much, this was precisely what I was looking for. The R based
solution works fine but I prefer one which is based on elisp.

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


[O] join two or more tables

2019-08-23 Thread emanuel . charpentier
> Hi
> 
> I was googling this a bit, I found more complicated scenarios, but
> not how to join one or more tables.
> 
> For example 
> #+begin_src 
> 
> #+tblname: nut
> | type | Fiber | Sugar | Protein | Carb |
> |--+---+---+-+--|
> | eggplant |   2.5 |   3.2 | 0.8 |  8.6 |
> | tomatoe  |   0.6 |   2.1 | 0.8 |  3.4 |
> | onion|   1.3 |   4.4 | 1.3 |  9.0 |
> | egg  | 0 |  18.3 |31.9 | 18.3 |
> 
> 
> #+tblname: nut2
> | type | Fiber | Sugar | Protein | Carb |
> |--+---+---+-+--|
> | rice |   0.2 | 0 | 1.5 | 16.0 |
> | bread|   0.7 |   0.7 | 3.3 | 16.0 |
> | orange   |   3.1 |  11.9 | 1.3 | 17.6 |
> | banana   |   2.1 |   9.9 | 0.9 | 18.5 |
> | tofu |   0.7 |   0.5 | 6.6 |  1.4 |
> | nut  |   2.6 |   1.3 | 4.9 |  7.2 |
> | corn |   4.7 |   1.8 | 2.8 | 21.3 |
> #+end_src

What about:

#+begin_src emacs-lisp :var t1=nut :var t2=nut2 :colnames yes
(append t1 t2)
#+end_src

#+RESULTS:
| type | Fiber | Sugar | Protein | Carb |
|--+---+---+-+--|
| eggplant |   2.5 |   3.2 | 0.8 |  8.6 |
| tomatoe  |   0.6 |   2.1 | 0.8 |  3.4 |
| onion|   1.3 |   4.4 | 1.3 |  9.0 |
| egg  | 0 |  18.3 |31.9 | 18.3 |
| rice |   0.2 | 0 | 1.5 | 16.0 |
| bread|   0.7 |   0.7 | 3.3 | 16.0 |
| orange   |   3.1 |  11.9 | 1.3 | 17.6 |
| banana   |   2.1 |   9.9 | 0.9 | 18.5 |
| tofu |   0.7 |   0.5 | 6.6 |  1.4 |
| nut  |   2.6 |   1.3 | 4.9 |  7.2 |
| corn |   4.7 |   1.8 | 2.8 | 21.3 |

Of course, this works because both tables have headers, which can be
handled by the ":colnames yes" header-argument. If both are headerless,
"colnames: no" would do the trick.

Handling the case where one has headers and the other not, or when
there are hlines in the table is still a conudrum for me: I haven't
(yet) been able to find the documentation on how these things are
stored...

HTH,

--
Emmanuel Charpentier





Re: [O] Org mode pollutes the narrow-map

2019-08-23 Thread Nicolas Goaziou
Hello,

Omar AntolĂ­n Camarena  writes:

> Hello everyone,
>
> Does it seems a little rude that Org mode binds its own narrowing commands in 
> the global narrow-map?
>
> You can find this in org.el starting at line 19018:
>
> #+begin_src emacs-lisp
>    Narrow map
>   (org-defkey narrow-map "s" #'org-narrow-to-subtree)
>   (org-defkey narrow-map "b" #'org-narrow-to-block)
>   (org-defkey narrow-map "e" #'org-narrow-to-element)
> #+end_src
>
> I don't need or really want those commands bound in non-org buffers.
> I think it would be better to bind them (to C-x n s, C-x n b and C-x
> n e) in org-mode-map. This is the approach taken by AUCTeX, for
> example. (To be clear, I mean AUCTeX has some narrowing commands and
> it binds them to C-x n e and C-x n g in its own keymaps.)

It sounds reasonable. I changed the bindings in master. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug header argumednt :file does not produce a file or a link to the file

2019-08-23 Thread Nicolas Goaziou
Hello,

Charles Millar via Emacs-orgmode  writes:

> #+begin_src sh :file test.rec
> cat << EOF
> # -*- mode: rec -*-
>
> %rec: somerecord
>
> Account: something
> Amount: 0.00
>
>  end of file
> EOF
>
> #+end_src
>
> I expect that when I execute the above code block that
>
>   1. An external file test.rec is produced with contents
>
>   # -*- mode: rec -*-
>
>   %rec: somerecord
>
>   Account: something
>   Amount: 0.00
>
>    end of file
>
>   and
>
>   2. A link to that file is placed below the source code block
>
> Instead all I get is a table and no external file is created

You probably need to specify that the output is a file, which is not the
default for "sh" language. You may want to add ":results file" to the
header of the source block.

Regards,

-- 
Nicolas Goaziou