Re: [O] How to pass table to SRC block as strings only?

2017-01-20 Thread Sébastien Brisard
Hi again,
as a follow up: I can't believe how far behind my org version was (I
suppose I was running the built-in version).
Now that I have upgraded to 9.0.3, your code works like a charm.
Thanks again,
Sébastien

2017-01-21 6:30 GMT+01:00 Sébastien Brisard :
> Hi Chuck,
> thank you *very much* for this answer!
> I was indeed wondering what was the entry point into the org source
> for this. `org-babel-ref-resolve' is where I should start. I'm still
> relatively new to emacs-lisp and do not know how to instrument the
> code in order to trace all calls (which would probably have solved my
> problem).
> Anyway, with my version (8.2.10) of org-mode, I had to redefine
> `org-babel-read' rather than `org-babel--string-to-number'. Will
> update and see where it goes.
>
> In any case, I will consider this problem as solved! Thanks again,
> Sébastien
>
> 2017-01-20 4:49 GMT+01:00 Charles C. Berry :
>> On Thu, 19 Jan 2017, Sébastien Brisard wrote:
>>
>>> Thanks Charles for this answer. Let me state the problem more clearly.
>>> Number-like cells *are* converted to numbers (as best illustrated by
>>> the example below (see the use of numberp), which might incur accuracy
>>> loss (see below, the first row has a lot of significant digits).
>>> I am not interested in the number representation of these cells, only
>>> the string matters for my application. Due to this accuracy loss,
>>> converting back the number to a string is not an option for me...
>>>
>>> Any ideas? Thanks!
>>
>>
>> The usual resolution of table references will eventually use
>> `org-babel--string-to-number' to do what its name suggests.
>>
>> You can write an elisp function to handle references as you wish and call
>> them from :var arguments.
>>
>> A hackish way to do this for your case is to quash the action of
>> `org-babel--string-to-number':
>>
>> #+BEGIN_SRC emacs-lisp
>>   (defun get-ref-strings-as-is (ref)
>> (cl-letf (((symbol-function 'org-babel--string-to-number)
>>(lambda (x) x)))
>>   (org-babel-ref-resolve ref)))
>> #+END_SRC
>>
>> #+header: :var table=(get-ref-strings-as-is "table20170119") #+BEGIN_SRC
>> emacs-lisp :colnames yes :results pp
>> table
>> #+END_SRC
>>
>> #+RESULTS:
>> : (("row1" "12345678901234567890")
>> :  ("row2" "a")
>> :  ("row3" "b")
>> :  ("row4" "c"))
>>
>> You can look at `org-babel-ref-resolve' to get some ideas on how to do this
>> more artfully.
>>
>>> Sébastien
>>>
>>> = begin example =
>>> #+NAME: table20170119
>>> | col1 | col2 |
>>> |--+--|
>>> | row1 | 12345678901234567890 |
>>> | row2 | a|
>>> | row3 | b|
>>> | row4 | c|
>>>
>>
>> HTH,
>>
>> Chuck




Re: [O] How to pass table to SRC block as strings only?

2017-01-20 Thread Sébastien Brisard
Hi Chuck,
thank you *very much* for this answer!
I was indeed wondering what was the entry point into the org source
for this. `org-babel-ref-resolve' is where I should start. I'm still
relatively new to emacs-lisp and do not know how to instrument the
code in order to trace all calls (which would probably have solved my
problem).
Anyway, with my version (8.2.10) of org-mode, I had to redefine
`org-babel-read' rather than `org-babel--string-to-number'. Will
update and see where it goes.

In any case, I will consider this problem as solved! Thanks again,
Sébastien

2017-01-20 4:49 GMT+01:00 Charles C. Berry :
> On Thu, 19 Jan 2017, Sébastien Brisard wrote:
>
>> Thanks Charles for this answer. Let me state the problem more clearly.
>> Number-like cells *are* converted to numbers (as best illustrated by
>> the example below (see the use of numberp), which might incur accuracy
>> loss (see below, the first row has a lot of significant digits).
>> I am not interested in the number representation of these cells, only
>> the string matters for my application. Due to this accuracy loss,
>> converting back the number to a string is not an option for me...
>>
>> Any ideas? Thanks!
>
>
> The usual resolution of table references will eventually use
> `org-babel--string-to-number' to do what its name suggests.
>
> You can write an elisp function to handle references as you wish and call
> them from :var arguments.
>
> A hackish way to do this for your case is to quash the action of
> `org-babel--string-to-number':
>
> #+BEGIN_SRC emacs-lisp
>   (defun get-ref-strings-as-is (ref)
> (cl-letf (((symbol-function 'org-babel--string-to-number)
>(lambda (x) x)))
>   (org-babel-ref-resolve ref)))
> #+END_SRC
>
> #+header: :var table=(get-ref-strings-as-is "table20170119") #+BEGIN_SRC
> emacs-lisp :colnames yes :results pp
> table
> #+END_SRC
>
> #+RESULTS:
> : (("row1" "12345678901234567890")
> :  ("row2" "a")
> :  ("row3" "b")
> :  ("row4" "c"))
>
> You can look at `org-babel-ref-resolve' to get some ideas on how to do this
> more artfully.
>
>> Sébastien
>>
>> = begin example =
>> #+NAME: table20170119
>> | col1 | col2 |
>> |--+--|
>> | row1 | 12345678901234567890 |
>> | row2 | a|
>> | row3 | b|
>> | row4 | c|
>>
>
> HTH,
>
> Chuck




Re: [O] How to have a sideways longtable?

2017-01-20 Thread Eric S Fraga
On Friday, 20 Jan 2017 at 22:29, John Hendy wrote:
> On Fri, Jan 20, 2017 at 3:56 PM, William Denton  wrote:
>> I have a long and wide table of text I'd like to have sideways (landscape
>> orientation) and stretch over multiple pages.  I can do either one but not
>> both together.

[...]

> I'm not sure what version of org I was using at the time (2014), but
> knew I'd done this. This might not be exactly what you wanted, but I
> just used landscape instead of sideways table and know it worked:
>
> #+LATEX_HEADER: \usepackage{lscape}
>
> #+latex: \begin{landscape}
> #+latex: \tiny
>
> #+attr_latex: :align |ll|lll|lll :env longtable
> | table | goes | here |
>
> #+latex: \end{landscape}

This still works.  I use exactly this and it works with latest org.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.3-241-gc3d67b


signature.asc
Description: PGP signature


Re: [O] How to have a sideways longtable?

2017-01-20 Thread John Hendy
On Fri, Jan 20, 2017 at 3:56 PM, William Denton  wrote:
> I have a long and wide table of text I'd like to have sideways (landscape
> orientation) and stretch over multiple pages.  I can do either one but not
> both together.
>
> Here's a gist with a long, wide table:
>
> https://gist.github.com/wdenton/f11acf2e5257b29789f806b854d0709e
>
> If you take that and export it to LaTeX it will be long (on two pages) but
> not sideways, with some columns are cut off on the right---the float is
> being ignored, it seems.
>
> Using the float on its own does work, and this appears in the output:
>
> \begin{sidewaystable}[htbp]
>
> But when the longtable is there, it's just this without any sidewaystable:
>
> \begin{longtable}{rrll}
>
> Is this a bug?  I assumed they'd work together out of the box, but maybe I
> need to do something special.

I'm not sure what version of org I was using at the time (2014), but
knew I'd done this. This might not be exactly what you wanted, but I
just used landscape instead of sideways table and know it worked:

#+LATEX_HEADER: \usepackage{lscape}

#+latex: \begin{landscape}
#+latex: \tiny
#+attr_latex: :align |ll|lll|lll :env longtable
| table | goes | here |
#+latex: \end{landscape}

Like I said, that was old, so some of the syntax would be different
(like #+begin_export latex / #+end_export) but it's what I had on hand
to send quick!


John


>
> Bill
> --
> William Denton :: Toronto, Canada :: https://www.miskatonic.org/
> Caveat lector.
>



[O] How to have a sideways longtable?

2017-01-20 Thread William Denton
I have a long and wide table of text I'd like to have sideways (landscape 
orientation) and stretch over multiple pages.  I can do either one but not both 
together.


Here's a gist with a long, wide table:

https://gist.github.com/wdenton/f11acf2e5257b29789f806b854d0709e

If you take that and export it to LaTeX it will be long (on two pages) but not 
sideways, with some columns are cut off on the right---the float is being 
ignored, it seems.


Using the float on its own does work, and this appears in the output:

\begin{sidewaystable}[htbp]

But when the longtable is there, it's just this without any sidewaystable:

\begin{longtable}{rrll}

Is this a bug?  I assumed they'd work together out of the box, but maybe I need 
to do something special.


Bill
--
William Denton :: Toronto, Canada :: https://www.miskatonic.org/
Caveat lector.



Re: [O] Is there way to put the inactive date into a table?

2017-01-20 Thread Nick Dokos
Young-whan  writes:

>   | [2017-01-20 Fri] |
>   | <2017-01-30 Mon> |
>   #+TBLFM: @2$1=@1$1+10
>
> I put a inactive date at @1$1 and I want @2$1 would have +10 days from the 
> date, and want it to be
> inactive date, but it always shows active calendar date form.
>
> Is there a way to make it inactive date?
>

Commits 1619aee3 and a2950b00 made it so that the result of an
evaluation in a table is always an inactive date (IOW, @2$1 above
would alwasy be inactive, whether or not @1$1 is active). But you'll
need a very recent checkout of the master branch to get that
behaviour. AFAIK, there is no way to do what you want with the maint
branch (on which elpa releases are based).

-- 
Nick




[O] Is there way to put the inactive date into a table?

2017-01-20 Thread Young-whan
  | [2017-01-20 Fri] |
  | <2017-01-30 Mon> |
  #+TBLFM: @2$1=@1$1+10

I put a inactive date at @1$1 and I want @2$1 would have +10 days from the
date, and want it to be inactive date, but it always shows active calendar
date form.

Is there a way to make it inactive date?


Re: [O] Latex Preview Fragment is not working on org 9.0.3 from elpa

2017-01-20 Thread Young-whan
Looks like it is a bug? Why it is not loaded automatically while 8.2 has no
issue?

On Wed, Jan 18, 2017 at 12:56 PM, Charles C. Berry  wrote:

> On Wed, 18 Jan 2017, Young-whan wrote:
>
> I've installed the emacs-app via port, and there was no problem with Latex
>> Preview Fragment in a buffer at all.
>>
>> Now, using the M-x package-list-packages, I've installed the latest org
>> 9.0.3, then the latex preview is not working at all.
>>
>> It comes with following error:
>>
>> org-create-formula--latex-header: Symbol’s function definition is void:
>> org-export-get-backendError during redisplay: (eval (mode-line-mode-name))
>> signaled (void-function mode-line-mode-name)
>>
>
> That is because `org-export-get-backend' is not loaded (nor autoloaded).
>
> You can type C-c C-e q to force loading of the org-export-* functions. Or
> put (require 'ox) in your init file.
>
> I don't see why `org-export-get-backend' is lacking an autoload directive.
>
> Bug??
>
> Chuck
>


Re: [O] [parser] feature request: column and row numbers available for table-cell elements

2017-01-20 Thread Eric S Fraga
Hi Nicolas,

On Thursday, 19 Jan 2017 at 21:15, Nicolas Goaziou wrote:
> I don' think this is needed since this information is readily available
> during the export process. For example
>
>   (1+ (length (org-export-get-previous-element table-cell info 'all)))

Well, this returns the column number in the elided table, not the
original table.  In other words, after columns have been removed before
processing for export.

I need the row and column numbers in the original table in the org file,
not what is actually exported!

> returns the column number table-cell belongs to, whereas
>
>   (1+ (cl-count-if
>(lambda (row) (eq (org-element-property :type row) 'standard))
>(org-export-get-previous-element (org-export-get-parent table-cell) 
> 'all)))

And this one gives me an error which I do not understand:

,
| Debugger entered--Lisp error: (wrong-type-argument listp table-row)
|   org-element-property(:type table-row)
|   (eq (org-element-property :type row) (quote standard))
|   (lambda (row) (eq (org-element-property :type row) (quote 
standard)))(table-row)
|   cl-count(nil (table-row (:type rule :begin 76 :end 96 :contents-begin nil 
[...]
|   apply(cl-count nil (table-row (:type rule :begin 76 :end 96 [...]
|   cl-count-if((lambda (row) (eq (org-element-property :type row) [...]
`

Any suggestions very welcome!

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.3-241-gc3d67b


signature.asc
Description: PGP signature


Re: [O] run a function during capture

2017-01-20 Thread Xebar Saram
Alan: once you have your org-board and capture setting finalized , i would
be very interested to get more details on your setup and work flow, this
looks really interesting!

thx

Z

On Thu, Jan 19, 2017 at 6:47 PM, Alan Schmitt <
alan.schm...@polytechnique.org> wrote:

> Hello,
>
> It is possible to run a function at the end of capture? I would like to
> call org-board-archive (that downloads a web page according to some
> properties) before finishing the capture?
>
> Thanks,
>
> Alan
>
> --
> OpenPGP Key ID : 040D0A3B4ED2E5C7
> Monthly Athmospheric CO₂, Mauna Loa Obs. 2016-12: 404.48, 2015-12: 401.85
>


[O] wraptable

2017-01-20 Thread Gert van Oss
Good day,

I’m looking for a way to have wrapped tables on the right side in my document. 
A global setting is preferred if a wrapped table is possible anyhow.


I tried in my ‘file.org'

Just som text..
#+LaTeX: \input{myWrappedTable}



file: myWrappedTable.tex

\begin{wraptable}[10]{r}{6.5cm}
  \caption{A wrapped table}\label{myTable}
\begin{tabular}{ccc}\\\toprule  
Header first column & second-column & third-column \\\midrule
2 &3 & 5\\  \midrule
2 &3 & 5\\  
2 &3 & 5\\  \bottomrule
\end{tabular}
\end{wraptable} 
%—

However the table never ends up where I expect (hoped) it to be.

Thanks,
Gert