[O] Babel trims leading 0s for certain numbers of tables

2016-07-10 Thread Ken Mankoff

I've just discovered that when Org results are returned in a table, they are 
modified in that leading 0s are removed. Is this a feature? A bug? Is there a 
workaround for this? Leading 0s are not removed if the result is a string, but 
in many cases a string of numbers is still a string and should retain those 0s.

  -k.

#+BEGIN_SRC sh :results table
echo "0042"
#+END_SRC
#+RESULTS:
| 42 |

#+BEGIN_SRC sh :results table
echo "00foo"
#+END_SRC
#+RESULTS:
| 00foo |





Re: [O] Babel trims leading 0s for certain numbers of tables

2016-07-10 Thread Eric Abrahamsen
Ken Mankoff  writes:

> I've just discovered that when Org results are returned in a table,
> they are modified in that leading 0s are removed. Is this a feature? A
> bug? Is there a workaround for this? Leading 0s are not removed if the
> result is a string, but in many cases a string of numbers is still a
> string and should retain those 0s.

Maybe you can use a format specifier for that column, so the
zero-padding is retained?




Re: [O] Babel trims leading 0s for certain numbers of tables

2016-07-10 Thread Ken Mankoff

On 2016-07-10 at 13:18, Eric Abrahamsen  wrote:
> Ken Mankoff  writes:
>
>> I've just discovered that when Org results are returned in a table,
>> they are modified in that leading 0s are removed. Is this a feature? A
>> bug? Is there a workaround for this? Leading 0s are not removed if the
>> result is a string, but in many cases a string of numbers is still a
>> string and should retain those 0s.
>
> Maybe you can use a format specifier for that column, so the
> zero-padding is retained?

Maybe. Can you provide an example? Adding a #+TBLFM: after the table doesn't do 
it, and I'm not sure how to specify result formatting at this level of detail 
in babel header block arguments.

  -k.

#+BEGIN_SRC sh :results table
echo "0042"
#+END_SRC
#+RESULTS:
| 42 |
#+TBLFM: @1=@1;N





[O] how to speed up an org-mode file?

2016-07-10 Thread Sharon Kimble

I'm working on an org-mode file about cancer which is 945.1kb, is
converted to a tex file of 1.0mb and a pdf of 2.0mb with 505 pages. The
conversion is done through this code snippet '(global-set-key (kbd
"s-#") 'org-latex-export-to-latex)'. There is no problem with the
conversion to tex or conversion to pdf.

However, the org-mode file is increasingly slowing down and becoming
difficult to move about within the file, and also enter new information
within it.

How then can I speed it up within the org file please?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.0.95


signature.asc
Description: PGP signature


Re: [O] Bug: Table formula does not copy time interval correctly [8.2.10 (release_8.2.10 @ /usr/share/emacs/25.0.94/lisp/org/)]

2016-07-10 Thread Michael Brand
Hi Rares

On Fri, Jul 8, 2016 at 6:06 AM, Rares Vernica  wrote:

> Just to clarify, how would you fix this:
>
> | [2016-07-05 Tue]--[2016-07-06 Wed] | 1d | vsum(d) |
> | [2016-07-06 Wed]--[2016-07-07 Thu] | 1d | 2 d |
> #+TBLFM: $3=vsum(@1$-1..@0$-1)
>
> Notice the "vsum(d)" instead of the expected "1 d".

Depending on the number of fields in a range Org builds just a value
or a Calc vector of values. This is due to the comparison of r1/r2 and
c1/c2 which are the row and column beginning and end of the range in
the function org-table-get-range:

(if (and (not corners-only)
 (or (not rangep) (and (= r1 r2) (= c1 c2
;; Just one field.
[...]
  ;; A range, return a vector.
  [...])

I can not think of any use case where this should be more useful than
substituting ~(and (= r1 r2) (= c1 c2))~ with ~nil~. But since this
substitution could break existing usage I suggest to add ~vec~ to the
Calc formula:

| [2016-07-05 Tue]--[2016-07-06 Wed] | 1d | d  | [d]  | d   |
| [2016-07-06 Wed]--[2016-07-07 Thu] | 1d | [d, d] | [[d, d]] | 2 d |
#+TBLFM: $3 = @1$2..@0$2 :: $4 = vec(@1$2..@0$2) :: $5 = vsum(vec(@1$2..@0$2))

Michael



Re: [O] Babel trims leading 0s for certain numbers of tables

2016-07-10 Thread Charles C. Berry

On Sun, 10 Jul 2016, Ken Mankoff wrote:



I've just discovered that when Org results are returned in a table, they 
are modified in that leading 0s are removed. Is this a feature? A bug?


Take your choice. The feature/bug happens deep down:

- org-babel-execute-src-block
  - org-babel-execute:shell
- org-babel-import-elisp-from-file
  - org-babel-string-read
- org-babel-read

which tries hard to convert strings to numbers.

I haven't looked hard at this, but it seems like it would take a 
significant amount of tooling to set things up to make this 
conversion optional.


Is there a workaround for this? Leading 0s are not removed if the result 
is a string, but in many cases a string of numbers is still a string and 
should retain those 0s.


Lots of ways, I guess. But they would all involve either tricking 
org-babel-read and then cleaning up the mess or processing the output 
outside of org-babel-import-from-elisp.


For the latter, send the output to a file. Maybe use :file or pipe it from 
your script. Then visit the file, convert it to a table, and capture the 
result as a string. I think you can do this with a :post callout.


HTH,

Chuck



Re: [O] Babel trims leading 0s for certain numbers of tables

2016-07-10 Thread Ken Mankoff

On 2016-07-10 at 16:50, Charles C. Berry  wrote:
> For the latter, send the output to a file. Maybe use :file or pipe it
> from your script.

I'm now capturing results to :file. This also make the code less dependent on 
Org. I still manage all the code in Org Babel blocks, but for the following 
block, which takes several hours to run, I cut-and-paste the code to a 
terminal. I can do that now that its input is from a file and not from an Org 
RESULTS block.

  -k.



Re: [O] how to speed up an org-mode file?

2016-07-10 Thread Leo Noordhuizen
Maybe an (too ?) obvious suggestion: Get more memory ?

On Sun, 10 Jul 2016 at 16:37 Sharon Kimble 
wrote:

>
> I'm working on an org-mode file about cancer which is 945.1kb, is
> converted to a tex file of 1.0mb and a pdf of 2.0mb with 505 pages. The
> conversion is done through this code snippet '(global-set-key (kbd
> "s-#") 'org-latex-export-to-latex)'. There is no problem with the
> conversion to tex or conversion to pdf.
>
> However, the org-mode file is increasingly slowing down and becoming
> difficult to move about within the file, and also enter new information
> within it.
>
> How then can I speed it up within the org file please?
>
> Thanks
> Sharon.
> --
> A taste of linux = http://www.sharons.org.uk
> TGmeds = http://www.tgmeds.org.uk
> Debian 8.4, fluxbox 1.3.7, emacs 25.0.95
>


Re: [O] how to speed up an org-mode file?

2016-07-10 Thread Sharon Kimble
Leo Noordhuizen  writes:

> Maybe an (too ?) obvious suggestion: Get more memory ?

I'm working on a computer with 16g of ram and 31g of swap, which would
be adequate for almost anything I think. At the moment getting more ram
isn't a viable option, I have to stick with what I've already got.

Thanks
Sharon.
>
> On Sun, 10 Jul 2016 at 16:37 Sharon Kimble  wrote:
>
> I'm working on an org-mode file about cancer which is 945.1kb, is
> converted to a tex file of 1.0mb and a pdf of 2.0mb with 505 pages. The
> conversion is done through this code snippet '(global-set-key (kbd
> "s-#") 'org-latex-export-to-latex)'. There is no problem with the
> conversion to tex or conversion to pdf.
>
> However, the org-mode file is increasingly slowing down and becoming
> difficult to move about within the file, and also enter new information
> within it.
>
> How then can I speed it up within the org file please?
>
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.0.95


signature.asc
Description: PGP signature


Re: [O] how to speed up an org-mode file?

2016-07-10 Thread Leo Noordhuizen
Yes. You obviously have ample resources in that area!

Op zo 10 jul. 2016 21:05 schreef Sharon Kimble :

> Leo Noordhuizen  writes:
>
> > Maybe an (too ?) obvious suggestion: Get more memory ?
>
> I'm working on a computer with 16g of ram and 31g of swap, which would
> be adequate for almost anything I think. At the moment getting more ram
> isn't a viable option, I have to stick with what I've already got.
>
> Thanks
> Sharon.
> >
> > On Sun, 10 Jul 2016 at 16:37 Sharon Kimble 
> wrote:
> >
> > I'm working on an org-mode file about cancer which is 945.1kb, is
> > converted to a tex file of 1.0mb and a pdf of 2.0mb with 505 pages.
> The
> > conversion is done through this code snippet '(global-set-key (kbd
> > "s-#") 'org-latex-export-to-latex)'. There is no problem with the
> > conversion to tex or conversion to pdf.
> >
> > However, the org-mode file is increasingly slowing down and becoming
> > difficult to move about within the file, and also enter new
> information
> > within it.
> >
> > How then can I speed it up within the org file please?
> >
> --
> A taste of linux = http://www.sharons.org.uk
> TGmeds = http://www.tgmeds.org.uk
> Debian 8.4, fluxbox 1.3.7, emacs 25.0.95
>


Re: [O] Dynamic links

2016-07-10 Thread John Kitchin
It kind of sounds like you want the button-lock package. See
http://kitchingroup.cheme.cmu.edu/blog/2015/03/18/Clickable-links-for-Twitter-handles-in-Emacs/
for example (and search "clickable text" on my blog for other examples).

Maybe something like:

#+BEGIN_SRC emacs-lisp
(require 'button-lock)
(global-button-lock-mode)

(defvar ticket-regexp "\\([[:alpha:]]\\{2,5\\}-[[:digit:]]+\\)")

(button-lock-set-button 
 ticket-regexp
 (lambda ()
   (interactive)
   (save-excursion
 (goto-char (previous-single-property-change (point) 'button-lock))
 (looking-at ticket-regexp)
 (browse-url (format "http://www.some-ticket-system/%s"; (match-string 0)
 :face 'org-link)
#+END_SRC

You get no export with this, but it has the functionality you want I
think.

Sriram Thaiyar writes:

> Hi-
>
> I've implemented "dynamic links" which are like plain links but for
> arbitrary regular expressions.
>
> I was wondering if there was a better way to do this?
>
> You can see the implementation here:
> https://github.com/sri/dotfiles/commit/cd3429ce0c8e637c803835299c2ed4653d19a5fb
>
> (This works with Org-mode version: 8.3.4 - 8.3.4-88-g792bb9-elpa.)
>
> With this config:
>
> (add-to-list 'my-org-dynamic-links-matcher
>  '("\\([[:alpha:]]\\{2,5\\}-[[:digit:]]+\\)"
>"https://some-ticketing-system.org/%s";))
>
> a string like `TEST-122' is turned into a link, as you type it in.
> And when you click on that link, it'll visit this URL:
> https://some-ticketing-system.org/TEST-122
>
> There are some things that gave me problems:
>
> - I can't hit  and have it follow the link. For this, it seems
>   like I would need to advice the `org-return' function.
>
> - Despite the fact that the `TEST-123' has a `htmlize-link' text property,
>   it errors out with "No link found". To fix that, I needed to add a hook to
>   `org-open-at-point-functions'.
>
> - I had to copy a bunch of code from `org-activate-plain-links' to get
>   this to work.
>
> Thanks,
> -Sriram


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



Re: [O] how to speed up an org-mode file?

2016-07-10 Thread John Kitchin
I find it sometimes helpful to narrow to a section in large documents.

On July 10, 2016, at 3:37 PM, Leo Noordhuizen  wrote:

Yes. You obviously have ample resources in that area!


Op zo 10 jul. 2016 21:05 schreef Sharon Kimble :

Leo Noordhuizen  writes:

> Maybe an (too ?) obvious suggestion: Get more memory ?

I'm working on a computer with 16g of ram and 31g of swap, which would
be adequate for almost anything I think. At the moment getting more ram
isn't a viable option, I have to stick with what I've already got.

Thanks
Sharon.
>
> On Sun, 10 Jul 2016 at 16:37 Sharon Kimble  wrote:
>
>     I'm working on an org-mode file about cancer which is 945.1kb, is
>     converted to a tex file of 1.0mb and a pdf of 2.0mb with 505 pages. The
>     conversion is done through this code snippet '(global-set-key (kbd
>     "s-#") 'org-latex-export-to-latex)'. There is no problem with the
>     conversion to tex or conversion to pdf.
>
>     However, the org-mode file is increasingly slowing down and becoming
>     difficult to move about within the file, and also enter new information
>     within it.
>
>     How then can I speed it up within the org file please?
>
--
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.0.95



Re: [O] how to speed up an org-mode file?

2016-07-10 Thread Alan Tyree
There must be something more than this. I sometimes work on a similar size
file on an HP Chromebook using emacs in a Crouton installation and have no
problems at all with speed. It is a nox emacs installation, if that matters.

Alan

On 11 July 2016 at 08:34, John Kitchin  wrote:

> I find it sometimes helpful to narrow to a section in large documents.
>
>
> On July 10, 2016, at 3:37 PM, Leo Noordhuizen 
> wrote:
>
>
> Yes. You obviously have ample resources in that area!
>
> Op zo 10 jul. 2016 21:05 schreef Sharon Kimble  >:
>
>> Leo Noordhuizen  writes:
>>
>> > Maybe an (too ?) obvious suggestion: Get more memory ?
>>
>> I'm working on a computer with 16g of ram and 31g of swap, which would
>> be adequate for almost anything I think. At the moment getting more ram
>> isn't a viable option, I have to stick with what I've already got.
>>
>> Thanks
>> Sharon.
>> >
>> > On Sun, 10 Jul 2016 at 16:37 Sharon Kimble 
>> wrote:
>> >
>> > I'm working on an org-mode file about cancer which is 945.1kb, is
>> > converted to a tex file of 1.0mb and a pdf of 2.0mb with 505 pages.
>> The
>> > conversion is done through this code snippet '(global-set-key (kbd
>> > "s-#") 'org-latex-export-to-latex)'. There is no problem with the
>> > conversion to tex or conversion to pdf.
>> >
>> > However, the org-mode file is increasingly slowing down and becoming
>> > difficult to move about within the file, and also enter new
>> information
>> > within it.
>> >
>> > How then can I speed it up within the org file please?
>> >
>> --
>> A taste of linux = http://www.sharons.org.uk
>> TGmeds = http://www.tgmeds.org.uk
>> Debian 8.4, fluxbox 1.3.7, emacs 25.0.95
>>
>


-- 
Alan L Tyreehttp://www2.austlii.edu.au/~alan
Tel:  04 2748 6206