[O] html export entire code block including template?

2019-04-15 Thread Lawrence Bottorff
I'm doing this:

#+begin_example
#+begin_src emacs-lisp :var table=sandbox :exports both
  (message "%S" table)
#+end_src
#+end_example

to force html export into displaying the entire block, including the code
block wrapper. Is there a more elegant way, perhaps in the #+begin line to
tell export to include even the wrapper?

LB


[O] Automatically naming and linking to an external file

2019-04-15 Thread Marvin Doyley
Hi there,

I trying to make a script that 

(a) automatically creates a file e.g.  notes-04-15-2019.org 

(b) makes a link to notes-40-15-2019.org  
automatically in index.org  under a specific heading 
(c) open notes-04-2019.org  in the buffer

Does anybody know how to do this.

Thanks
M

[O] Script for automatically linking to an external file

2019-04-15 Thread Doyley, Marvin M.
Hi there,

I trying to make a script that

(a) automatically creates a file e.g.  
notes-04-15-2019.org
(b) makes a link to notes-40-15-2019.org 
automatically in index.org under a specific heading
(c) open notes-04-2019.org in the buffer

Does anybody know how to do this.

Thanks
M



Re: [O] [PATCH] ob-sql.el: Option to reference connections in `sql-connection-alist'

2019-04-15 Thread Stefano Rodighiero
On Mon, Apr 15, 2019 at 6:11 PM Nicolas Goaziou 
wrote:


> Thank you. I applied your patch.
>

Great, thank you again for your help.


> Could you also provide an entry in ORG-NEWS?
>

Attached.

regards,
s.

-- 
www.stefanorodighiero.net
From 802cbc9c8e631c4457934c4ad00b3c6ac2a62105 Mon Sep 17 00:00:00 2001
From: Stefano Rodighiero 
Date: Mon, 15 Apr 2019 22:14:07 +0200
Subject: [PATCH] ORG-NEWS: Mention parameter :dbconnection for
 org-babel-execute:sql

---
 etc/ORG-NEWS | 4 
 1 file changed, 4 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a2e9057..79659ea 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -188,6 +188,10 @@ days in the past.
 == (~org-habit-toggle-display-in-agenda~) in an agenda toggles
 the display of all habits to those which are undone and scheduled.
 This is a function for convenience.
+*** New paramater for SQL Babel blocks: ~:dbconnection~
+The new paramater ~:dbconnection~ allows to specify a connection name
+in a SQL block header: this name is used to look up connection
+parameters in ~sql-connection-alist~.
 ** New functions
 *** ~org-dynamic-block-insert-dblock~
 
-- 
2.7.4



Re: [O] Manual does not mention LEVEL special property

2019-04-15 Thread Nick Dokos
Nicolas Goaziou  writes:

> Hello,
>
> Omari Norman  writes:
>
>> The Org mode manual does not mention the LEVEL special property; can you
>> please add it?
>>
>> https://orgmode.org/manual/Special-properties.html
>
> I don't think LEVEL is a special property. Why do you think it should be
> one?
>

The "Matching tags and properties" section seems to imply that:

,
| You may also test for properties (see Properties and Columns) at the
| same time as matching tags. The properties may be real properties, or
| special properties that represent other metadata (see Special
| Properties). For example, the property ‘TODO’ represents the TODO
| keyword of the entry. Or, the property ‘LEVEL’ represents the level of
| an entry. So searching ‘+LEVEL=3+boss-TODO​="DONE"’ lists all level
| three headlines that have the tag ‘boss’ and are not marked with the
| TODO keyword ‘DONE’. In buffers with org-odd-levels-only set, ‘LEVEL’
| does not count the number of stars, but ‘LEVEL=2’ corresponds to 3
| stars etc.
`

AFAIU, special properties are properties of a headline, even though
the user has not defined them (indeed, *should not* define them) in a
properties drawer. If that's so, I think LEVEL qualifies as a special
property.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [O] part of table name in remote(NAME, ...) is mangled by org-edit-special

2019-04-15 Thread Tony E. Bennett
On Mon, Apr 15, 2019 at 6:30 AM Nicolas Goaziou 
wrote:

>
> "Tony E. Bennett"  writes:
>
> > A reference to a table name such as '2019-Q1-X' is rewritten to '2019-@1
> $17-X'
> > by org-edit-special.  And also for '2019_Q1_X'. v9.2.3
>
   ...


> > A workaround is to use 1Q instead of Q1 in table name.
>
> Try setting `org-table-use-standard-references' to nil.
> I think this should be the default.


Confirmed, that fixes it for me and since I don't use the 'B3' style in org
tables it doesn't interfere with anything for me.

thanks Nicolas!


Re: [O] [PATCH] ob-sql.el: Option to reference connections in `sql-connection-alist'

2019-04-15 Thread Nicolas Goaziou
Hello,

Stefano Rodighiero  writes:

> I am attaching a new patch that should address your remarks.
> Also, see comments below.

Thank you. I applied your patch.

Could you also provide an entry in ORG-NEWS?

Regards,

-- 
Nicolas Goaziou



Re: [O] Manual does not mention LEVEL special property

2019-04-15 Thread Nicolas Goaziou
Hello,

Omari Norman  writes:

> The Org mode manual does not mention the LEVEL special property; can you
> please add it?
>
> https://orgmode.org/manual/Special-properties.html

I don't think LEVEL is a special property. Why do you think it should be
one?

Regards,

-- 
Nicolas Goaziou



[O] Converting tags to TODO states

2019-04-15 Thread garjola
Hi,

For my GTD implementation with org-mode, I have been using the :next:
tag for my next actions. I would like now to use a "NEXT" TODO keyword,
which means that I need to convert all :next: tags with "TODO" headlines
into "NEXT" headlines without the :next: tag. 

I have *a lot* of org files, so an automatic procedure is needed. Since
I am not fluent in elisp, I was going to write a python script to do
this, but maybe there is already a way to do this conversion with
org-mode itself?

The tricky thing I see with parsing is dealing with the ":" in the case
of multiple tags (I know how to do this in python, but I don't in
elisp).

Thanks for any hint you can provide.

Garjola


-- 



Re: [O] #+PROPERTY: header-args:C++ will not work

2019-04-15 Thread Alexandre Duret-Lutz
On Mon, Apr 15, 2019 at 2:53 PM Alexandre Duret-Lutz  wrote:
> Unfortunately, this does not work for C++ blocks.

I just noticed that I could change all my C++ blocks into cpp blocks and
then use header-args:cpp without any problem.  The org-mode manual
states that the identifier for the C++ language is "C++"
(https://orgmode.org/manual/Languages.html) but the same page links to
some babel documentation
(https://orgmode.org/worg/org-contrib/babel/languages.html)
where it is listed as "cpp".

ORG-NEWS has one example using C++, but the test suite only has cpp examples.

There is some hint on
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-C.html#orgea7b004
that using cpp might not fully work (?).   And clearly while lisp/org-src.el has
many functions implemented for both cpp and C++, its not always complete.
For instance it defines org-babel-header-args:C++
but there is no org-babel-header-args:cpp, meaning incomplete completion for
cpp blocks header-args.

>From all that it feels like the documentation wants us to use C++, and that
the code is trying to keep cpp for backward compatibility (?), but that each
option has different drawbacks.

I'll stick to C++ and header-args:C+++...

--
Alexandre Duret-Lutz



[O] #+PROPERTY: header-args:C++ will not work

2019-04-15 Thread Alexandre Duret-Lutz
Hi,

I'm currently simplifying some documentation that evaluates a lot of
sh/python/C++ blocks by defining the :results and :exports flags
commonly used in header-args properties like so:

#+PROPERTY: header-args:sh :results verbatim :exports both
#+PROPERTY: header-args:python :results output :exports both
#+PROPERTY: header-args:C++ :results verbatim :exports both

Unfortunately, this does not work for C++ blocks.

Looking at the contents of org-file-properties in a file with the
above lines shows

org-file-properties is a variable defined in ‘org.el’.
Its value is
(("header-args:C+" . ":results verbatim :exports both")
 ("header-args:python" . ":results output :exports both")
 ("header-args:sh" . ":results verbatim :exports both"))

Note how C++ is truncated to C+.

The documentation states:

1. Language-specific header arguments are also read from properties
‘header-args:’ where  is the language identifier.
(https://orgmode.org/manual/Using-Header-Arguments.html#Code-block-specific-header-arguments)

2. If you want to add to the value of an existing property, append a
‘+’ to the property name.
(https://orgmode.org/manual/Property-Syntax.html#Property-Syntax)

Unfortunately it seems statement 2 breaks statement 1 when LANG ends
with '+', and header-args:C++ is understood as appending
header-args:C+.

I currently work around this problem by using header-args:C+++
instead, but this only works assuming that property header-args:C++
has not been set by other means.

I there other way to assign (not append) some value to the header-args
property from the some org file?

-- 
Alexandre Duret-Lutz



Re: [O] Shrinking columns after formula recalculation

2019-04-15 Thread Nick Dokos
Nicolas Goaziou  writes:

> Hello,
>
> Nick Dokos  writes:
>
>> But since no good deed shall go unpunished, here's another related
>> problem I ran into: with shrunk columns, I add a few more rows to the
>> table with S-RET on the first column, recalculate to populate the
>> added rows and then do an undo. That undoes the results of the
>> recalculation but it also unshrinks the column.
>
> Yes, undo unshrinks. This is a good thing as one might not notice undone
> changes within a shrunk column.
>
> Also, AFAIK, there is no elegant way (i.e., not writing `org-undo') to
> circumvent the issue, if it is considered as such.
>

OK - thanks!
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [O] part of table name in remote(NAME, ...) is mangled by org-edit-special

2019-04-15 Thread Nicolas Goaziou
Hello,

"Tony E. Bennett"  writes:

> A reference to a table name such as '2019-Q1-X' is rewritten to '2019-@1$17-X'
> by org-edit-special.  And also for '2019_Q1_X'. v9.2.3
>
> Test case:
>
>   |---++|
>   | # | Q1 | 600.00 |
>   |---++|
>
>   #+TBLFM: @1$3=remote(2019-*Q1*-X,$total)
>
>   #+NAME: 2019-Q1-X
>   |+|
>
>   | _  |  total |
>   | *  | 600.00 |
>   |+|
>
> With cursor in 1st table, invoke org-edit-special with:  C-x '
>
> Then save the edit with C-c C-c and notice TBLFM is now:
>
>   #+TBLFM: @1$3=remote(2019-*@1$17*-X,$total)
>
> A workaround is to use 1Q instead of Q1 in table name.

Try setting `org-table-use-standard-references' to nil.

I think this should be the default.

Regards,

-- 
Nicolas Goaziou



Re: [O] Shrinking columns after formula recalculation

2019-04-15 Thread Nicolas Goaziou
Hello,

Nick Dokos  writes:

> But since no good deed shall go unpunished, here's another related
> problem I ran into: with shrunk columns, I add a few more rows to the
> table with S-RET on the first column, recalculate to populate the
> added rows and then do an undo. That undoes the results of the
> recalculation but it also unshrinks the column.

Yes, undo unshrinks. This is a good thing as one might not notice undone
changes within a shrunk column.

Also, AFAIK, there is no elegant way (i.e., not writing `org-undo') to
circumvent the issue, if it is considered as such.

Regards,

-- 
Nicolas Goaziou