[O] pc-keys mode does not work in org mode
I just started using: http://www.emacswiki.org/cgi-bin/wiki/download/pc-keys.el Very handy indeed. As far as I can see know, it works okay except in org-mode. I think this is because of these two lines in org.el: (define-key org-mode-map [home] 'org-beginning-of-line) (define-key org-mode-map [end] 'org-end-of-line) Could they be removed, or made more intelligent? Because org-mode is one of the most used modes for me and it would be very nice if I could use pc-keys there also. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[O] Check on empty does not work
I am trying the following: #+TBLFM: @-I$4..@+I$4 = if($3 == nan, string(), $3 - $2) ; %.1f and: #+TBLFM: @-I$4..@+I$4 = if($3 == , string(), $3 - $2) ; %.1f But in both case the fourth field is filled when the third field is empty. What am I doing wrong? I am using version 8.2.1. -- Cecil Westerhof
Re: [O] Check on empty does not work
2014-06-01 11:50 GMT+02:00 Cecil Westerhof cldwester...@gmail.com: I am trying the following: #+TBLFM: @-I$4..@+I$4 = if($3 == nan, string(), $3 - $2) ; %.1f and: #+TBLFM: @-I$4..@+I$4 = if($3 == , string(), $3 - $2) ; %.1f But in both case the fourth field is filled when the third field is empty. What am I doing wrong? I am using version 8.2.1. The following does work: #+TBLFM: @-I$4..@+I$4 = if($3 - $2 == -$2, string(), $3 - $2) ; But is not what is described. I removed %.1f because that displays an empty string as 0.0. Is it possible to use %.1f without making an empty field displayed as 0.0? -- Cecil Westerhof
Re: [O] Check on empty does not work
2014-06-01 12:58 GMT+02:00 Michael Brand michael.ch.br...@gmail.com: On Sun, Jun 1, 2014 at 12:00 PM, Cecil Westerhof cldwester...@gmail.com wrote: 2014-06-01 11:50 GMT+02:00 Cecil Westerhof cldwester...@gmail.com: I am trying the following: #+TBLFM: @-I$4..@+I$4 = if($3 == nan, string(), $3 - $2) ; %.1f and: #+TBLFM: @-I$4..@+I$4 = if($3 == , string(), $3 - $2) ; %.1f But in both case the fourth field is filled when the third field is empty. What am I doing wrong? I am using version 8.2.1. The following does work: #+TBLFM: @-I$4..@+I$4 = if($3 - $2 == -$2, string(), $3 - $2) ; But is not what is described. I removed %.1f because that displays an empty string as 0.0. Is it possible to use %.1f without making an empty field displayed as 0.0? I suggest that I will improve the TBLFM example about nan in the manual like this: `if($1 == nan || $2 == nan, string(), $1 + $2); E f-1' Sum of the first two columns. When at least one of the input fields is empty the Org table result field is set to empty. `E' is required to leave empty fields without conversion to 0. `f-1' is an optional Calc format string similar to `%.1f' but leaves empty results empty. Would this have answered all your questions? That does what I want. Thanks. -- Cecil Westerhof
[O] Difference between two rows
I like to calculate in a table the difference between the value in a field in the current row and the previous field. How would I do that? Something like: |---+| | value | difference | |---+| |12 || |15 | 3 | |83 | 68 | |87 | 4 | |85 | -2 | |---+| -- Cecil Westerhof
Re: [O] Difference between two rows
2014-06-01 13:57 GMT+02:00 Michael Brand michael.ch.br...@gmail.com: On Sun, Jun 1, 2014 at 1:38 PM, Cecil Westerhof cldwester...@gmail.com wrote: I like to calculate in a table the difference between the value in a field in the current row and the previous field. How would I do that? Something like: |---+| | value | difference | |---+| |12 || |15 | 3 | |83 | 68 | |87 | 4 | |85 | -2 | |---+| For such cases I prefer vlen(): #+TBLFM: $2 = if(vlen(@II..@0) == 1, string(), $1 - @-1$1); E Combining it with your previous help I now have (not every field will be filled, and the table is a little different): #+TBLFM: @-I$4..@+I$4 = if($3 == nan, string(), $3 - $2) ; E f-1 :: @-I$5..@+I$5 = if(vlen(@II..@0) == 1 || $3 == nan, string(), $3 - @-1$3); E f-1 At the moment this is good enough. But what if I would want to know the difference between the previous filled one, divided by the distance? For example: |---+| | value | difference | |---+| |12 || |15 | 3 | | || |83 | 34 | | || | || | || |87 | 1 | | || | || | || |85 | -0.5 | | || |---+| -- Cecil Westerhof
[O] Tests do not work
I saw my version was outdated (8.2.1), so I upgraded to 8.2.6. Seems to have gone OK, but when running: make test I get: install -m 755 -d /tmp/tmp-orgtest TMPDIR=/tmp/tmp-orgtest emacs -batch -Q --eval '(setq vc-handled-backends nil)' --eval '(add-to-list '''load-path ./lisp)' --eval '(add-to-list '''load-path ./testing)' -l org-loaddefs.el -l testing/org-test.el --eval '(require '''ob-awk)' --eval '(require '''ob-C)' --eval '(require '''ob-fortran)' --eval '(require '''ob-maxima)' --eval '(require '''ob-lilypond)' --eval '(require '''ob-octave)' --eval '(require '''ob-python)' --eval '(require '''ob-sh)' --eval '(require '''ob-perl)' --eval '(setq org-confirm-babel-evaluate nil)' -f org-test-run-batch-tests Cannot open load file: testing/org-test.el make: *** [test] Error 255 What is going wrong here? -- Cecil Westerhof
Re: [O] Difference between two rows
2014-06-01 15:18 GMT+02:00 Michael Brand michael.ch.br...@gmail.com: Hi Cecil On Sun, Jun 1, 2014 at 2:24 PM, Cecil Westerhof cldwester...@gmail.com wrote: But what if I would want to know the difference between the previous filled one, divided by the distance? For example: |---+| | value | difference | |---+| |12 || |15 | 3 | | || |83 | 34 | | || | || | || |87 | 1 | | || | || | || |85 | -0.5 | | || |---+| More as a demonstration of what Calc can do, divided up into some intermediate steps: |---+-| | value | difference | |---+-| |12 | | |15 | [15, 12]| | | | |83 | [83, nan, 15, 12] | | | | | | | | | | |87 | [87, nan, nan, nan, 83, nan, 15, 12]| | | | | | | | | | |85 | [85, nan, nan, nan, 87, nan, nan, nan, 83, nan, 15, 12] | | | | |---+-| #+TBLFM: $2 = if(vlen(@-I$1..@0$1) == 1 || $1 == nan, string(), rev(@-I$1..@0$1)); E |---+| | value | difference | |---+| |12 || |15 | [0, 0] | | || |83 | [0, nan, 0, 0] | | || | || | || |87 | [0, nan, nan, nan, 0, nan, 0, 0] | | || | || | || |85 | [0, nan, nan, nan, 0, nan, nan, nan, 0, nan, 0, 0] | | || |---+| #+TBLFM: $2 = if(vlen(@-I$1..@0$1) == 1 || $1 == nan, string(), 0 * rev(@-I$1..@0$1)); E Distance to previous element: |---+| | value | difference | |---+| |12 || |15 | 1 | | || |83 | 2 | | || | || | || |87 | 4 | | || | || | || |85 | 4 | | || |---+| #+TBLFM: $2 = if(vlen(@-I$1..@0$1) == 1 || $1 == nan, string(), find(0 * rev(@-I$1..@0$1), 0, 2) - 1); E Previous element: |---+| | value | difference | |---+| |12 || |15 | 12 | | || |83 | 15 | | || | || | || |87 | 83 | | || | || | || |85 | 87 | | || |---+| #+TBLFM: $2 = if(vlen(@-I$1..@0$1) == 1 || $1 == nan, string(), subscr(rev(@-I$1..@0$1), find(0 * rev(@-I$1..@0$1), 0, 2)); E Combined: |---+| | value | difference | |---+| |12 || |15 | 3 | | || |83 | 34 | | || | || | || |87 | 1 | | || | || | || |85 | -0.5 | | || |---+| #+TBLFM: $2 = if(vlen(@-I$1..@0$1) == 1 || $1 == nan, string(), ($1 - subscr(rev(@-I$1..@0$1), find(0 * rev(@-I$1..@0$1), 0, 2))) / (find(0 * rev(@-I$1..@0$1), 0, 2) - 1)); E Looks very interesting. I have to evaluate
Re: [O] Tests do not work
2014-06-01 23:14 GMT+02:00 Bastien b...@gnu.org: Achim Gratz strom...@nexgo.de writes: Cecil Westerhof writes: find: `testing': No such file or directory That tells you that the testing directory doesn't exist. Since you seem to be trying the install from a distribution tarball, this is correct: there simply is no testing directory there which means you cannot run the tests. But why is make test available from the tarball then? Exactly: when there are no tests, there should be no ‘make test’. -- Cecil Westerhof
Re: [O] Tests do not work
2014-06-02 13:36 GMT+02:00 Bastien b...@gnu.org: Hi, Cecil Westerhof cldwester...@gmail.com writes: Exactly: when there are no tests, there should be no ‘make test’. I'd rather add the tests to the Org archives. That would be of-course a better solution. :-D -- Cecil Westerhof
Re: [O] Tests do not work
2014-06-02 20:17 GMT+02:00 Achim Gratz strom...@nexgo.de: Bastien writes: I'd rather add the tests to the Org archives. Done. I just downloaded again from: http://orgmode.org/ But get the same error as before. -- Cecil Westerhof
Re: [O] Tests do not work
2014-06-03 12:11 GMT+02:00 Bastien b...@gnu.org: Cecil Westerhof cldwester...@gmail.com writes: I just downloaded again from: http://orgmode.org/ But get the same error as before. As the website says, the tarballs that you download from http://orgmode.org are built from the latest stable version, which is currently 8.2.6. Achim fixed this for the next stable version, which is not released. I interpreted: I'd rather add the tests to the Org archives. That they where added to the current one. But no problem: I can wait till the next release. :-) -- Cecil Westerhof
[O] Can this table formula be done more efficient
At the moment I am using the following formula: #+TBLFM: @$4..@$4 = $2 - $3 :: @$2=vsum(@$2..@$2) :: @$3=vsum(@$3..@$3) :: @$4=vsum(@$4..@$4) This does what I want, but there are two things that could be improved. - The second, third and fourth formula do exactly the same, only on different columns. Could this be rewritten to one formula? - The line becomes long and hard to evaluate for a person. Is there a possibility to put the formulas below each-other? -- Cecil Westerhof
Re: [O] Can this table formula be done more efficient
2014-06-08 15:07 GMT+02:00 Eric Schulte schulte.e...@gmail.com: Nick Dokos ndo...@gmail.com writes: Cecil Westerhof cldwester...@gmail.com writes: At the moment I am using the following formula: #+TBLFM: @$4..@$4 = $2 - $3 :: @$2=vsum(@$2..@$2) :: @$3=vsum(@$3..@$3) :: @$4=vsum(@$4..@$4) This does what I want, but there are two things that could be improved. - The second, third and fourth formula do exactly the same, only on different columns. Could this be rewritten to one formula? --8---cut here---start-8--- #+TBLFM: @$4..@$4 = $2 - $3 :: @$2..$4=vsum(@$0..@$0) --8---cut here---end---8--- See (info (org) References) - The line becomes long and hard to evaluate for a person. Is there a possibility to put the formulas below each-other? I don't believe so but my belief may be out of date. It has been discussed before: check the list archives. Sort of but not really. See Using multiple #+TBLFM lines in the manual. That I found. Is handy, but only for debugging. But with the shortened formula line, it is less of a problem. -- Cecil Westerhof
[O] Only display hours and minutes, not seconds
I have the following table: |--| | Duration | |--| | 2@ 15| | 2@ 30| | 2@ 30| | 0@ 45| |--| | 8@ 0' 0 | |--| #+TBLFM: @$1=vsum(@2..@-1) I would like the total be displayed like: 8@ 00' instead of: 8@ 0' 0 Is this possible? -- Cecil Westerhof
[O] Adding and subtracting from clocked entries.
I am trying out clock in org-mode. Is it possible to add en subtract times? For example I am working on project A from 09:00 until 13:00. But during this period I also worked for fifteen minutes on project B. I would like to subtract those fifteen minutes from project A and add them to project B. Can this be done? -- Cecil Westerhof
Re: [O] Adding and subtracting from clocked entries.
2013/11/4 Pete Ley peteley11...@gmail.com Cecil Westerhof cldwester...@gmail.com writes: As far as I know, you can do exactly this (the subtracting clock time from one tree and adding it to another) but it's triggered on idle time, so if you're working on something else in emacs it won't ask you to resolve your idle clock time. I am still working, so it will not work I am afraid.
Re: [O] Adding and subtracting from clocked entries.
2013/11/4 Bastien b...@gnu.org For example I am working on project A from 09:00 until 13:00. But during this period I also worked for fifteen minutes on project B. I would like to subtract those fifteen minutes from project A and add them to project B. Can this be done? I assume you stopped the clock on A, then started it on B, then stopped it on B, then restarted it on A. In this case, go to the end of the B clock timestamp, put the point on the HH:MM string, and hit S-M-down three times, so that the clock sum for B is zero, and the clock sum for A is added 15 minutes. Not exactly, but that is what I could do. I am going to try it out. Thank you very much. -- Cecil Westerhof
Re: [O] Adding and subtracting from clocked entries.
2013/11/5 Cecil Westerhof cldwester...@gmail.com 2013/11/4 Bastien b...@gnu.org For example I am working on project A from 09:00 until 13:00. But during this period I also worked for fifteen minutes on project B. I would like to subtract those fifteen minutes from project A and add them to project B. Can this be done? I assume you stopped the clock on A, then started it on B, then stopped it on B, then restarted it on A. In this case, go to the end of the B clock timestamp, put the point on the HH:MM string, and hit S-M-down three times, so that the clock sum for B is zero, and the clock sum for A is added 15 minutes. It works, but it gives pollution. It take the last minutes from B and put them to A. (And it was somewhere in the middle I spend the time.) Also when I have worked on two other projects while working on the project, it does not work of-course. Adding can be done by something like: CLOCK: [2013-11-05 Tue 00:00]--[2013-11-05 Tue 00:15] = 0:15 CLOCK: [2013-11-05 Tue 00:00]--[2013-11-05 Tue 00:15] = 0:15 This works, two times 15 minutes is added, but sadly this does not work: CLOCK: [2013-11-05 Tue 00:15]--[2013-11-05 Tue 00:00] = -0:15 -- Cecil Westerhof
[O] (no subject)
At the moment I get something like this: * Hours Today #+BEGIN: clocktable :maxlevel 2 :scope subtree Clock summary at [2013-11-04 Mon 15:53] | Headline | Time | | |---++--| | *Total time* | *6:35* | | |---++--| | Hours Today | 6:35 | | | Workshop shell scripting || 2:12 | | Security Intake || 2:39 | | Internal Project || 1:44 | #+END: *** Workshop shell scripting CLOCK: [2013-11-04 Mon 13:49]--[2013-11-04 Mon 13:56] = 0:07 CLOCK: [2013-11-04 Mon 11:03]--[2013-11-04 Mon 11:55] = 0:52 CLOCK: [2013-11-04 Mon 08:45]--[2013-11-04 Mon 09:58] = 1:13 *** Security Intake CLOCK: [2013-11-04 Mon 15:05]--[2013-11-04 Mon 15:45] = 0:40 CLOCK: [2013-11-04 Mon 13:56]--[2013-11-04 Mon 14:01] = 0:05 CLOCK: [2013-11-04 Mon 11:55]--[2013-11-04 Mon 13:49] = 1:54 *** Internal Project CLOCK: [2013-11-04 Mon 14:26]--[2013-11-04 Mon 15:05] = 0:39 CLOCK: [2013-11-04 Mon 09:58]--[2013-11-04 Mon 11:03] = 1:05 But because ‘Hours Today’ already is a summation, I would like to get something like this: * Hours Today #+BEGIN: clocktable :maxlevel 2 :scope subtree Clock summary at [2013-11-04 Mon 15:53] |---++--| | Hours Today | 6:35 | | |---++--| | Workshop shell scripting || 2:12 | | Security Intake || 2:39 | | Internal Project || 1:44 | |---++--| #+END: *** Workshop shell scripting CLOCK: [2013-11-04 Mon 13:49]--[2013-11-04 Mon 13:56] = 0:07 CLOCK: [2013-11-04 Mon 11:03]--[2013-11-04 Mon 11:55] = 0:52 CLOCK: [2013-11-04 Mon 08:45]--[2013-11-04 Mon 09:58] = 1:13 *** Security Intake CLOCK: [2013-11-04 Mon 15:05]--[2013-11-04 Mon 15:45] = 0:40 CLOCK: [2013-11-04 Mon 13:56]--[2013-11-04 Mon 14:01] = 0:05 CLOCK: [2013-11-04 Mon 11:55]--[2013-11-04 Mon 13:49] = 1:54 *** Internal Project CLOCK: [2013-11-04 Mon 14:26]--[2013-11-04 Mon 15:05] = 0:39 CLOCK: [2013-11-04 Mon 09:58]--[2013-11-04 Mon 11:03] = 1:05 Is that possible? -- Cecil Westerhof
[O] Latex export does not work
I am trying a LaTeX export, but I get the following error: org-babel-exp processing... executing Dot code block... Wrote /tmp/babel-18129i9i/ob-input-18129Nzr Code block evaluation complete. Saving file /home/cecil/Documents/shell-scripting.tex... Wrote /home/cecil/Documents/shell-scripting.tex Processing LaTeX file ./shell-scripting.tex... org-latex-compile: PDF file ./shell-scripting.pdf wasn't produced: [LaTeX error] Not very clear. What could be the problem? -- Cecil Westerhof
Re: [O] Latex export does not work
2013/11/6 Cecil Westerhof cldwester...@gmail.com I am trying a LaTeX export, but I get the following error: org-babel-exp processing... executing Dot code block... Wrote /tmp/babel-18129i9i/ob-input-18129Nzr Code block evaluation complete. Saving file /home/cecil/Documents/shell-scripting.tex... Wrote /home/cecil/Documents/shell-scripting.tex Processing LaTeX file ./shell-scripting.tex... org-latex-compile: PDF file ./shell-scripting.pdf wasn't produced: [LaTeX error] Not very clear. What could be the problem? I saw that there was an error that wrapfig.sty was not found. I installed texlive-wrapfig and problem solved. I am only getting a message: ! Package inputenc Error: Unicode char \u8:- not set up for use with LaTeX. But that should be solvable. -- Cecil Westerhof
Re: [O] Latex export does not work
2013/11/6 Cecil Westerhof cldwester...@gmail.com I am only getting a message: ! Package inputenc Error: Unicode char \u8:- not set up for use with LaTeX. But that should be solvable. I solved that by changing in my .tex file: \usepackage[utf8]{inputenc} to: \usepackage[utf8x]{inputenc} and running pdflatex. Is there a way to get this automatically in the .tex file, so I do not have to change it? -- Cecil Westerhof
Re: [O] Latex export does not work
2013/11/6 Cecil Westerhof cldwester...@gmail.com 2013/11/6 Cecil Westerhof cldwester...@gmail.com I am only getting a message: ! Package inputenc Error: Unicode char \u8:- not set up for use with LaTeX. But that should be solvable. I solved that by changing in my .tex file: \usepackage[utf8]{inputenc} to: \usepackage[utf8x]{inputenc} and running pdflatex. Is there a way to get this automatically in the .tex file, so I do not have to change it? Based on http://orgmode.org/w/?p=org-mode.git;a=commitdiff;h=bb488fa3b1eaa61ea2dfe7238f9da85bc42b0ffb I have: (defcustom org-export-latex-inputenc-alist '(\utf8\ . \utf8x\) ) But still the .tex file contains: \usepackage[utf8]{inputenc} instead of: \usepackage[utf8x]{inputenc} What is the right way to do this? -- Cecil Westerhof
Re: [O] Latex export does not work
2013/11/6 Cecil Westerhof cldwester...@gmail.com I am only getting a message: ! Package inputenc Error: Unicode char \u8:- not set up for use with LaTeX. But that should be solvable. With some trial and error and od I found that there was a strange combination of character codes (226, 136, 146) where there should be a -. After changing that to a -, my problems where solved. -- Cecil Westerhof
Re: [O] (no subject)
2013/11/6 Cecil Westerhof cldwester...@gmail.com I would like to keep things in the three Hours Today. Is there a way to get something like: | Headline | Time | |---+| | *Total time* | *6:35* | |---+| | Workshop shell scripting | 2:12 | | Security Intake | 2:39 | | Internal Project | 1:44 | No. OK. I'll have to live with it, or make a workaround. I solved it with: #+BEGIN: clocktable :maxlevel 1 :scope nil :compact nil And using narrow-region. -- Cecil Westerhof
Re: [O] Only display hours and minutes, not seconds
2013/10/31 Nick Dokos ndo...@gmail.com Cecil Westerhof cldwester...@gmail.com writes: I have the following table: |--| | Duration | |--| | 2@ 15| | 2@ 30| | 2@ 30| | 0@ 45| |--| | 8@ 0' 0 | |--| #+TBLFM: @$1=vsum(@2..@-1) I would like the total be displayed like: 8@ 00' instead of: 8@ 0' 0 Is this possible? You can get close by setting org-calc-default-modes as follows: (setq org-calc-default-modes '(calc-internal-prec 12 calc-float-format (float 8) calc-angle-mode deg calc-prefer-frac nil calc-symbolic-mode nil calc-date-format ( - MM - DD Www ( hh : mm)) calc-display-working-message t calc-hms-format %s@ %02s')) This is the default setting except for calc-hms-format. It does not quite do what you want, but it's close (I expected the %02s to zero-fill on the left, but apparently it does not for the %s format): |--| | Duration | |--| | 2@ 15| | 2@ 30| | 2@ 30| | 0@ 45| |--| | 8@ 0' | |--| #+TBLFM: @$1=vsum(@2..@-1) I never answered. T_T I use the following now in my init: (require 'org-table) (setq org-calc-default-modes (cons 'calc-hms-format (cons '%s@ %02s org-calc-default-modes))) The require is necessary to get org-calc-default-modes defined. The calc-hms-format is not defined, so this works, but I will write a function so also the other values can be changed. The reason I use this, is that this does not have side effects. When the defaults change, your way would have a side effect. The zero fill only works with a number format. That is the reason I can not get it the way I want, but I can live with that. -- Cecil Westerhof
[O] Moving checkbox item to end of list when checked
I have the folowing: * Actions - [ ] A - [ ] B - [ ] C When on A I give ‘C-c C-c’ I get: * Actions - [X] A - [ ] B - [ ] C but I would like to get: * Actions - [ ] B - [ ] C - [X] A Is this possible? If not I could write an alias for it I think. Is there a command for going to the end of the list? -- Cecil Westerhof
Re: [O] Moving checkbox item to end of list when checked
2014/1/22 Nicolas Goaziou n.goaz...@gmail.com but I would like to get: * Actions - [ ] B - [ ] C - [X] A Is this possible? `C-c ^ x' to sort the list by checkbox status. But this is an additional step after ticking the checkbox. If not I could write an alias for it I think. Is there a command for going to the end of the list? Not a command, but an internal function you can explore: `org-list-get-list-end'. I think that the higher-level function `org-list-send-item' would be useful too: (org-list-send-item (line-beginning-position) 'end (org-list-struct)) In a simple case this does exactly what I want. I have to check what happens if it is several layers deep, but it looks certainly very promising. Thanks. -- Cecil Westerhof
Re: [O] Moving checkbox item to end of list when checked
2014/1/22 Cecil Westerhof cldwester...@gmail.com but I would like to get: * Actions - [ ] B - [ ] C - [X] A Is this possible? `C-c ^ x' to sort the list by checkbox status. But this is an additional step after ticking the checkbox. If not I could write an alias for it I think. Is there a command for going to the end of the list? Not a command, but an internal function you can explore: `org-list-get-list-end'. I think that the higher-level function `org-list-send-item' would be useful too: (org-list-send-item (line-beginning-position) 'end (org-list-struct)) In a simple case this does exactly what I want. I have to check what happens if it is several layers deep, but it looks certainly very promising. Thanks. It looks that it goes well also when the list is deeper. I need to do the following things: - check that I am on an element of a list - check that it is a checkbox - check that it is not checked I f I see it correctly this can all be done with (org-list-struct). I'll work it out. -- Cecil Westerhof
[O] org-cycle goes wrong when cursor at the end of the line
I have: * Testing *** Line one *** Line two *** Line tree When in overview mode and with the cursor at the end of the line (after ...), Tab does not work properly. In this case I just got: * Testing... *** Line tree By the way all asterisks are shown, where only the last one should be displayed. In ‘real life’ most often nothing at all happens. Not a biggy, cursor left and problem solved, but it is annoying. I am using: Org-mode version 8.2.1 (8.2.1-dist @ /usr/share/emacs/site-lisp/org/) But that is not really the problem, because it is a problem I have had for quite some time. -- Cecil Westerhof
[O] API problem
To solve a problem I have the following line in an org file: - [ ] B (org-list-set-checkbox (line-beginning-position) (org-list-struct) [X]) ITEM STRUCT CHECKBOX (org-list-send-item (line-beginning-position) 'end (org-list-struct)) ITEM DEST STRUCT Executing the org-list-send-item brings the entry to the end of the list, but executing org-list-set-checkbox does nothing. What am I doing wrong? Because looking at the API I use the right parameters. I also do not get an error message. -- Cecil Westerhof
[O] Fwd: API problem
Did not go to the list. :'( -- Forwarded message -- From: Cecil Westerhof cldwester...@gmail.com Date: 2014/1/22 Subject: Re: API problem To: Nicolas Goaziou n.goaz...@gmail.com 2014/1/22 Nicolas Goaziou n.goaz...@gmail.com To solve a problem I have the following line in an org file: - [ ] B (org-list-set-checkbox (line-beginning-position) (org-list-struct) [X]) ITEM STRUCT CHECKBOX (org-list-send-item (line-beginning-position) 'end (org-list-struct)) ITEM DEST STRUCT Executing the org-list-send-item brings the entry to the end of the list, but executing org-list-set-checkbox does nothing. What am I doing wrong? `org-list-set-checkbox' modifies the structure, i.e., the internal list representation. It doesn't modify the buffer. You would have to apply the new structure to the buffer with `org-list-write-struct'. Just started today to want to do some thing, so I am a tabula rasa. ;-) Anyway, it's much simpler to use `org-toggle-checkbox'. That goes wrong when there is a marked region. I only want to set the current checkbox. So I have to work out how to use org-list-wrte-struct. -- Cecil Westerhof
Re: [O] API problem
2014/1/22 Cecil Westerhof cldwester...@gmail.com 2014/1/22 Nicolas Goaziou n.goaz...@gmail.com To solve a problem I have the following line in an org file: - [ ] B (org-list-set-checkbox (line-beginning-position) (org-list-struct) [X]) ITEM STRUCT CHECKBOX (org-list-send-item (line-beginning-position) 'end (org-list-struct)) ITEM DEST STRUCT Executing the org-list-send-item brings the entry to the end of the list, but executing org-list-set-checkbox does nothing. What am I doing wrong? `org-list-set-checkbox' modifies the structure, i.e., the internal list representation. It doesn't modify the buffer. You would have to apply the new structure to the buffer with `org-list-write-struct'. Just started today to want to do some thing, so I am a tabula rasa. ;-) Anyway, it's much simpler to use `org-toggle-checkbox'. That goes wrong when there is a marked region. I only want to set the current checkbox. So I have to work out how to use org-list-wrte-struct. I have an org-file wth the folowing: - [ ] A (setq struct (org-list-struct)) - [-] B (org-list-get-checkbox 41 struct) - [ ] C (org-list-set-checkbox 41 struct [X]) - [ ] D (org-list-get-checkbox 41 struct) - [ ] E (org-list-write-struct struct (org-list-parents-alist struct)) In A I fill the struct. B displays [-] C displays [X] D displays [X], so the struct is correctly updated. E gives: #marker in no buffer What is going wrong here? -- Cecil Westerhof
Re: [O] API problem
2014/1/22 Nicolas Goaziou n.goaz...@gmail.com Cecil Westerhof cldwester...@gmail.com writes: I have an org-file wth the folowing: - [ ] A (setq struct (org-list-struct)) - [-] B (org-list-get-checkbox 41 struct) - [ ] C (org-list-set-checkbox 41 struct [X]) - [ ] D (org-list-get-checkbox 41 struct) - [ ] E (org-list-write-struct struct (org-list-parents-alist struct)) In A I fill the struct. B displays [-] C displays [X] D displays [X], so the struct is correctly updated. E gives: #marker in no buffer What is going wrong here? See `org-list-write-struct' docstring. Basically, STRUCT doesn't match real structure anymore since step C. You need to provide the original structure as a third argument so `org-list-write-struct' can modify buffer by set difference. (let* ((struct (org-list-struct)) (old (copy-tree struct))) (org-list-set-checkbox (line-beginning-position) struct [X]) (org-list-write-struct struct (org-list-parents-alist struct) old)) This works, so I can continue. But one thing I do not understand. When you do an org-list-write-struct, you want to change the structure. So why is old-struct optional? -- Cecil Westerhof
[O] Fwd: org-cycle goes wrong when cursor at the end of the line
Went wrong agan. :'( I should repair Gnus. -- Forwarded message -- From: Cecil Westerhof cldwester...@gmail.com Date: 2014/1/22 Subject: Re: org-cycle goes wrong when cursor at the end of the line To: Bastien b...@gnu.org 2014/1/22 Bastien b...@gnu.org I have: * Testing *** Line one *** Line two *** Line tree When in overview mode and with the cursor at the end of the line (after ...), Tab does not work properly. In this case I just got: * Testing... *** Line tree I can reproduce this, but hardly count as a bug for me, as when the point is after the ... it means it is after (or on) the Line three and TAB on this line should show it. But in general, you don't want your point to end up after the three dots... I can not reproduce it at the moment, but sometimes the cursor is after the dots when using Tab to fold the tree. Also when you have: * Testing *** Line one *** Line two *** Line three * A long line When testing is closed and you have the cursor at the end of the ‘A long line’, then when you do cursor up, the cursor is after the dots. By the way all asterisks are shown, where only the last one should be displayed. Try this #+STARTUP: hidestars odd That is not the problem. When giving Tab when the cursor is not behind the dots, the asterisks are not shown.It is only a problem when you give a Tab with the cursor after the dots. -- Cecil Westerhof
[O] Check checkbox and move to end of list
The following function does (mostly) what I want: (defun dcbl-check-checkbox-and-move-to-end () (interactive) (save-excursion (let* ((struct (org-list-struct)) (struct-old (copy-tree struct)) (item (line-beginning-position)) (item-checkbox-type (org-list-get-checkbox item struct))) (if (not item-checkbox-type) (message No checkbox found) (if (string-equal item-checkbox-type [X]) (message Checkbox already checked) (org-list-set-checkbox item struct [X]) (org-list-write-struct struct (org-list-parents-alist struct) struct-old) (org-list-send-item item 'end struct)) I defined the following key to use it: (global-set-key [?\C-c ?\M-c]'dcbl-check-checkbox-and-move-to-end) For one reason or another did the following not work: (global-set-key [?\C-c e]'dcbl-check-checkbox-and-move-to-end) A bit strange, because the following does work: (global-set-key [?\C-c t]'dcbl-buffer-to-temp) There is still something to do, because if you have the following: - [ ] A - [-] B [2/3] - [ ] 1 - [X] 2 - [X] 3 - [ ] C - [ ] D - [ ] E And I use the function on 1, I get: - [ ] A - [X] B [2/3] - [X] 2 - [X] 3 - [X] 1 - [ ] C - [ ] D - [ ] E And I want to get: - [ ] A - [ ] C - [ ] D - [ ] E - [X] B [2/3] - [X] 2 - [X] 3 - [X] 1 But that is the following exercise. ;-) I also think it would be a good idea to change (org-list-send-item item 'end struct) to a call to a function. I think it would be useful to have a function to send a item to the end (or begin) of a list. When it could be improved: please let me know. Bastien: if you want to integrate it in org-mode, no problem. -- Cecil Westerhof
Re: [O] API problem
2014/1/22 Nicolas Goaziou n.goaz...@gmail.com See `org-list-write-struct' docstring. Basically, STRUCT doesn't match real structure anymore since step C. You need to provide the original structure as a third argument so `org-list-write-struct' can modify buffer by set difference. (let* ((struct (org-list-struct)) (old (copy-tree struct))) (org-list-set-checkbox (line-beginning-position) struct [X]) (org-list-write-struct struct (org-list-parents-alist struct) old)) I implemented it. See my post: Check checkbox and move to end of list -- Cecil Westerhof
Re: [O] Check checkbox and move to end of list
2014/1/23 Cecil Westerhof cldwester...@gmail.com I also think it would be a good idea to change (org-list-send-item item 'end struct) to a call to a function. I think it would be useful to have a function to send a item to the end (or begin) of a list. I know have the following: (defun dcbl-check-checkbox-and-move-to-end () (interactive) (save-excursion (let* ((struct (org-list-struct)) (struct-old (copy-tree struct)) (item (line-beginning-position)) (item-checkbox-type (org-list-get-checkbox item struct))) (if (not item-checkbox-type) (message No checkbox found) (if (string-equal item-checkbox-type [X]) (message Checkbox already checked) (org-list-set-checkbox item struct [X]) (org-list-write-struct struct (org-list-parents-alist struct) struct-old) (dcbl-move-item-to-end-of-list item)) (defun dcbl-move-item-to-begin-of-list (optional item) (interactive) (save-excursion (when item (goto-char item)) (org-list-send-item (line-beginning-position) 'begin (org-list-struct))) (previous-line)) (defun dcbl-move-item-to-end-of-list (optional item) (interactive) (save-excursion (when item (goto-char item)) (org-list-send-item (line-beginning-position) 'end (org-list-struct (global-set-key [?\C-c ?\M-a]'dcbl-move-item-to-begin-of-list) (global-set-key [?\C-c ?\M-c]'dcbl-check-checkbox-and-move-to-end) (global-set-key [?\C-c ?\M-e]'dcbl-move-item-to-end-of-list) -- Cecil Westerhof
Re: [O] Check checkbox and move to end of list
2014/1/23 Cecil Westerhof cldwester...@gmail.com (defun dcbl-move-item-to-begin-of-list (optional item) (interactive) (save-excursion (when item (goto-char item)) (org-list-send-item (line-beginning-position) 'begin (org-list-struct))) (previous-line)) (defun dcbl-move-item-to-end-of-list (optional item) (interactive) (save-excursion (when item (goto-char item)) (org-list-send-item (line-beginning-position) 'end (org-list-struct There was not enough error checking. Better is: (defun dcbl-move-item-to-begin-of-list (optional item) (interactive) (let ((list nil)) (save-excursion (when item (goto-char item)) (setq list (org-list-struct)) (if (not list) (message Not in a list) (org-list-send-item (line-beginning-position) 'begin list))) (when list (previous-line (defun dcbl-move-item-to-end-of-list (optional item) (interactive) (let ((list nil)) (save-excursion (when item (goto-char item)) (setq list (org-list-struct)) (if (not list) (message Not in a list) (org-list-send-item (line-beginning-position) 'end list) -- Cecil Westerhof
Re: [O] Check checkbox and move to end of list
2014/1/23 Cecil Westerhof cldwester...@gmail.com The following function does (mostly) what I want: (defun dcbl-check-checkbox-and-move-to-end () (interactive) (save-excursion (let* ((struct (org-list-struct)) (struct-old (copy-tree struct)) (item (line-beginning-position)) (item-checkbox-type (org-list-get-checkbox item struct))) (if (not item-checkbox-type) (message No checkbox found) (if (string-equal item-checkbox-type [X]) (message Checkbox already checked) (org-list-set-checkbox item struct [X]) (org-list-write-struct struct (org-list-parents-alist struct) struct-old) (org-list-send-item item 'end struct)) Update of the count in the parent did not go correctly always. This code does the update correct. (Only the last command is appended.) (defun dcbl-check-checkbox-and-move-to-end () (interactive) (save-excursion (let* ((struct (org-list-struct)) (struct-old (copy-tree struct)) (item (line-beginning-position)) (item-checkbox-type (org-list-get-checkbox item struct))) (if (not item-checkbox-type) (message No checkbox found) (if (string-equal item-checkbox-type [X]) (message Checkbox already checked) (org-list-set-checkbox item struct [X]) (org-list-write-struct struct (org-list-parents-alist struct) struct-old) (dcbl-move-item-to-end-of-list item) (org-update-statistics-cookies nil)) -- Cecil Westerhof
[O] Sub-totals
At the moment I have the folowing: |--+--+-| | activity | Time | sub | |--+--+-| | Activity A |3 | | | Activity B |5 | | | Activity C |2 | | | Activity D |7 | | | Activity E |8 | | | Activity F | 12 | | |--+--+-| | Activity 1 |9 | | | Activity 2 |2 | | | Activity 3 |4 | | | Activity 4 |3 | | |--+--+-| | Activity I | 23 | | | Activity II | 51 | | | Activity III | 37 | | |--+--+-| | | 163 | | |--+--+-| #+TBLFM: @$2=vsum(@3..@-1) But I want the following: |--+--+-| | activity | Time | sub | |--+--+-| | Activity A |3 | | | Activity B |5 | | | Activity C |2 | | | Activity D |7 | | | Activity E |8 | | | Activity F | 12 | 34 | |--+--+-| | Activity 1 |9 | | | Activity 2 |2 | | | Activity 3 |4 | | | Activity 4 |3 | 18 | |--+--+-| | Activity I | 23 | | | Activity II | 51 | | | Activity III | 37 | 111 | |--+--+-| | | 163 | | |--+--+-| #+TBLFM: @$2=vsum(@3..@-1) Subtotals from every range is calculated. Preferable from second to second last, so it goes OK when a range is added. Is this possible? -- Cecil Westerhof
Re: [O] Sub-totals
2014-02-15 16:19 GMT+01:00 Michael Brand michael.ch.br...@gmail.com: What about this?: |--+--+-| | activity | Time | sub | |--+--+-| | Activity A |3 | | |--+--+-| | Activity B |5 | 34 | | Activity C |2 | 34 | | Activity D |7 | 34 | | Activity E |8 | 34 | | Activity F | 12 | 34 | |--+--+-| | Activity 1 |9 | 18 | | Activity 2 |2 | 18 | | Activity 3 |4 | 18 | | Activity 4 |3 | 18 | |--+--+-| | Activity I | 23 | 111 | | Activity II | 51 | 111 | | Activity III | 37 | 111 | |--+--+-| | | 163 | | |--+--+-| #+TBLFM: @$2 = vsum(@..@) :: @$3..@$3 = vsum(@-I$2..@+I$2) It is certainly a big step in the right direction. I have to study it to understand what it does. (You also changed the part I already had. I have to look to see why that is better.) There are a few problems with it: - As your example shows, the first element is not filled and when the first range only has one element ... - I would like to have only the last element of the range filled. But it is certainly helpful: thanks. -- Cecil Westerhof
Re: [O] Sub-totals
2014-02-15 18:14 GMT+01:00 Cecil Westerhof cldwester...@gmail.com: 2014-02-15 16:19 GMT+01:00 Michael Brand michael.ch.br...@gmail.com: What about this?: |--+--+-| | activity | Time | sub | |--+--+-| | Activity A |3 | | |--+--+-| | Activity B |5 | 34 | | Activity C |2 | 34 | | Activity D |7 | 34 | | Activity E |8 | 34 | | Activity F | 12 | 34 | |--+--+-| | Activity 1 |9 | 18 | | Activity 2 |2 | 18 | | Activity 3 |4 | 18 | | Activity 4 |3 | 18 | |--+--+-| | Activity I | 23 | 111 | | Activity II | 51 | 111 | | Activity III | 37 | 111 | |--+--+-| | | 163 | | |--+--+-| #+TBLFM: @$2 = vsum(@..@) :: @$3..@$3 = vsum(@-I$2..@+I$2) It is certainly a big step in the right direction. I have to study it to understand what it does. (You also changed the part I already had. I have to look to see why that is better.) There are a few problems with it: - As your example shows, the first element is not filled and when the first range only has one element ... - I would like to have only the last element of the range filled. But it is certainly helpful: thanks. When looking better I saw there was a nasty bug. The following works and gets rid of the first 'problem': |--+--+-| | activity | Time | sub | |--+--+-| | Activity A |3 | 3 | |--+--+-| | Activity B |5 | 34 | | Activity C |2 | 34 | | Activity D |7 | 34 | | Activity E |8 | 34 | | Activity F | 12 | 34 | |--+--+-| | Activity 1 |9 | 18 | | Activity 2 |2 | 18 | | Activity 3 |4 | 18 | | Activity 4 |3 | 18 | |--+--+-| | Activity I | 23 | 111 | | Activity II | 51 | 111 | | Activity III | 37 | 111 | |--+--+-| | | 166 | | |--+--+-| #+TBLFM: @$2 = vsum(@..@) :: @$3..@$3 = vsum(@-I$2..@+I$2) -- Cecil Westerhof
Re: [O] Sub-totals
2014-02-16 10:06 GMT+01:00 Michael Brand michael.ch.br...@gmail.com: - I would like to have only the last element of the range filled. I always thought that this would not be possible with reasonable effort. Your question made me think again and it is possible, now I can change my own use cases with sub-total :-) . See docstring and take the procedure with vlen etc. from the TBLFM of the new ERT test-org-table/sub-total here: http://orgmode.org/w/org-mode.git?p=org-mode.git;a=blob;f=testing/lisp/test-org-table.el Or read the docstring there and just take this copy that I used to build the ERT: |---+---+---| | Item | Item | Sub- | | name | value | total | |---+---+---| | a1| 4.1 | | | a2| 8.2 | | | a3| | 12.3 | |---+---+---| | b1| 16.0 | 16.0 | |---+---+---| | c1|32 | | | c2|64 | 96.0 | |---+---+---| | Total | 124.3 | | |---+---+---| #+TBLFM: @$2 = vsum(@II..@) :: $3 = if(vlen(@-I$2..@0$2) == vlen(@-I$2..@+I$2), vsum(@-I$2..@+I$2) +.0, string()); EN f-1 :: @$3 = string() I made: #+TBLFM: @$2 = vsum(@..@) :: @$3..@$3 = if(vlen(@-I$2..@0$2) == vlen(@-I$2..@+I$2), vsum(@-I$2..@+I$2), string()) -- Cecil Westerhof
[Orgmode] export to html
I understood that a table can be exported to HTML. I can not find how to do this. How do I do this? -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] table heading
I would like the following functionality: A heading with ! text || ! heading | |---+---| | column A | column B | |---+---| and it changes automatically: || ! heading | |---+---+--| | column A | column B | column C | |---+---+--| I allready communicated with Carsten about this. He liked the idea, but did not like to add another column seperator. -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Does org-mode work less under Windows?
At home I use org-mode with Emacs 21.3.1 under Linux. At work I use Emacs 22.0.50.1 under Windows. But severall things work less at work. Links do not work as they should. I keep seeing [[link][description]]. Also hidestars and odd does not work. Anybody an idea what is ahppening here? -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Does org-mode work less under Windows?
Op za, 16-06-2007 te 18:38 +1000, schreef Charles Cave: I run Org Mode version 4.77 on Emacs 22.1.1 on Windows XP Service Pack 2 Is that GNU Emacs or Xemacs you are using? I am not at work now. I'll be there at tuesday. I'll look then. Hidestars definitely works. The beginning of my files look like: #+STARTUP: overview #+STARTUP: hidestars I have the same I think. Perhaps you could send a (small) sample of an org-mode file that demonstrates the problem? Will be tuesday. -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Problem with lisp code in spreadsheet
In a row I have the following formula's: =$3 ='(getHours $2);%.2f ='(/ 67 0.72);%.1f ='(/ $3 (getHours $2));%.1f This gives: 67 0.72 93.1 0.0 I would expect the last two to return the same number. Why is this not the case? When I change the last formula to: ='(/ 67 (getHours $2));%.1f I get: 93.5 What is happening here? -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Problem with lisp code in spreadsheet
Op zo, 17-06-2007 te 00:14 +0200, schreef Carsten Dominik: In a row I have the following formula's: =$3 ='(getHours $2);%.2f ='(/ 67 0.72);%.1f ='(/ $3 (getHours $2));%.1f This gives: 67 0.72 93.1 0.0 I would expect the last two to return the same number. Why is this not the case? When I change the last formula to: ='(/ 67 (getHours $2));%.1f I get: 93.5 What is happening here? Since I don't know exactly what getHours does, I cannot be sure. The most likely reason though is that $3 and $2 are interpolated into Lisp expressions as strings, not as numbers. The tabel: |+--++-+--++--| | Arnhem | 0:43 | 67 | 0.0 | 93.1 | 67 | 0.72 | |+--++-+--++--| #+TBLFM: $4='(/ $3 (getHours $2));N%.1f::$5='(/ 67 0.72);%.1f::$6=$3::$7='(getHours $2);%.2f:: getHours: (defun getHours(time) (interactive sHH:MM: ) (let ((timelist (split-string time :))) (+ (string-to-number (car timelist)) (/ (string-to-number (cadr timelist)) 60.0 ) ) ) ) The strange thing is that $3 is 67 and when I change $3 to 67 it works. Even changing the formul to: ='(/ (string-to-number $3) (getHours $2));N%.1f does not work. See the discussion of the N mode flag in http://staff.science.uva.nl/~dominik/Tools/org/org.html#Formula-syntax- for-Lisp The problem is with $3, so I would not know how to use that. :-{ -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Sorting of table
When there is nothing marked, sorting should be done on the field the cursor is on from the row after the previous hline until the row before the next hline. -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Links en subtrees
When a subtree starts with a link and it is collapsed, you get not to see the '...' when the subtree is collapsed. A workaround is to put a space after the link. -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Problems with org-mode under windows
#+STARTUP: hidestars #+STARTUP: overview #+STARTUP: odd * links ** [[http://staff.science.uva.nl/~dominik/Tools/org/][org-mode]] This is a part of an org-file I have. There are severall problems with this under Windows. I use version 22.0.50.1 under Windows. Under Linux I use a 21 version and do not have these problems. The problems are: - I see al the stars. - When indenting a level more, it should go from one star to three stars, but it goes two two stars. - The link should be displayed as only org-mode, but everything is displayed. Anybody an idea what is happening here? ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Strange problem with spreadsheet
I have the following tables: |---| | 22.50 | | 16.50 | |---| | :=vsum(@[EMAIL PROTECTED]) | |---| #+TBLFM: @3$1=vsum(@[EMAIL PROTECTED]) || | 22.50 | | 16.50 | || | :=vsum(@[EMAIL PROTECTED]);%.2f | || #+TBLFM: @3$1=vsum(@[EMAIL PROTECTED]);%.2f With the first I get '39.' when I let the table be evaluated. But I want 39.00. That is why I created the second table. But here I get on evaluation: 'Args out of range: 15,16'. I have the feeling that it could have something to do with the upgrade to 4.78, but I am not sure. (Before I was using 4.71.) -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Get al formula's in the table
When you want to edit a formula, you give 'C-u C-u C-c ='. What would be nice is a combination with wich al the formula's are put back into the cell's. -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] how to clear computed values
Op di, 10-07-2007 te 20:38 +0200, schreef Cecil Westerhof: I have a table like: |-+-+-++---+--+| | kmstand |km's | prijs/l | liters | prijs | prijs/km | km/l | |-+-+-++---+--+| | 155111 | 0 | || 0.00 | -0.000 | 0.000 | | 156146 |1035 | 102.2 | 62.25 | 63.62 |6.147 | 16.627 | | | -156146 | || 0.00 | -0.000 | 0.000 | |-+-+-++---+--+| #+TBLFM: $2='(and @-1$-1 $1 (- $1 @-1$-1));N::$5='(and $3 $4 (/ (* $3 $4) 100));N%.2f::$6='(and $2 $5 (/ (* $5 100) $2));N%.3f::$7='(and $2 $4 (/ $2 $4));N%.3f When there is nothing to display, there is now a '0' displayed, but I would prefer it to be empty. Is this possible? Also, why is prijs/km displayed as '-0.000'? And why is the last field of km's displayed as '-156146'? I expected '0'. I have been playing a little bit more and made this: |+-++++-+-++---+--+| | datum | kmstand ||||km's | prijs/l | liters | prijs | prijs/km | km/l | |+-++++-+-++---+--+| || 155111 | 155111 | 155111 | 155111 | 0 | | | 0.00 | -0.000 | 0.000 | | 2007-07-09 | 156146 | 155111 | 156146 | 156146 |1035 | 102.2 | 62.25 | 63.62 |6.147 | 16.627 | || | 156146 | 0 | 0 | -156146 | | | 0.00 | -0.000 | 0.000 | || | 0 | 0 | 0 | 0 | | | 0.00 | -0.000 | 0.000 | |+-++++-+-++---+--+| #+TBLFM: [EMAIL PROTECTED];N::$4=$2::$5='(and @-1$2 $2);N::$6='(if (and @-1$2 $2) (- $2 @-1$2) (0));N::$9='(and $7 $8 (/ (* $7 $8) 100));N%.2f::$10='(and $6 $9 (/ (* $9 100) $6));N%.3f::$11='(and $6 $8 (/ $6 $8));N%.3f If you look at the km's column, I would expect that in the thirth row 0 would be displayed. (The else part.) But the negative value of @-1$2 is displayed. I think this is a bug? Also when adding the fields between kmstand an km's in the km formula @-1$-1 did not change. I would expect it to change to @-1$-4. Or is there a reason for this behaviour? -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] how to clear computed values
Op wo, 11-07-2007 te 08:15 +0200, schreef Carsten Dominik: If you want to understand why things come out the way they do, use formular debugging (this is an option in the menu, but cou can also toggle it with `C-C {'). When you then execute calculations in the table (for example with `C-u C-c C-c') you will get detailed information about variable substitution, and you will see the final expression that gets evaluated. That is a good tip. ;-} For example, you are trying things like (and $1 $2 ... but of course both the empty string and the number 0 are true in Lisp, the only thing false in Lisp is nil. That explains my problems. If you want to fix it, you can, by *really* taking control. For example, define the following function that tests if a value is not zero (defun nz (n) (not (= n 0.))) and then write your table like this: |-+--+-++---+--+| | kmstand | km's | prijs/l | liters | prijs | prijs/km | km/l | |-+--+-++---+--+| | 155111 | | || | || | 156146 | 1035 | 102.2 | 62.25 | 63.62 |6.147 | 16.627 | | | | || | || |-+--+-++---+--+| #+TBLFM: $2='(if (and (nz @-1$-1) (nz $1) ( $1 @-1$-1)) (- $1 @-1$-1) );N::$5='(if (and (nz $3) (nz $4)) (format %.2f (/ (* $3 $4) 100)) );N::$6='(if (and (nz $2) (nz $5)) (format %.3f (/ (* $5 100) $2)) );N::$7='(if (and (nz $2) (nz $4)) (format %.3f (/ $2 $4)) );N That works perfect. Yes, those equations look longish - use the formula editor to edit them. That is also a nice tool yes. Also, consider to put the # marker in the first column, to get this table to recompute automatically while you step through with TAB. Use C-# in the first data line to insert the # if you want to make sure that your existing formulas are modified to reflect the new column numbers. The result will be this: That is also very usefull. Hope this helps. It certainly did. I made another improvement. It would be nice to have a notification when there is a problem with kmstand. I made the folowing: |---++-+---+-++---+--+| | | datum | kmstand | km's | prijs/l | liters | prijs | prijs/km | km/l | |---++-+---+-++---+--+| | # || 155111 | Verkeerde kmstand | || | || | # | 2007-07-09 | 156146 | 1035 | 102.2 | 62.25 | 63.62 |6.147 | 16.627 | | # ||6953 | Verkeerde kmstand | || | || | # || | | || | || |---++-+---+-++---+--+| #+TBLFM: $4='(if (and (nz @-1$3) (nz $3)) (if ( $3 @-1$3) (- $3 @-1$3) Verkeerde kmstand) );N::$7='(if (and (nz $5) (nz $6)) (format %.2f (/ (* $5 $6) 100)) );N::$8='(if (and (nz $4) (nz $7)) (format %.3f (/ (* $7 100) $4)) );N::$9='(if (and (nz $4) (nz $6)) (format %.3f (/ $4 $6)) );N In this example the first two digits of kmstand where not input at row 3 and you get a message. But you get also a message at the first row. Is it possible to circumvent this? Is it possible to define functions in an org-file? For example: it would be nice to have more extensive checking on the values. Also the nz could be defined. It is in my .emacs now, but when I transfer the file to another computer, there is a risk that it doe not work anymore. It would be nice if I did input kmstand that with tab you go to prijs/l. (Skipping fields with formula's.) And when giving tab on the field liters going to the field kmstand. Is that something that could be made? -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] how to clear computed values
Op wo, 11-07-2007 te 10:49 +0200, schreef Carsten Dominik: On Jul 11, 2007, at 10:26, Cecil Westerhof wrote: In this example the first two digits of kmstand where not input at row 3 and you get a message. But you get also a message at the first row. Is it possible to circumvent this? For example by leaving an empty row before the first data line. That works. I hoped that it was possible to see you are on the first line after a hline, but this is good enough. Is it possible to define functions in an org-file? For example: it would be nice to have more extensive checking on the values. Also the nz could be defined. It is in my .emacs now, but when I transfer the file to another computer, there is a risk that it doe not work anymore. You can, by inserting something like # Local Variables: # eval: (defun nz (n) (not (= 0 n))) # eval: (defun nw (s) (string-match \\S- s)) # End: Check the variable `enable-local-eval', and beware that setting it to t could be exploited to execute unwanted code in a file you get from someone. One problem would be that function definitions are not buffer-local, so the same functions would be defined for all buffers. If you use functions with the same name, but different definitions in different files, the result would depend on the order of visiting the files. Better not then I think. It would be nice if I did input kmstand that with tab you go to prijs/l. (Skipping fields with formula's.) And when giving tab on the field liters going to the field kmstand. Is that something that could be made? I don't think this is necessary, and no spreadsheet behaves like this. Just press TAB a few times. Cetrainly not. Just nice to have. Maybe something to try myself to build. -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] how to clear computed values
Op wo, 11-07-2007 te 12:19 +0200, schreef Carsten Dominik: That works. I hoped that it was possible to see you are on the first line after a hline, but this is good enough. Of course this is possible, you are using Lisp: (defun check-if-after-hline () (save-excursion (beginning-of-line 0) (looking-at org-table-hline-regexp))) Okay, now it is: |---++-+---+-++---+--+| | | datum | kmstand | km's | prijs/l | liters | prijs | prijs/km | km/l | |---++-+---+-++---+--+| | # || 155111 | | || | || | # | 2007-07-09 | 156146 | 1035 | 102.2 | 62.25 | 63.62 |6.147 | 16.627 | | # | 2007-07-11 |6953 | Verkeerde kmstand | || | || | # || | | || | || |---++-+---+-++---+--+| #+TBLFM: $4='(if (and (nz @-1$3) (nz $3)) (if ( $3 @-1$3) (- $3 @-1$3) (if (not (check-if-after-hline)) Verkeerde kmstand )) );N::$7='(if (and (nz $5) (nz $6)) (format %.2f (/ (* $5 $6) 100)) );N::$8='(if (and (nz $4) (nz $7)) (format %.3f (/ (* $7 100) $4)) );N::$9='(if (and (nz $4) (nz $6)) (format %.3f (/ $4 $6)) );N This looks perfect. Just one more question. ;-} I would like to display the days between rows. I found time-date.el, but this only works with: The five data representations used are the following: date An RFC822 (or similar) date string. For instance: Sat Sep 12 12:21:54 1998 +0200. time An internal Emacs time. For instance: (13818 26466). seconds A floating point representation of the internal Emacs time. For instance: 905595714.0. days An integer number representing the number of days since 0101. For instance: 729644. decoded time A list of decoded time. For instance: (54 21 12 12 9 1998 6 t 7200). Is there a way to work with dates like 2007-09-11? -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Making a list to string
I have the following table: |---++---++--| | | datum |from datum | hard coded | | |---++---++--| | # | 2007-01-01 | 192 | 1 | [50, 48, 48, 55, 45, 48, 49, 45, 48, 49] | | # | 2007-07-09 | 192 |190 | [50, 48, 48, 55, 45, 48, 55, 45, 48, 57] | | # | 2007-07-11 | 192 |192 | [50, 48, 48, 55, 45, 48, 55, 45, 49, 49] | | # | 2007-09-11 | 192 | 1 | [50, 48, 48, 55, 45, 48, 57, 45, 49, 49] | | # | 20071012 | 192 | 1 | [50, 48, 48, 55, 49, 48, 49, 50] | |---++---++--| #+TBLFM: $3='(time-to-day-in-year (org-read-date t t $2));N::$5=$2::@2$4='(time-to-day-in-year (org-read-date t t 2007-01-01));N::@3$4='(time-to-day-in-year (org-read-date t t 2007-07-09));N::@4$4='(time-to-day-in-year (org-read-date t t 2007-07-11));N::@5$4='(time-to-day-in-year (org-read-date t t 2007-01-01));N:: The column 'from datum' does not get the right values. The last column shows why. $2 gives a list of ASCII values of the string instead of the string. This makes that org-read-data gets 50 as a parameter instead of the string representing a date. How do I convert this list back to the string it is representing? -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Making a list to string
Op wo, 11-07-2007 te 16:59 -0500, schreef Eddward DeVilla: I take that back. I think it is right. I thought hard coded and frodatum were supposed to match. Unfortunately, it looks like the mailed mangles the formula line. On 7/11/07, Eddward DeVilla [EMAIL PROTECTED] wrote: Is this any better. I don't think it's entirely right yet. |---++++| | | datum | from datum | hard coded || |---++++| | # | 2007-01-01 | 1 | 1 | 2007-01-01 | | # | 2007-07-09 |190 |190 | 2007-07-09 | | # | 2007-07-11 |192 |192 | 2007-07-11 | | # | 2007-09-11 |254 | 1 | 2007-09-11 | | # | 20071012 |192 | 1 | 20071012 | |---++++| #+TBLFM: $3='(time-to-day-in-year (org-read-date t t (concat $2)))::$5='(concat $2)::@2$4='(time-to-day-in-year (org-read-date t t 2007-01-01));N::@3$4='(time-to-day-in-year (org-read-date t t 2007-07-09));N::@4$4='(time-to-day-in-year (org-read-date t t 2007-07-11));N::@5$4='(time-to-day-in-year (org-read-date t t 2007-01-01));N Yes, it looks like it works completly. (What I am missing is a knowledge of Lisp. Thus that will come.) One thing bugs me. I am used to end a formula ending with ';N'. Sometimes if you do not do this, this geves an error. But in this case this gives an error: Substitution history of formula Orig: '(time-to-day-in-year (org-read-date t t (concat $2))) $xyz- '(time-to-day-in-year (org-read-date t t (concat $2))) @r$c- '(time-to-day-in-year (org-read-date t t (concat $2))) $1-'(time-to-day-in-year (org-read-date t t (concat 2007))) Result: #ERROR Format: NONE Final: #ERROR When using nothing after the formula, I get: Substitution history of formula Orig: '(time-to-day-in-year (org-read-date t t (concat $2))) $xyz- '(time-to-day-in-year (org-read-date t t (concat $2))) @r$c- '(time-to-day-in-year (org-read-date t t (concat $2))) $1-'(time-to-day-in-year (org-read-date t t (concat #(2007-01-01 0 1 (hilit-chg hilit-chg lazy-lock t) 1 2 (hilit-chg hilit-chg lazy-lock t) 2 3 (hilit-chg hilit-chg lazy-lock t) 3 4 (hilit-chg hilit-chg lazy-lock t) 4 5 (hilit-chg hilit-chg lazy-lock t) 5 6 (hilit-chg hilit-chg lazy-lock t) 6 8 (hilit-chg hilit-chg lazy-lock t) 8 9 (hilit-chg hilit-chg lazy-lock t) 9 10 (hilit-chg hilit-chg lazy-lock t) Result: 1 Format: NONE Final: 1 And when I put ';S' after the formula, I get the same as with nothing after the formula. Why this error by ';N'? Also what is the meaning of the strange expansion by concat? Maybe not neccesary, but I like to understand what is happening. -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Making a list to string
Op do, 12-07-2007 te 01:04 -0500, schreef Eddward DeVilla: On 7/12/07, Cecil Westerhof [EMAIL PROTECTED] wrote: Yes, it looks like it works completly. (What I am missing is a knowledge of Lisp. Thus that will come.) One thing bugs me. I am used to end a formula ending with ';N'. By default the field values are passed to the lisp expression as a string. If you want it to be passed as a number you need the ;N. So if @3$4 = 123: '(foo @3$4) = '(foo 123) '(foo @3$4);N = '(foo 123) I remember Carsten mentioning something about this. I would expect the ';N' have influence on the output, not on the input. -- Cecil Westerhof [EMAIL PROTECTED] ___ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Some problems with times in a spreadsheet
I have the following table: |---+-++| | | Day | ProjectA | ProjectB | |---+-++| | | 14 | 1@ 00' | 1@ 45' | | | 15 | 0@ 30' | 3@ 35' | | | 16 | 0@ 45' | 1@ 00' | | | 17 | 3@ 10' | 2@ 45' | | | 18 | 1@ 55' | 0@ 35' | | | 19 | 5@ 25' | 7@ 25' | | | 20 | 3@ 30' | 1@ 00' | |---+-++| | # | Total hours | 16@ 15' 0 | 18@ 5' 0 | | ^ | | totalTime1 | totalTime2 | |---+-++| #+TBLFM: $totalTime1=vsum(@-i...@-i); f2 :: $totalTime2=vsum(@-i...@-i); f2 The string '0 @ 30' says that there were 0 hours and 30 minutes. I have several problems here. First of all I would like to see 16.25 instead of 16@ 15' 0. Is this possible? Secondly I have to define the formula for each project. In this case there are only two, but when there are fifteen then it becomes a pain. Is there a way to use just one formula? When displaying with minutes instead of as a floating point number, is it possible to display it without seconds? Instead of 16@ 15' 0 I would like to get 16@ 15'. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Some problems with times in a spreadsheet
Op woensdag 21 jul 2010 15:46 CEST schreef Juan: | # | Total hours | 16@ 15' 0 | 18@ 5' 0 | | ^ | | totalTime1 | totalTime2 | |---+-++| #+TBLFM: $totalTime1=vsum(@-i...@-i); f2 :: $totalTime2=vsum(@-i...@-i); f2 First of all I would like to see 16.25 instead of 16@ 15' 0. Is this possible? Calc's deg function does this. use deg(vsum(...)) in the formulas That works. Thanks. I should learn calc. ;-} I now have (I already made changes): |---+-+--+--| | # | Total hours | 14.00| 6.00 | | ^ | | totalTime1 | totalTime2 | | | Hourly rate | 40 | 50 | | ^ | | hourRate1| hourRate2| | # | To declare | 560.00 | 300.00 | | ^ | | declaration1 | declaration2 | |---+-+--+--| #+TBLFM: $totalTime1=deg(vsum(@-i...@-i)); f2 :: $totalTime2=deg(vsum(@-i...@-i)); f2 :: $declaration1=$totalTime1*$hourRate1; f2 :: $declaration2=$totalTime2*$hourRate2; f2 This works. One strange thing (not important I think, but I mention it), I needed to recalculate twice. The first time the 'Total hours' was displayed correctly, only the second time 'To declare' was displayed correctly. I have two formula's that I have to write for every column, I still would like to now if there is a way to only write them once. I am not very happy with the long line of formula's. Especially when I have to repeat formula's. Would something like this be possible? #+TBLFM: $totalTime1=deg(vsum(@-i...@-i)); f2 :: $totalTime2=deg(vsum(@-i...@-i)); f2 :: $declaration1=$totalTime1*$hourRate1; f2 :: $declaration2=$totalTime2*$hourRate2; f2 This would at least make updating repeating formula's easier and easier to check. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Re: Some problems with times in a spreadsheet
Op donderdag 22 jul 2010 10:43 CEST schreef Andreas Burtzlaff: I have two formula's that I have to write for every column, I still would like to now if there is a way to only write them once. No, I'm afraid not. I have to live with it then. I am not very happy with the long line of formula's. Especially when I have to repeat formula's. Would something like this be possible? #+TBLFM: $totalTime1=deg(vsum(@-i...@-i)); f2 :: $totalTime2=deg(vsum(@-i...@-i)); f2 :: $declaration1=$totalTime1*$hourRate1; f2 :: $declaration2=$totalTime2*$hourRate2; f2 The formula editor ( C-c ' ) will display the formulas one per line and make duplicating and changing them much easier. Works like a charm. Not optimal (I need to enter the formula editor to check), but good enough. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Smart vsum
Until now I did not use org-mode for fancy things. One of the things I use is the following table: |---+--+---| | | activity | time | |---+--+---| | * | A| 0@ 10'| | * | B| 0@ 05'| | | C| 0@ 05'| | | D| 0@ 05'| | | E| 0@ 05'| |---+--+---| | # | Totaal | 0.50 | | ^ | | totalTime | |---+--+---| #+TBLFM: $totalTime = deg(vsum(@-i...@-i)); f2 It is just a table with activities and the needed time pro activity. When there is an asterisk in the first column, that means that the activity is already done. I would like a little more fancy table that also displays the time needed for the activities that still have to be done. Like the following: |---+--+---| | | activity | time | |---+--+---| | * | A| 0@ 10'| | * | B| 0@ 05'| | | C| 0@ 05'| | | D| 0@ 05'| | | E| 0@ 05'| |---+--+---| | # | Totaal | 0.50 | | ^ | | totalTime | | # | Totaal | 0.25 | | ^ | | restTime | |---+--+---| #+TBLFM: $totalTime = deg(vsum(@-i...@-i)); f2 Is this possible? If yes, how would I do this? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[O] Error running tests on 8.2.10
I just found out that I was running an old version of org-mode. (Would it not be a good idea to announce new versions? Or did I miss it?) But when running (on Linux): make test I got: install -m 755 -d /tmp/tmp-orgtest TMPDIR=/tmp/tmp-orgtest emacs -batch -Q --eval '(setq vc-handled-backends nil)' --eval '(add-to-list '''load-path ./lisp)' --eval '(add-to-list '''load-path ./testing)' -l org-loaddefs.el -l testing/org-test.el --eval '(require '''ob-awk)' --eval '(require '''ob-C)' --eval '(require '''ob-fortran)' --eval '(require '''ob-maxima)' --eval '(require '''ob-lilypond)' --eval '(require '''ob-octave)' --eval '(require '''ob-python)' --eval '(require '''ob-sh)' --eval '(require '''ob-perl)' --eval '(setq org-confirm-babel-evaluate nil)' -f org-test-run-batch-tests Cannot open load file: testing/org-test.el mk/targets.mk:99: recipe for target 'test' failed make: *** [test] Error 255 It looks like I could just upgrade without a problem, but it would be better when I could run make test without an error. -- Cecil Westerhof
[O] Only showing part of a list
The following is part of an org-file: * Actions [0/30] - [ ] First action - [ ] Second action - [ ] Third action - [ ] Fourth action - [ ] Fifth Action . . . - [ ] Thirtieth action But I am only interested in the first five actions, so I would like it to be displayed like: * Actions [0/30] - [ ] First action - [ ] Second action - [ ] Third action - [ ] Fourth action - [ ] Fifth Action ... Would that (in the future) be possible? -- Cecil Westerhof
Re: [O] Only showing part of a list
2015-03-11 14:23 GMT+01:00 John Kitchin jkitc...@andrew.cmu.edu: Even if it were possible, what would you expect to happen when actions 1-5 were checked off? Should the list show the next 5? How would you expand the list to see all of it? When would it be visible or not? I did not expect a simple answer. ;-) Just something to get started. In principle I think you should normally not see more as five action entries and should (normally) not have the possibility to select new entries to show when there are still more as three entries shown. I have my own function that checks an entry and put it at the end of the list. I personally would want to have to select the new to show entries. Most of the time that would be the next entries, but not always. It sounds like this would be a good case for subheadings, to break up the long check list. Then I get something like: * Actions [0/5] - [ ] First action - [ ] Second action - [ ] Third action - [ ] Fourth action - [ ] Fifth Action - Next actions [0/25] - [ ] Sixth action . . . - [ ] Thirtieth action So I do not see the total amount of actions. (At least not when actions is in overview mode.) Or can that be solved? Cecil Westerhof writes: The following is part of an org-file: * Actions [0/30] - [ ] First action - [ ] Second action - [ ] Third action - [ ] Fourth action - [ ] Fifth Action . . . - [ ] Thirtieth action But I am only interested in the first five actions, so I would like it to be displayed like: * Actions [0/30] - [ ] First action - [ ] Second action - [ ] Third action - [ ] Fourth action - [ ] Fifth Action ... Would that (in the future) be possible? -- Cecil Westerhof
[O] How to place things differently in dot
I was asked to make a diagram and was thinking that dot in org-mode could be a good idea. I got reasonably fast the following: #+BEGIN_SRC dot :file test.svg :cmdline -Kdot -Tsvg graph { utilities [label = Utility's] A B C D E F [shape = rectangle] subgraph cluster_resources { color=blue resources [label = Resources] } G H I K subgraph cluster_ta { color=blue {rank = same; L, M} L M } {rank = same; D, E, F} A -- F B -- F C -- F A -- D F -- E F -- K F -- G F -- H F -- I K -- L K -- M L -- M } #+END_SRC This is a good deal in the right direction, but a few things should be different: - E should be left of F - resource should go to the second 'line' without losing its border - K should be a 'line' lower Are those things possible? As attachment how it looks now. -- Cecil Westerhof
Re: [O] How to place things differently in dot
2015-03-26 23:19 GMT+01:00 Cecil Westerhof cldwester...@gmail.com: 2015-03-26 22:49 GMT+01:00 Nick Dokos ndo...@gmail.com: Cecil Westerhof cldwester...@gmail.com writes: In this way I do not get an empty column. It would be better when K would put between and below H and I, but I think I can live with it. Just put I after K and the subgraph. That works. It is even better when I put both H and I after it. I also found a way to get resources at the correct place. I changed to a digraph: #+BEGIN_SRC dot :file test.png :cmdline -Kdot -Tpng digraph { A B C utilities [label = Utility's] D E F [shape = rectangle] subgraph cluster_resources { color=blue resources [label = Resources] } G G_ [style=invisible] K subgraph cluster_ta { color=blue {rank = same; L, M} L M } H I {rank = same; D, E, F} {rank = same; G_, K} A - F B - F C - F A - D utilities - resources [style=invisible] E - F F - K [dir = back] F - G [dir = back] F - H [dir = back] F - I [dir = back] G - G_ [style=invisible] K - L K - M L - M } #+END_SRC There is only one problem: I see the arrowhead with: utilities - resources and: 'G - G_' Is there a way to get rid of those? -- Cecil Westerhof
Re: [O] How to place things differently in dot
2015-03-26 17:57 GMT+01:00 Cecil Westerhof cldwester...@gmail.com: 2015-03-26 17:07 GMT+01:00 Ken Mankoff mank...@gmail.com: On 2015-03-26 at 11:52, e.fr...@ucl.ac.uk wrote: The graphviz tools are fantastic for quick and dirty graphs but the layout algorithms are not easily controlled... I would highly recommend tikz ... Or perhaps ditaa. It is certainly quick. I wait if they find it acceptable: if not I can always check-out tikz or ditaa. I looked at ditaa and tikz. Especially ditta is very nice. It has document and database elements, but it would also a lot more work to create and especially to maintain. So I hope my dot version is acceptable. -- Cecil Westerhof
Re: [O] How to place things differently in dot
2015-03-26 18:00 GMT+01:00 Thomas S. Dye t...@tsdye.com: Cecil Westerhof cldwester...@gmail.com writes: I was asked to make a diagram and was thinking that dot in org-mode could be a good idea. I got reasonably fast the following: #+BEGIN_SRC dot :file test.svg :cmdline -Kdot -Tsvg graph { utilities [label = Utility's] A B C D E F [shape = rectangle] subgraph cluster_resources { color=blue resources [label = Resources] } G H I K subgraph cluster_ta { color=blue {rank = same; L, M} L M } {rank = same; D, E, F} A -- F B -- F C -- F A -- D F -- E F -- K F -- G F -- H F -- I K -- L K -- M L -- M } #+END_SRC This is a good deal in the right direction, but a few things should be different: - E should be left of F - resource should go to the second 'line' without losing its border - K should be a 'line' lower Are those things possible? As a last resort, you can edit the svg file. It did cross my mind, but I am afraid it is not a real option (for me). -- Cecil Westerhof
Re: [O] How to place things differently in dot
2015-03-27 7:57 GMT+01:00 Cecil Westerhof cldwester...@gmail.com: 2015-03-26 23:19 GMT+01:00 Cecil Westerhof cldwester...@gmail.com: 2015-03-26 22:49 GMT+01:00 Nick Dokos ndo...@gmail.com: Cecil Westerhof cldwester...@gmail.com writes: In this way I do not get an empty column. It would be better when K would put between and below H and I, but I think I can live with it. Just put I after K and the subgraph. That works. It is even better when I put both H and I after it. I also found a way to get resources at the correct place. I changed to a digraph: #+BEGIN_SRC dot :file test.png :cmdline -Kdot -Tpng digraph { A B C utilities [label = Utility's] D E F [shape = rectangle] subgraph cluster_resources { color=blue resources [label = Resources] } G G_ [style=invisible] K subgraph cluster_ta { color=blue {rank = same; L, M} L M } H I {rank = same; D, E, F} {rank = same; G_, K} A - F B - F C - F A - D utilities - resources [style=invisible] E - F F - K [dir = back] F - G [dir = back] F - H [dir = back] F - I [dir = back] G - G_ [style=invisible] K - L K - M L - M } #+END_SRC There is only one problem: I see the arrowhead with: utilities - resources and: 'G - G_' Is there a way to get rid of those? I found that also: [style=invisible, arrowhead = none] -- Cecil Westerhof
Re: [O] How to place things differently in dot
2015-03-26 17:07 GMT+01:00 Ken Mankoff mank...@gmail.com: On 2015-03-26 at 11:52, e.fr...@ucl.ac.uk wrote: The graphviz tools are fantastic for quick and dirty graphs but the layout algorithms are not easily controlled... I would highly recommend tikz ... Or perhaps ditaa. It is certainly quick. I wait if they find it acceptable: if not I can always check-out tikz or ditaa. -- Cecil Westerhof
Re: [O] How to place things differently in dot
2015-03-26 21:27 GMT+01:00 Nick Dokos ndo...@gmail.com: Cecil Westerhof cldwester...@gmail.com writes: I was asked to make a diagram and was thinking that dot in org-mode could be a good idea. I got reasonably fast the following: snip This is a good deal in the right direction, but a few things should be different: - E should be left of F - resource should go to the second 'line' without losing its border - K should be a 'line' lower Maybe this will help although it's not a complete implementation of what you have. The idea is to define rows and arrange your nodes into those rows by using rank=same. Then make the row nodes and edges invisible. It's also important to do the sequencing correctly, e.g. in your example, if you just switch F -- E to E -- F, E will be to the left of F as you want. But I don't know how to get the resources subgraph to be treated as a node and thereby place it on the same row as F. In any case, here's the current trial balloon: --8---cut here---start-8--- #+BEGIN_SRC dot :file test2.svg :cmdline -Kdot -Tsvg graph foo { row1--row2--row3--row4 [style=invisible]; row1, row2, row3, row4 [style=invisible]; utilities [label = Utilities] A B C D E F [shape=rectangle] G H I K subgraph cluster_ta { color=blue {rank = same; L, M;} L M } {rank=same; row1 utilities A B C; } {rank=same; row2 D E F;} {rank=same; row3 G H I;} {rank=same; row4 K;} subgraph cluster_resources { resources [label = Resources] graph[color=red]; } A -- F B -- F C -- F A -- D E -- F F -- G F -- H F -- I F -- K K -- L K -- M L -- M } #+END_SRC --8---cut here---end---8--- I did it a little differently: #+BEGIN_SRC dot :file test.png :cmdline -Kdot -Tpng graph { utilities [label = Utility's] A B C D E F [shape = rectangle] subgraph cluster_resources { color=blue resources [label = Resources] } G G_ [style=invisible] H I K subgraph cluster_ta { color=blue {rank = same; L, M} L M } {rank = same; D, E, F} {rank = same; G_, K} A -- F B -- F C -- F A -- D E -- F F -- K F -- G F -- H F -- I G -- G_ [style=invisible] K -- L K -- M L -- M } #+END_SRC In this way I do not get an empty column. It would be better when K would put between and below H and I, but I think I can live with it. -- Cecil Westerhof
Re: [O] How to place things differently in dot
2015-03-26 22:49 GMT+01:00 Nick Dokos ndo...@gmail.com: Cecil Westerhof cldwester...@gmail.com writes: In this way I do not get an empty column. It would be better when K would put between and below H and I, but I think I can live with it. Just put I after K and the subgraph. That works. It is even better when I put both H and I after it. I also found a way to get resources at the correct place. It know becomes: #+BEGIN_SRC dot :file test.png :cmdline -Kdot -Tpng graph { A B C utilities [label = Utility's] D E F [shape = rectangle] subgraph cluster_resources { color=blue resources [label = Resources] } G G_ [style=invisible] K subgraph cluster_ta { color=blue {rank = same; L, M} L M } H I {rank = same; D, E, F} {rank = same; G_, K} A -- F B -- F C -- F A -- D utilities -- resources [style=invisible] E -- F F -- K F -- G F -- H F -- I G -- G_ [style=invisible] K -- L K -- M L -- M } #+END_SRC That looks very good indeed: I think I do not need to start working with ditaa. :-) Everyone thanks for the help. -- Cecil Westerhof
Re: [O] Calculating percentage
2017-07-16 20:32 GMT+02:00 Eric S Fraga <e.fr...@ucl.ac.uk>: > See attached. > Works perfect thanks. -- Cecil Westerhof
[O] Calculating percentage
I have implemented something in different ways. I have the following table: |--+| | Average | Percentage | |--+| | 3.01E+00 || | 7.31E+00 || |--+| | 2.72E+01 || | 4.09E+01 || |--+| | 6.80E+01 || | 7.07E+01 || |--+| | 7.19E+01 || | 9.87E+01 || |--+| The average column is the runtime of the different implementations. The last one is the original implementation. In the percentage column I would like to have the percentage of time compared to the original implementation. So for example the first Percentage field should contain 3 (or 3 %). How would I do this? It would be nice if the last Percentage field stays empty, but that is not necessary. -- Cecil Westerhof
[O] Table format error
I think I found a table format error. I created a table and after formatting it looks like: |---+---+---| | 1 | Text | 2 | |---+---+---| | Some text | Some more | And even more | |---+---+---| Then I copy the last row: |---+---+---| | 1 | Text | 2 | |---+---+---| | Some text | Some more | And even more | | Some text | Some more | And even more | |---+---+---| But when I then format the table, the last heading goes from right aligned to left aligned: |---+---+---| | 1 | Text | 2 | |---+---+---| | Some text | Some more | And even more | | Some text | Some more | And even more | |---+---+---| What is happening here? I am using: Org-mode version 8.2.10. -- Cecil Westerhof
Re: [O] A strange problem with org-babel and SQLite
2018-08-31 13:22 GMT+02:00 Robert Klein : > On Fri, 31 Aug 2018 12:24:33 +0200 > Cecil Westerhof wrote: > > > 2018-08-31 11:17 GMT+02:00 Robert Klein : > > > > > Hi Cecil, > > > > > > On Fri, 31 Aug 2018 10:47:50 +0200 > > > Cecil Westerhof wrote: > > > > > > > I have a strange problem with org-babel and SQLite. > > > > > > > > I have a database that is created with: > > > > CREATE TABLE "quotes" ( > > > > quoteID TEXT PRIMARY KEY, > > > > quote TEXT NOT NULL UNIQUE, > > > > lastUsedTEXT, > > > > totalUsed INT DEFAULT 'unused' > > > > ) > > > > > > > > When using: > > > > #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames yes > > > > SELECT lastUsed > > > > ,totalUsed > > > > FROM quotes > > > > ORDER BY lastused ASC > > > > ,totalUsed DESC > > > > LIMIT40 > > > > #+END_SRC > > > > > > > > Everything is fine. But when I use (add the quote field in the > > > > select): #+BEGIN_SRC sqlite :db > > > > ~/Twitter/twitter.sqlite :colnames yes SELECT quote > > > > ,lastUsed > > > > ,totalUsed > > > > FROM quotes > > > > ORDER BY lastused ASC > > > > ,totalUsed DESC > > > > LIMIT40 > > > > #+END_SRC > > > > > > > > I get: > > > > executing Sqlite code block... > > > > Wrote /tmp/babel-27920y_/ob-input-2792BTG > > > > org-babel-read: End of file during parsing > > > > > > > > What could be the problem? > > > > > > > > > > does it work outside of org/babel/emacs, that is, when you use the > > > query in a command line sqlite session, does it work? “quote” is > > > also a function in sqlite, so this might be your issue. > > > > > > > Yes, in sqlite3 and sqlitebrowser it works without problems. > > In org-babel even 'SELECT *' goes wrong. > > > > I can't reproduce the issue, it works for me. What are your org-mode > and Emacs versions? > GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian Org-mode version 8.2.10 (release_8.2.10 @ /usr/share/emacs/25.1/lisp/org/) > > Can you provide an ECM (Example, complete, minimal) org-mode setup / > Emacs initialization file? > (add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append) ; Make babel results blocks lowercase (setq org-babel-results-keyword "results") (defun bh/display-inline-images () (condition-case nil (org-display-inline-images) (error nil))) (org-babel-do-load-languages (quote org-babel-load-languages) (quote ((emacs-lisp . t) (sqlite . t) (dot . t) (ditaa . t) (R . t) (python . t) (ruby . t) (gnuplot . t) (clojure . t) (sh . t) (ledger . t) (org . t) (plantuml . t) (latex . t ; Do not prompt to confirm evaluation ; This may be dangerous - make sure you understand the consequences ; of setting this -- see the docstring for details (setq org-confirm-babel-evaluate nil) ; Use fundamental mode when editing plantuml blocks with C-c ' (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental))) Is this what you need, or do you need more? -- Cecil Westerhof
[O] English and Dutch version of a Graphviz picture
I have the following: #+BEGIN_SRC dot :file Graphviz/habitLoop.png :cmdline -Kfdp -Tpng digraph habitLoop { bgcolor = steelblue edge [penwidth = 4.0 ] node [fontcolor = white, fontsize = 60, style = filled] spur [pos = "4,4!" color = red] habit [pos = "7,1!" color = darkgreen] reward [pos = "1,1!" color = blue] spur:e -> habit:n habit:w -> reward:e reward:n -> spur:w copyright [ pos = "4,.75!" color = steelblue, fontcolor = black, fontsize = 14, label = "© Cecil Westerhof\ntimemanagem...@decebal.nl", shape = plaintext ] spur [label = "Spur"] habit [label = "Habit"] reward [label = "Reward"] } #+END_SRC But I also want to have a Dutch version. So I also have: #+BEGIN_SRC dot :file Graphviz/gewoonteLoop.png :cmdline -Kfdp -Tpng digraph habitLoop { bgcolor = steelblue edge [penwidth = 4.0 ] node [fontcolor = white, fontsize = 60, style = filled] spur [pos = "4,4!" color = red] habit [pos = "7,1!" color = darkgreen] reward [pos = "1,1!" color = blue] spur:e -> habit:n habit:w -> reward:e reward:n -> spur:w copyright [ pos = "4,.75!" color = steelblue, fontcolor = black, fontsize = 14, label = "© Cecil Westerhof\ntimemanagem...@decebal.nl", shape = plaintext ] spur [label = "Prikkel"] habit [label = "Gewoonte"] reward [label = "Beloning"] } #+END_SRC The only difference are the three label statements. Can this be done more efficient? Because now I need to do updates at two places. That is an accident waiting to happen. -- Cecil Westerhof
Re: [O] English and Dutch version of a Graphviz picture
2018-09-01 17:04 GMT+02:00 Robert Klein : > On Sat, 1 Sep 2018 12:38:54 +0200 > Cecil Westerhof wrote: > > > I have the following: > > #+BEGIN_SRC dot :file Graphviz/habitLoop.png :cmdline -Kfdp -Tpng > > digraph habitLoop { > > bgcolor = steelblue > > edge [penwidth = 4.0 ] > > node [fontcolor = white, fontsize = 60, style = filled] > > > > spur [pos = "4,4!" color = red] > > habit [pos = "7,1!" color = darkgreen] > > reward [pos = "1,1!" color = blue] > > > > spur:e -> habit:n > > habit:w -> reward:e > > reward:n -> spur:w > > > > copyright [ > > pos = "4,.75!" > > color = steelblue, > > fontcolor = black, > > fontsize = 14, > > label = "© Cecil > > Westerhof\ntimemanagem...@decebal.nl", shape = plaintext > > ] > > > > spur [label = "Spur"] > > habit [label = "Habit"] > > reward [label = "Reward"] > > } > > #+END_SRC > > > > But I also want to have a Dutch version. So I also have: > > #+BEGIN_SRC dot :file Graphviz/gewoonteLoop.png :cmdline -Kfdp -Tpng > > digraph habitLoop { > > bgcolor = steelblue > > edge [penwidth = 4.0 ] > > node [fontcolor = white, fontsize = 60, style = filled] > > > > spur [pos = "4,4!" color = red] > > habit [pos = "7,1!" color = darkgreen] > > reward [pos = "1,1!" color = blue] > > > > spur:e -> habit:n > > habit:w -> reward:e > > reward:n -> spur:w > > > > copyright [ > > pos = "4,.75!" > > color = steelblue, > > fontcolor = black, > > fontsize = 14, > > label = "© Cecil > > Westerhof\ntimemanagem...@decebal.nl", shape = plaintext > > ] > > > > spur [label = "Prikkel"] > > habit [label = "Gewoonte"] > > reward [label = "Beloning"] > > } > > #+END_SRC > > > > The only difference are the three label statements. Can this be done > > more efficient? Because now I need to do updates at two places. That > > is an accident waiting to happen. > > > > > There's a complicated solution (like, using variables from tables) at > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-dot.html > > In your case you might want to use noweb (see > https://orgmode.org/org.html#Noweb-reference-syntax). Then your code > might look like this: > > #+Name: habitloop-main > #+BEGIN_SRC dot > bgcolor = steelblue > edge [penwidth = 4.0 ] > node [fontcolor = white, fontsize = 60, style = filled] > > spur [pos = "4,4!" color = red] > habit [pos = "7,1!" color = darkgreen] > reward [pos = "1,1!" color = blue] > > spur:e -> habit:n > habit:w -> reward:e > reward:n -> spur:w > > copyright [ > pos = "4,.75!" > color = steelblue, > fontcolor = black, > fontsize = 14, > label = "© Cecil > Westerhof\ntimemanagem...@decebal.nl", > shape = plaintext > ] > #+END_SRC > > > #+BEGIN_SRC dot :file gewoonteLoop.png :cmdline -Kfdp -Tpng :noweb yes > digraph habitLoop { > <> > spur [label = "Prikkel"] > habit [label = "Gewoonte"] > reward [label = "Beloning"] > } > #+END_SRC > > #+RESULTS: > [[file:gewoonteLoop.png]] > > #+BEGIN_SRC dot :file habitLoop.png :cmdline -Kfdp -Tpng :noweb yes > digraph habitLoop { > <> > spur [label = "Spur"] > habit [label = "Habit"] > reward [label = "Reward"] > } > #+END_SRC > I tried this, but I did not get it to work. Maybe something in my configuration is wrecking havoc on me. I have to play with it a bit more I am afraid. > Note, for better looks I put the whole surrounding block in the > language-specific parts (the “digraph”-line could be in the > “habitloop-main” block, too). > > > When your code gets more involved this can get ugly, fast. Then you'll > probably have to go the elisp way. > For the moment I do not think it will get more involved very soon, but you never know. Maybe the elisp route is not a bad idea. -- Cecil Westerhof
Re: [O] A strange problem with org-babel and SQLite
2018-09-09 14:36 GMT+02:00 Robert Klein : > On Wed, 5 Sep 2018 08:56:02 +0200 > Robert Klein wrote: > > > Hi Cecil, > > > > On Mon, 3 Sep 2018 03:23:17 +0200 > > Cecil Westerhof wrote: > > > > > It has to do with the data. With the following I can reproduce it: > > > #+BEGIN_SRC sqlite :db ~/testingOrgBabel.sqlite :colnames yes > > > DROP TABLE IF EXISTS quotes > > > ; > > > CREATE TABLE "quotes" ( > > > quoteID TEXT PRIMARY KEY, > > > quote TEXT NOT NULL UNIQUE, > > > lastUsedTEXT, > > > totalUsed INT DEFAULT 'unused' > > > ) > > > ; > > > INSERT INTO quotes > > > (quoteID, quote) > > > VALUES > > > ("1230FCF5-B25D-4087-88A4-41DF3AC353DA", '[ > > > "Limitations live only in our minds. > > > But if we use our imaginations, > > > our possibilities become limitless. > > > > > > - Jamie Paolinett", > > > "Hoe gebruik jij je verbeelding om > > > je mogelijkheden te vergroten?" > > > ]'), > > > (2, "Second record.") > > > ; > > > SELECT * > > > FROM quotes > > > ; > > > #+END_SRC > > > > > > When I put a JSON field in the quote field the parsing goes wrong. > > > > > > > > > > umm, yes. Actually what seems to happen is that emacs tries to > > evaluate the JSON part as emacs lisp code, in this case an array. In > > detail, I think, this happens: > > > > > > - org-babel-execute:sqlite (ob-sqlite, line 60) > > calls (for converting the results) > > > > - org-babel-sqlite-table-or-scalar (ob-sqlite, line 133), > > which apparently thinks the result looks like a “trivial table” and > > calls > > > > - org-babel-read (ob-core.el, line 2912), > > which detects the JSON string (begins with a "[ ) as lisp and tries > > to evaluate the lisp form. The call to “read” in line 2927 then > > fails, because there is no closing ] (only the contents on one cell > > is sent to org-babel-read; note, there are no multi-line cells in > > org tables). > > > > > > Line numbers are from Org release_9.1.14-1-g4931fc. > > > > > > > > > > That's no solution of course. To resolve this, > > > > - is there a reason to evaluate table cell contents as lisp code? > > > > If no, > > > > - don't use org-babel-read (in org-babel-sqlite-table-or-scalar) > > - or compare “(org-babel-result-cond...)” code with other ob-*.el > > (ob-sql.el?) and rewrite. > > > > If yes, > > > > - is there a way to check if a string is correct lisp code before > > calling “read”? > > > > > > > > In the “yes” case, there's still the issue of JSON being possibly > > detected as “correct” lisp code (e.g. ["alfa"]). > > > > > > In your case, if you haven't invested too much in the dependency on > > JSON, you might want to redesign the database, e.g. > > > > > > CREATE TABLE "quotes" ( > > quoteID TEXT PRIMARY KEY, > > quote_enTEXT NOT NULL UNIQUE, > > quote_nlTEXT NOT NULL UNIQUE, > > lastUsedTEXT, > > totalUsed INT DEFAULT 'unused' > > ); > > > > > > > > > > Best regards > > Robert > > Hi Cecil, > > could you try to put the following code in your .emacs _after_ > “org-babel-do-load-languages” for ob-sqlite? > > (defun org-babel-read (cell inhibit-lisp-eval) > "Convert the string value of CELL to a number if appropriate. > Otherwise if cell looks like lisp (meaning it starts with a > \"(\", \"\\='\", \"\\=`\" or a \"[\") then read it as lisp, > otherwise return it unmodified as a string. Optional argument > NO-LISP-EVAL inhibits lisp evaluation for situations in which is > it not appropriate." > (if (and (stringp cell) (not (equal cell ""))) > (or (org-babel-number-p cell) > (if (and (not inhibit-lisp-eval) >(or (member (substring cell 0 1) '("(" "'" "`" "[")) >(string= cell "*this*"))) > (eval (read cell)) > (if (and (not inhibit-lisp-eval) > (string= (substring cell 0 1) "\"")) > (read cell)
[O] A strange problem with org-babel and SQLite
I have a strange problem with org-babel and SQLite. I have a database that is created with: CREATE TABLE "quotes" ( quoteID TEXT PRIMARY KEY, quote TEXT NOT NULL UNIQUE, lastUsedTEXT, totalUsed INT DEFAULT 'unused' ) When using: #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames yes SELECT lastUsed ,totalUsed FROM quotes ORDER BY lastused ASC ,totalUsed DESC LIMIT40 #+END_SRC Everything is fine. But when I use (add the quote field in the select): #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames yes SELECT quote ,lastUsed ,totalUsed FROM quotes ORDER BY lastused ASC ,totalUsed DESC LIMIT40 #+END_SRC I get: executing Sqlite code block... Wrote /tmp/babel-27920y_/ob-input-2792BTG org-babel-read: End of file during parsing What could be the problem? -- Cecil Westerhof
Re: [O] A strange problem with org-babel and SQLite
2018-08-31 11:17 GMT+02:00 Robert Klein : > Hi Cecil, > > On Fri, 31 Aug 2018 10:47:50 +0200 > Cecil Westerhof wrote: > > > I have a strange problem with org-babel and SQLite. > > > > I have a database that is created with: > > CREATE TABLE "quotes" ( > > quoteID TEXT PRIMARY KEY, > > quote TEXT NOT NULL UNIQUE, > > lastUsedTEXT, > > totalUsed INT DEFAULT 'unused' > > ) > > > > When using: > > #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames yes > > SELECT lastUsed > > ,totalUsed > > FROM quotes > > ORDER BY lastused ASC > > ,totalUsed DESC > > LIMIT40 > > #+END_SRC > > > > Everything is fine. But when I use (add the quote field in the > > select): #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames yes > > SELECT quote > > ,lastUsed > > ,totalUsed > > FROM quotes > > ORDER BY lastused ASC > > ,totalUsed DESC > > LIMIT40 > > #+END_SRC > > > > I get: > > executing Sqlite code block... > > Wrote /tmp/babel-27920y_/ob-input-2792BTG > > org-babel-read: End of file during parsing > > > > What could be the problem? > > > > does it work outside of org/babel/emacs, that is, when you use the > query in a command line sqlite session, does it work? “quote” is also > a function in sqlite, so this might be your issue. > Yes, in sqlite3 and sqlitebrowser it works without problems. In org-babel even 'SELECT *' goes wrong. -- Cecil Westerhof
Re: [O] A strange problem with org-babel and SQLite
2018-09-01 14:24 GMT+02:00 Robert Klein : > Hi Cecil, > > On Sat, 1 Sep 2018 11:12:57 +0200 > Cecil Westerhof wrote: > > > 2018-08-31 13:22 GMT+02:00 Robert Klein : > > > > > On Fri, 31 Aug 2018 12:24:33 +0200 > > > Cecil Westerhof wrote: > > > > > > > 2018-08-31 11:17 GMT+02:00 Robert Klein : > > > > > > > > > Hi Cecil, > > > > > > > > > > On Fri, 31 Aug 2018 10:47:50 +0200 > > > > > Cecil Westerhof wrote: > > > > > > > > > > > I have a strange problem with org-babel and SQLite. > > > > > > > > > > > > I have a database that is created with: > > > > > > CREATE TABLE "quotes" ( > > > > > > quoteID TEXT PRIMARY KEY, > > > > > > quote TEXT NOT NULL UNIQUE, > > > > > > lastUsedTEXT, > > > > > > totalUsed INT DEFAULT 'unused' > > > > > > ) > > > > > > > > > > > > When using: > > > > > > #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames > > > > > > yes SELECT lastUsed > > > > > > ,totalUsed > > > > > > FROM quotes > > > > > > ORDER BY lastused ASC > > > > > > ,totalUsed DESC > > > > > > LIMIT40 > > > > > > #+END_SRC > > > > > > > > > > > > Everything is fine. But when I use (add the quote field in the > > > > > > select): #+BEGIN_SRC sqlite :db > > > > > > ~/Twitter/twitter.sqlite :colnames yes SELECT quote > > > > > > ,lastUsed > > > > > > ,totalUsed > > > > > > FROM quotes > > > > > > ORDER BY lastused ASC > > > > > > ,totalUsed DESC > > > > > > LIMIT40 > > > > > > #+END_SRC > > > > > > > > > > > > I get: > > > > > > executing Sqlite code block... > > > > > > Wrote /tmp/babel-27920y_/ob-input-2792BTG > > > > > > org-babel-read: End of file during parsing > > > > > > > > > > > > What could be the problem? > > > > > > > > > > > > > > > > does it work outside of org/babel/emacs, that is, when you use > > > > > the query in a command line sqlite session, does it work? > > > > > “quote” is also a function in sqlite, so this might be your > > > > > issue. > > > > > > > > Yes, in sqlite3 and sqlitebrowser it works without problems. > > > > In org-babel even 'SELECT *' goes wrong. > > > > > > > > > > I can't reproduce the issue, it works for me. What are your > > > org-mode and Emacs versions? > > > > > > > GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of > > 2017-09-15, modified by Debian > > Org-mode version 8.2.10 (release_8.2.10 > > @ /usr/share/emacs/25.1/lisp/org/) > > > > > > > > > > Can you provide an ECM (Example, complete, minimal) org-mode setup / > > > Emacs initialization file? > > > > > > > (add-hook 'org-babel-after-execute-hook 'bh/display-inline-images > > 'append) > > > > ; Make babel results blocks lowercase > > (setq org-babel-results-keyword "results") > > > > (defun bh/display-inline-images () > > (condition-case nil > > (org-display-inline-images) > > (error nil))) > > > > (org-babel-do-load-languages > > (quote org-babel-load-languages) > > (quote ((emacs-lisp . t) > > (sqlite . t) > > (dot . t) > > (ditaa . t) > > (R . t) > > (python . t) > > (ruby . t) > > (gnuplot . t) > > (clojure . t) > > (sh . t) > > (ledger . t) > > (org . t) > > (plantuml . t) > > (latex . t > > > > ; Do not prompt to confirm evaluation > > ; This may be dangerous - make sure you understand the consequences > > ; of setting this -- see the docstring for details > > (setq org-confirm-babel-evaluate nil) > > > > ; Use fundamental mode when editing plantuml blocks with C-c ' > > (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental))) > > > > Is this what you need, or do you need more? > > > > sorry, I still can't reproduce the issue, even using the same stock > Emacs and org-mode from Debian 9 as you do. > > Could you _attach_ the emacs init file and the org-mode file which > shows the issue? (so I can simply start “emacs -Q -l sqlite.emacs > sqlite.org” and then press C-c C-c inside the sqlite code to see the > issue? > My emacs init has grown over the years and it includes a lot of others. I should try to create a clean one. -- Cecil Westerhof
[O] Schedule with a duration
Is it possible to schedule a task on a day without a time, but have a duration? I have several tasks that are not bound to a time, but will be done when I have some spare time. It would be handy if there was a way the estimated duration of those tasks so I can choose the right one. And in general I find it useful to see how much work there still is to be done. -- Cecil Westerhof
[O] Title as description in web link
I have created some links to web pages. In almost al cases I want the description to be the title of the page. Is there a way to make the default description the title of a web page? -- Cecil Westerhof
[O] Repeat three times a week
I have an event that I like to repeat three times a week: on Monday, Wednesday en Friday. Do I need three entries like: * TODO Do It SCHEDULED: <2018-04-06 Fri ++1w> * TODO Do It SCHEDULED: <2018-04-09 Mon ++1w> * TODO Do It SCHEDULED: <2018-04-11 Wed ++1w> Or is there a better way? -- Cecil Westerhof
[O] LOGBOOK en PROPERTIES log the same
I am experimenting with repeat tasks. When I mark something as DONE I get: :LOGBOOK: - State "DONE" from "TODO" [2018-04-05 Thu 10:34] :END: :PROPERTIES: :LAST_REPEAT: [2018-04-05 Thu 10:34] :END: But the PROPERTIES value seems unnecessary: it is implied from the LOGBOOK entry. Can I circumvent this? -- Cecil Westerhof
Re: [O] LOGBOOK en PROPERTIES log the same
2018-04-05 10:40 GMT+02:00 Cecil Westerhof <cldwester...@gmail.com>: > I am experimenting with repeat tasks. When I mark something as DONE I get: > :LOGBOOK: > - State "DONE" from "TODO" [2018-04-05 Thu 10:34] > :END: > :PROPERTIES: > :LAST_REPEAT: [2018-04-05 Thu 10:34] > :END: > > But the PROPERTIES value seems unnecessary: it is implied from the LOGBOOK > entry. Can I circumvent this? > It is of-course only the last one, so it is not a big no-no. -- Cecil Westerhof
[O] Undo a sparse tree
I just found the command to create a sparse tree. But I was wondering if there is a way to go back to the previous view? -- Cecil Westerhof
Re: [O] Repeat three times a week
2018-04-05 17:53 GMT+02:00 John Kitchin <jkitc...@andrew.cmu.edu>: > You can use diary sexps (https://www.gnu.org/software/ > emacs/manual/html_node/emacs/Sexp-Diary-Entries.html). For example: > > * TODO something Mon, Wed and Fri > SCHEDULED: <%%(memq (calendar-day-of-week date) '(1 3 5))> > > See the bottom of https://orgmode.org/manual/Deadlines-and-scheduling.html > > This works. Thanks. > On Thu, Apr 5, 2018 at 12:11 AM, Cecil Westerhof <cldwester...@gmail.com> > wrote: > >> I have an event that I like to repeat three times a week: on Monday, >> Wednesday en Friday. Do I need three entries like: >> * TODO Do It >> SCHEDULED: <2018-04-06 Fri ++1w> >> * TODO Do It >> SCHEDULED: <2018-04-09 Mon ++1w> >> * TODO Do It >> SCHEDULED: <2018-04-11 Wed ++1w> >> >> Or is there a better way? >> > -- Cecil Westerhof
[O] Scheduling and calendar-day-of-week
There is something I want to do on Monday, Wednesday and Friday. So I tried: *** TODO Monday, Wednesday and Friday SCHEDULED: <%%(memq (calendar-day-of-week date) '(1 3 5))> This seems to work: I see the activity on the correct days. But then I changed today's entry to DONE. But then all are gone in my agenda view. What I want is for today's item to be 'gone' and the future ones still displayed as TODO. Is that possible? -- Cecil Westerhof
Re: [O] A strange problem with org-babel and SQLite
2018-09-02 15:22 GMT+02:00 Cecil Westerhof : > > > 2018-09-01 14:24 GMT+02:00 Robert Klein : > >> Hi Cecil, >> >> On Sat, 1 Sep 2018 11:12:57 +0200 >> Cecil Westerhof wrote: >> >> > 2018-08-31 13:22 GMT+02:00 Robert Klein : >> > >> > > On Fri, 31 Aug 2018 12:24:33 +0200 >> > > Cecil Westerhof wrote: >> > > >> > > > 2018-08-31 11:17 GMT+02:00 Robert Klein : >> > > > >> > > > > Hi Cecil, >> > > > > >> > > > > On Fri, 31 Aug 2018 10:47:50 +0200 >> > > > > Cecil Westerhof wrote: >> > > > > >> > > > > > I have a strange problem with org-babel and SQLite. >> > > > > > >> > > > > > I have a database that is created with: >> > > > > > CREATE TABLE "quotes" ( >> > > > > > quoteID TEXT PRIMARY KEY, >> > > > > > quote TEXT NOT NULL UNIQUE, >> > > > > > lastUsedTEXT, >> > > > > > totalUsed INT DEFAULT 'unused' >> > > > > > ) >> > > > > > >> > > > > > When using: >> > > > > > #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames >> > > > > > yes SELECT lastUsed >> > > > > > ,totalUsed >> > > > > > FROM quotes >> > > > > > ORDER BY lastused ASC >> > > > > > ,totalUsed DESC >> > > > > > LIMIT40 >> > > > > > #+END_SRC >> > > > > > >> > > > > > Everything is fine. But when I use (add the quote field in the >> > > > > > select): #+BEGIN_SRC sqlite :db >> > > > > > ~/Twitter/twitter.sqlite :colnames yes SELECT quote >> > > > > > ,lastUsed >> > > > > > ,totalUsed >> > > > > > FROM quotes >> > > > > > ORDER BY lastused ASC >> > > > > > ,totalUsed DESC >> > > > > > LIMIT40 >> > > > > > #+END_SRC >> > > > > > >> > > > > > I get: >> > > > > > executing Sqlite code block... >> > > > > > Wrote /tmp/babel-27920y_/ob-input-2792BTG >> > > > > > org-babel-read: End of file during parsing >> > > > > > >> > > > > > What could be the problem? >> > > > > > >> > > > > >> > > > > does it work outside of org/babel/emacs, that is, when you use >> > > > > the query in a command line sqlite session, does it work? >> > > > > “quote” is also a function in sqlite, so this might be your >> > > > > issue. >> > > > >> > > > Yes, in sqlite3 and sqlitebrowser it works without problems. >> > > > In org-babel even 'SELECT *' goes wrong. >> > > > >> > > >> > > I can't reproduce the issue, it works for me. What are your >> > > org-mode and Emacs versions? >> > > >> > >> > GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of >> > 2017-09-15, modified by Debian >> > Org-mode version 8.2.10 (release_8.2.10 >> > @ /usr/share/emacs/25.1/lisp/org/) >> > >> > >> > > >> > > Can you provide an ECM (Example, complete, minimal) org-mode setup / >> > > Emacs initialization file? >> > > >> > >> > (add-hook 'org-babel-after-execute-hook 'bh/display-inline-images >> > 'append) >> > >> > ; Make babel results blocks lowercase >> > (setq org-babel-results-keyword "results") >> > >> > (defun bh/display-inline-images () >> > (condition-case nil >> > (org-display-inline-images) >> > (error nil))) >> > >> > (org-babel-do-load-languages >> > (quote org-babel-load-languages) >> > (quote ((emacs-lisp . t) >> > (sqlite . t) >> > (dot . t) >> > (ditaa . t) >> > (R . t) >> > (python . t) >> > (ruby . t) >> > (gnuplot . t) >> > (clojure . t) >> > (sh . t) >> > (ledger . t) >> > (org . t) >> > (plantuml . t) >> > (latex . t >> > >> > ; Do not prompt to confirm evaluation >> > ; This may be dangerous - make sure you understand the consequences >> > ; of setting this -- see the docstring for details >> > (setq org-confirm-babel-evaluate nil) >> > >> > ; Use fundamental mode when editing plantuml blocks with C-c ' >> > (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental))) >> > >> > Is this what you need, or do you need more? >> > >> >> sorry, I still can't reproduce the issue, even using the same stock >> Emacs and org-mode from Debian 9 as you do. >> >> Could you _attach_ the emacs init file and the org-mode file which >> shows the issue? (so I can simply start “emacs -Q -l sqlite.emacs >> sqlite.org” and then press C-c C-c inside the sqlite code to see the >> issue? >> > > My emacs init has grown over the years and it includes a lot of others. I > should try to create > > a clean one. > I think I am almost there. Is it possible to create a memory database with org-babel instead of a file based one. That would make more transparent I think. > > -- > Cecil Westerhof > -- Cecil Westerhof
Re: [O] A strange problem with org-babel and SQLite
It has to do with the data. With the following I can reproduce it: #+BEGIN_SRC sqlite :db ~/testingOrgBabel.sqlite :colnames yes DROP TABLE IF EXISTS quotes ; CREATE TABLE "quotes" ( quoteID TEXT PRIMARY KEY, quote TEXT NOT NULL UNIQUE, lastUsedTEXT, totalUsed INT DEFAULT 'unused' ) ; INSERT INTO quotes (quoteID, quote) VALUES ("1230FCF5-B25D-4087-88A4-41DF3AC353DA", '[ "Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. - Jamie Paolinett", "Hoe gebruik jij je verbeelding om je mogelijkheden te vergroten?" ]'), (2, "Second record.") ; SELECT * FROM quotes ; #+END_SRC When I put a JSON field in the quote field the parsing goes wrong. 2018-09-03 3:09 GMT+02:00 Cecil Westerhof : > 2018-09-01 14:24 GMT+02:00 Robert Klein : > >> Hi Cecil, >> >> On Sat, 1 Sep 2018 11:12:57 +0200 >> Cecil Westerhof wrote: >> >> > 2018-08-31 13:22 GMT+02:00 Robert Klein : >> > >> > > On Fri, 31 Aug 2018 12:24:33 +0200 >> > > Cecil Westerhof wrote: >> > > >> > > > 2018-08-31 11:17 GMT+02:00 Robert Klein : >> > > > >> > > > > Hi Cecil, >> > > > > >> > > > > On Fri, 31 Aug 2018 10:47:50 +0200 >> > > > > Cecil Westerhof wrote: >> > > > > >> > > > > > I have a strange problem with org-babel and SQLite. >> > > > > > >> > > > > > I have a database that is created with: >> > > > > > CREATE TABLE "quotes" ( >> > > > > > quoteID TEXT PRIMARY KEY, >> > > > > > quote TEXT NOT NULL UNIQUE, >> > > > > > lastUsedTEXT, >> > > > > > totalUsed INT DEFAULT 'unused' >> > > > > > ) >> > > > > > >> > > > > > When using: >> > > > > > #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames >> > > > > > yes SELECT lastUsed >> > > > > > ,totalUsed >> > > > > > FROM quotes >> > > > > > ORDER BY lastused ASC >> > > > > > ,totalUsed DESC >> > > > > > LIMIT40 >> > > > > > #+END_SRC >> > > > > > >> > > > > > Everything is fine. But when I use (add the quote field in the >> > > > > > select): #+BEGIN_SRC sqlite :db >> > > > > > ~/Twitter/twitter.sqlite :colnames yes SELECT quote >> > > > > > ,lastUsed >> > > > > > ,totalUsed >> > > > > > FROM quotes >> > > > > > ORDER BY lastused ASC >> > > > > > ,totalUsed DESC >> > > > > > LIMIT40 >> > > > > > #+END_SRC >> > > > > > >> > > > > > I get: >> > > > > > executing Sqlite code block... >> > > > > > Wrote /tmp/babel-27920y_/ob-input-2792BTG >> > > > > > org-babel-read: End of file during parsing >> > > > > > >> > > > > > What could be the problem? >> > > > > > >> > > > > >> > > > > does it work outside of org/babel/emacs, that is, when you use >> > > > > the query in a command line sqlite session, does it work? >> > > > > “quote” is also a function in sqlite, so this might be your >> > > > > issue. >> > > > >> > > > Yes, in sqlite3 and sqlitebrowser it works without problems. >> > > > In org-babel even 'SELECT *' goes wrong. >> > > > >> > > >> > > I can't reproduce the issue, it works for me. What are your >> > > org-mode and Emacs versions? >> > > >> > >> > GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of >> > 2017-09-15, modified by Debian >> > Org-mode version 8.2.10 (release_8.2.10 >> > @ /usr/share/emacs/25.1/lisp/org/) >> > >> > >> > > >> > > Can you provide an ECM (Example, complete, minimal) org-mode setup / >> > > Emacs initialization file? >> > > >> > >> > (add-hook 'org-babel-after
Re: [O] A strange problem with org-babel and SQLite
2018-09-01 14:24 GMT+02:00 Robert Klein : > Hi Cecil, > > On Sat, 1 Sep 2018 11:12:57 +0200 > Cecil Westerhof wrote: > > > 2018-08-31 13:22 GMT+02:00 Robert Klein : > > > > > On Fri, 31 Aug 2018 12:24:33 +0200 > > > Cecil Westerhof wrote: > > > > > > > 2018-08-31 11:17 GMT+02:00 Robert Klein : > > > > > > > > > Hi Cecil, > > > > > > > > > > On Fri, 31 Aug 2018 10:47:50 +0200 > > > > > Cecil Westerhof wrote: > > > > > > > > > > > I have a strange problem with org-babel and SQLite. > > > > > > > > > > > > I have a database that is created with: > > > > > > CREATE TABLE "quotes" ( > > > > > > quoteID TEXT PRIMARY KEY, > > > > > > quote TEXT NOT NULL UNIQUE, > > > > > > lastUsedTEXT, > > > > > > totalUsed INT DEFAULT 'unused' > > > > > > ) > > > > > > > > > > > > When using: > > > > > > #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames > > > > > > yes SELECT lastUsed > > > > > > ,totalUsed > > > > > > FROM quotes > > > > > > ORDER BY lastused ASC > > > > > > ,totalUsed DESC > > > > > > LIMIT40 > > > > > > #+END_SRC > > > > > > > > > > > > Everything is fine. But when I use (add the quote field in the > > > > > > select): #+BEGIN_SRC sqlite :db > > > > > > ~/Twitter/twitter.sqlite :colnames yes SELECT quote > > > > > > ,lastUsed > > > > > > ,totalUsed > > > > > > FROM quotes > > > > > > ORDER BY lastused ASC > > > > > > ,totalUsed DESC > > > > > > LIMIT40 > > > > > > #+END_SRC > > > > > > > > > > > > I get: > > > > > > executing Sqlite code block... > > > > > > Wrote /tmp/babel-27920y_/ob-input-2792BTG > > > > > > org-babel-read: End of file during parsing > > > > > > > > > > > > What could be the problem? > > > > > > > > > > > > > > > > does it work outside of org/babel/emacs, that is, when you use > > > > > the query in a command line sqlite session, does it work? > > > > > “quote” is also a function in sqlite, so this might be your > > > > > issue. > > > > > > > > Yes, in sqlite3 and sqlitebrowser it works without problems. > > > > In org-babel even 'SELECT *' goes wrong. > > > > > > > > > > I can't reproduce the issue, it works for me. What are your > > > org-mode and Emacs versions? > > > > > > > GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of > > 2017-09-15, modified by Debian > > Org-mode version 8.2.10 (release_8.2.10 > > @ /usr/share/emacs/25.1/lisp/org/) > > > > > > > > > > Can you provide an ECM (Example, complete, minimal) org-mode setup / > > > Emacs initialization file? > > > > > > > (add-hook 'org-babel-after-execute-hook 'bh/display-inline-images > > 'append) > > > > ; Make babel results blocks lowercase > > (setq org-babel-results-keyword "results") > > > > (defun bh/display-inline-images () > > (condition-case nil > > (org-display-inline-images) > > (error nil))) > > > > (org-babel-do-load-languages > > (quote org-babel-load-languages) > > (quote ((emacs-lisp . t) > > (sqlite . t) > > (dot . t) > > (ditaa . t) > > (R . t) > > (python . t) > > (ruby . t) > > (gnuplot . t) > > (clojure . t) > > (sh . t) > > (ledger . t) > > (org . t) > > (plantuml . t) > > (latex . t > > > > ; Do not prompt to confirm evaluation > > ; This may be dangerous - make sure you understand the consequences > > ; of setting this -- see the docstring for details > > (setq org-confirm-babel-evaluate nil) > > > > ; Use fundamental mode when editing plantuml blocks with C-
Re: [O] Set checkbox to intermediate in code
Op do 28 feb. 2019 om 08:51 schreef Cecil Westerhof : > I can set a checkbox to intermediate with: > C-u C-u C-c C-x C-b > > But I want to do it with code. How would I do that? > Found it. Quit simple: (org-toggle-checkbox '(16)) -- Cecil Westerhof