[O] Title in an PlantUML generated file

2019-10-24 Thread Cecil Westerhof
At the moment I am using PlantUML to generate eps diagrams. When opening
them in Evince it says: noTitle. Is there a way to get a title so Evince
has useful information in its window title?

-- 
Cecil Westerhof


Re: [O] Can different types of graphic be created at the same moment

2019-10-22 Thread Cecil Westerhof
Op di 22 okt. 2019 om 09:34 schreef Fraga, Eric :

> On Sunday, 20 Oct 2019 at 16:05, Cecil Westerhof wrote:
> > I would like to generate different types of graphics files at the same
> > moment. I tried:
> > #+BEGIN_SRC plantuml :file Graphics/rabbitMQ.eps :file
> > Graphics/rabbitMQ.jpg :noexport
> >
> > But that does not work: it only generates the eps file.
> >
> > Is it possible at all?
>
> No, I do not think it is possible.  However, if you name your source
> block, you can invoke the same block with different parameters using
> #+call:
>
> See the info manual: (org) Evaluating Code Blocks
>

That is good enough for me. I look into it.

Thanks.

-- 
Cecil Westerhof


Re: [O] Several headers on a table

2019-10-20 Thread Cecil Westerhof
Op zo 20 okt. 2019 om 20:42 schreef briangpowell . :

> * Many years ago I asked that such features be programmed into
> OrgMode--for Multivariate Statistics output--they flatly refused and said
> there would be no plans to do so
>

I did not except it to be the case, but it does not hurt to check.
Thanks.
-- 
Cecil Westerhof


[O] Can different types of graphic be created at the same moment

2019-10-20 Thread Cecil Westerhof
I would like to generate different types of graphics files at the same
moment. I tried:
#+BEGIN_SRC plantuml :file Graphics/rabbitMQ.eps :file
Graphics/rabbitMQ.jpg :noexport

But that does not work: it only generates the eps file.

Is it possible at all?

It would even better when I only have to define the extension. I would
normally call all the same except the extension?

-- 
Cecil Westerhof


[O] Can I get a horizontal line in a component with plantuml

2019-10-20 Thread Cecil Westerhof
Because of the way plantuml works (as far as I know), I have the following
code:
@startuml

[Producer 1\nProducer 2\nProducer ...\nProducer n] as Producers

cloud {
  [Internet] as Internet1
}

node RabbitMQ #LightSteelBlue {
  [Exchange]
  [Queue 1\nQueue 2\nQueue ...\nQueue n] as Queues
}

cloud {
  [Internet] as Internet2
}

[Consumer 1\nConsumer 2\nConsumer ...\nConsumer n] as Consumers


[Producers] -> [Internet1]  : Publish
[Internet1] -> [Exchange]   : Publish
[Exchange]  -> [Queues] : Route
[Queues]-> [Internet2]  : Consume
[Internet2] -> [Consumers]  : Consume

@enduml

Which gives the attached graphic.

The problem is that there are four producers, queues and consumers. Is it
possible to put three lines in the components to signify that?

-- 
Cecil Westerhof


[O] Several headers on a table

2019-10-20 Thread Cecil Westerhof
I have the following table:
|+-+-+-+-+-+-|
| Image quality  |  HD | MP4 | STD |  HD | MP4 | STD |
|+-+-+-+-+-+-|
| NP-FV30 (supplied) |  90 | 100 |  95 |  45 |  50 |  45 |
| NP-FV50| 170 | 190 | 180 |  85 |  95 |  90 |
| NP-FV70| 355 | 395 | 375 | 175 | 195 | 185 |
| NP-FV100   | 710 | 785 | 745 | 355 | 390 | 370 |
|+-+-+-+-+-+-|

But I like to put the following headers above it:
|+---|
|| Recording Time|
|+---|
|+-+-|
| Battery pack   | Continuous  | Typical |
|+-+-|

So I would get:
|+---|
|| Recording Time|
|+---|
|+-+-|
| Battery pack   | Continuous  | Typical |
|+-+-|
|+-+-+-+-+-+-|
| Image quality  |  HD | MP4 | STD |  HD | MP4 | STD |
|+-+-+-+-+-+-|
| NP-FV30 (supplied) |  90 | 100 |  95 |  45 |  50 |  45 |
| NP-FV50| 170 | 190 | 180 |  85 |  95 |  90 |
| NP-FV70| 355 | 395 | 375 | 175 | 195 | 185 |
| NP-FV100   | 710 | 785 | 745 | 355 | 390 | 370 |
|+-+-+-+-+-+-|

Would that be possible?

-- 
Cecil Westerhof


Re: [O] Placing components in plantuml

2019-10-17 Thread Cecil Westerhof
I got a reasonable result by putting the four producers/queues/consumers
into one component. But if anybody knows a better solution …

@startuml

component [Producer 1\nProducer 2\nProducer ...\nProducer n] as Producers

cloud {
  [Internet] as Internet1
}

node RabbitMQ #LightSteelBlue {
  [Exchange]
  [Queue 1\nQueue 2\nQueue ...\nQueue n] as Queues
}

cloud {
  [Internet] as Internet2
}

[Consumer 1\nConsumer 2\nConsumer ...\nConsumer n] as Consumers


[Producers] -> [Internet1]  : Publish
[Internet1] -> [Exchange]   : Publish
[Exchange]  -> [Queues] : Route
[Queues]-> [Internet2]  : Consume
[Internet2] -> [Consumers]  : Consume

@enduml

Op do 17 okt. 2019 om 17:51 schreef Cecil Westerhof :

> Op do 17 okt. 2019 om 17:33 schreef Cecil Westerhof <
> cldwester...@gmail.com>:
>
>> I just started working with plantuml, but I do not know how to get what I
>> want.
>>
>
> I have something that comes close:
> #+BEGIN_SRC plantuml :file Graphics/rabbitMQ.eps :noexport
> @startuml
>
> [Producer 1]
> [Producer 2]
> [Producer ...]
> [Producer n]
>
> [Producer 1]-[hidden]-> [Producer 2]
> [Producer 2]-[hidden]-> [Producer ...]
> [Producer ...]  -[hidden]-> [Producer n]
>
> cloud {
>   [Internet] as Internet1
> }
>
> node RabbitMQ {
>   [Exchange]
>   [Queue 1]
>   [Queue 2]
>   [Queue ...]
>   [Queue n]
> }
>
> cloud {
>   [Internet] as Internet2
> }
>
> [Consumer 1]
> [Consumer 2]
> [Consumer ...]
> [Consumer n]
>
>
> [Producer 1] -> [Internet1] : Publish
> ' [Producer 2] -> [Internet1] : Publish
> ' [Producer ...]   -> [Internet1] : Publish
> ' [Producer n] -> [Internet1] : Publish
> [Internet1]  -> [Exchange]  : Publish
> [Exchange]  --> [Queue 1]   : Route
> [Exchange]  --> [Queue 2]   : Route
> [Exchange]  --> [Queue ...] : Route
> [Exchange]  --> [Queue n]   : Route
> [Queue 1]   --> [Internet2] : Consume
> [Queue 2]   --> [Internet2] : Consume
> [Queue ...] --> [Internet2] : Consume
> [Queue n]   --> [Internet2] : Consume
> [Internet2]  -> [Consumer 1]: Consume
> [Internet2]  -> [Consumer 2]: Consume
> [Internet2]  -> [Consumer ...]  : Consume
> [Internet2]  -> [Consumer n]: Consume
>
> @enduml
> #+END_SRC
>
> But as soon as I get the paths from the other producers to Internet1 out
> of comment, it goes horrible wrong. :'-(
>
> --
> Cecil Westerhof
>


-- 
Cecil Westerhof


Re: [O] Placing components in plantuml

2019-10-17 Thread Cecil Westerhof
Op do 17 okt. 2019 om 17:33 schreef Cecil Westerhof :

> I just started working with plantuml, but I do not know how to get what I
> want.
>

I have something that comes close:
#+BEGIN_SRC plantuml :file Graphics/rabbitMQ.eps :noexport
@startuml

[Producer 1]
[Producer 2]
[Producer ...]
[Producer n]

[Producer 1]-[hidden]-> [Producer 2]
[Producer 2]-[hidden]-> [Producer ...]
[Producer ...]  -[hidden]-> [Producer n]

cloud {
  [Internet] as Internet1
}

node RabbitMQ {
  [Exchange]
  [Queue 1]
  [Queue 2]
  [Queue ...]
  [Queue n]
}

cloud {
  [Internet] as Internet2
}

[Consumer 1]
[Consumer 2]
[Consumer ...]
[Consumer n]


[Producer 1] -> [Internet1] : Publish
' [Producer 2] -> [Internet1] : Publish
' [Producer ...]   -> [Internet1] : Publish
' [Producer n] -> [Internet1] : Publish
[Internet1]  -> [Exchange]  : Publish
[Exchange]  --> [Queue 1]   : Route
[Exchange]  --> [Queue 2]   : Route
[Exchange]  --> [Queue ...] : Route
[Exchange]  --> [Queue n]   : Route
[Queue 1]   --> [Internet2] : Consume
[Queue 2]   --> [Internet2] : Consume
[Queue ...] --> [Internet2] : Consume
[Queue n]   --> [Internet2] : Consume
[Internet2]  -> [Consumer 1]: Consume
[Internet2]  -> [Consumer 2]: Consume
[Internet2]  -> [Consumer ...]  : Consume
[Internet2]  -> [Consumer n]: Consume

@enduml
#+END_SRC

But as soon as I get the paths from the other producers to Internet1 out of
comment, it goes horrible wrong. :'-(

-- 
Cecil Westerhof


[O] Placing components in plantuml

2019-10-17 Thread Cecil Westerhof
I just started working with plantuml, but I do not know how to get what I
want.
At the moment I have the following:
#+BEGIN_SRC plantuml :file Graphics/rabbitMQ.eps :noexport
@startuml

[Producer 1]
[Producer 2]
[Producer ...]
[Producer n]

cloud {
  [Internet] as Internet1
}

node RabbitMQ {
  [Exchange]
  [Queue 1]
  [Queue 2]
  [Queue ...]
  [Queue n]
}

cloud {
  [Internet] as Internet2
}

[Consumer 1]
[Consumer 2]
[Consumer ...]
[Consumer n]


[Producer 1]--> [Internet1] : Publish
[Producer 2]--> [Internet1] : Publish
[Producer ...]  --> [Internet1] : Publish
[Producer n]--> [Internet1] : Publish
[Internet1]  -> [Exchange]  : Publish
[Exchange]  --> [Queue 1]   : Route
[Exchange]  --> [Queue 2]   : Route
[Exchange]  --> [Queue ...] : Route
[Exchange]  --> [Queue n]   : Route
[Queue 1]   --> [Internet2] : Consume
[Queue 2]   --> [Internet2] : Consume
[Queue ...] --> [Internet2] : Consume
[Queue n]   --> [Internet2] : Consume
[Internet2]  -> [Consumer 1]: Consume
[Internet2]  -> [Consumer 2]: Consume
[Internet2]  -> [Consumer ...]  : Consume
[Internet2]  -> [Consumer n]: Consume

@enduml
#+END_SRC

It seems that going down works much better as going right.
I would like to have [Producer 2], [Producer ...] and [Producer n] below
[Producer 1] is this possible? (And the first 2 left and higher as
Internet1 and the other 2 left and lower as Internet1.)
The same with queue and consumer. But probably when I have a solution for
producer, I will also have a solution for queue and consumer.

-- 
Cecil Westerhof


Re: [O] Creating a (RabbitMQ) diagram

2019-10-17 Thread Cecil Westerhof
Op do 17 okt. 2019 om 13:40 schreef Ken Mankoff :

>
> On 2019-10-17 at 13:12 +02, PICCA Frederic-Emmanuel <
> frederic-emmanuel.pi...@synchrotron-soleil.fr> wrote...
> > https://en.wikipedia.org/wiki/PGF/TikZ
>
> Or you can do it with Ditaa, http://plantuml.com, others that may be
> easier to use than TikZ.
>

It is not perfect, but for the moment good enough:
#+BEGIN_SRC plantuml :file rabbitMQ.eps :noexport
@startuml

[Producer]

cloud {
  [Internet] as Internet1
}

node RabbitMQ {
  [Exchange]
  [Queue]
}

cloud {
  [Internet] as Internet2
}

[Consumer]


[Producer]  -> [Internet1] : Publish
[Internet1] -> [Exchange]  : Publish
[Exchange]  -> [Queue] : Route
[Queue] -> [Internet2] : Consume
[Internet2] -> [Consumer]  : Consume

@enduml
#+END_SRC

-- 
Cecil Westerhof


Re: [O] Creating a (RabbitMQ) diagram

2019-10-17 Thread Cecil Westerhof
Op do 17 okt. 2019 om 13:40 schreef Ken Mankoff :

>
> On 2019-10-17 at 13:12 +02, PICCA Frederic-Emmanuel <
> frederic-emmanuel.pi...@synchrotron-soleil.fr> wrote...
> > https://en.wikipedia.org/wiki/PGF/TikZ
>
> Or you can do it with Ditaa, http://plantuml.com, others that may be
> easier to use than TikZ.
>

I tried it out (after a bit of configuring) with the following:
#+BEGIN_SRC plantuml :file groupingComponents.eps :noexport
@startuml

package "Some Group" {
  HTTP - [First Component]
  [Another Component]
}

node "Other Groups" {
  FTP - [Second Component]
  [First Component] --> FTP
}

cloud {
  [Example 1]
}


database "MySql" {
  folder "This is my folder" {
[Folder 3]
  }
  frame "Foo" {
[Frame 4]
  }
}


[Another Component] --> [Example 1]
[Example 1] --> [Folder 3]
[Folder 3] --> [Frame 4]

@enduml
#+END_SRC


It looks a bit different, but I will not worry about it at the moment.

Is it best to save it as eps, or better another format? (When using it with
LaTeX.)

-- 
Cecil Westerhof


Re: [O] Set checkbox to intermediate in code

2019-02-28 Thread Cecil Westerhof
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


[O] Set checkbox to intermediate in code

2019-02-27 Thread 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?

-- 
Cecil Westerhof


Re: [O] A strange problem with org-babel and SQLite

2018-09-10 Thread Cecil Westerhof
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 &optional 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-li

Re: [O] A strange problem with org-babel and SQLite

2018-09-02 Thread Cecil Westerhof
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?
>> > >
>> 

Re: [O] A strange problem with org-babel and SQLite

2018-09-02 Thread 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 m

Re: [O] A strange problem with org-babel and SQLite

2018-09-02 Thread Cecil Westerhof
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] English and Dutch version of a Graphviz picture

2018-09-02 Thread Cecil Westerhof
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-02 Thread 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.

-- 
Cecil Westerhof


[O] English and Dutch version of a Graphviz picture

2018-09-01 Thread Cecil Westerhof
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] A strange problem with org-babel and SQLite

2018-09-01 Thread Cecil Westerhof
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


Re: [O] A strange problem with org-babel and SQLite

2018-08-31 Thread Cecil Westerhof
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


[O] A strange problem with org-babel and SQLite

2018-08-31 Thread Cecil Westerhof
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


[O] Schedule with a duration

2018-04-06 Thread Cecil Westerhof
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

2018-04-06 Thread Cecil Westerhof
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] Scheduling and calendar-day-of-week

2018-04-06 Thread Cecil Westerhof
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] Repeat three times a week

2018-04-06 Thread Cecil Westerhof
2018-04-05 17:53 GMT+02:00 John Kitchin :

> 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 
> 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] Undo a sparse tree

2018-04-05 Thread Cecil Westerhof
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] LOGBOOK en PROPERTIES log the same

2018-04-05 Thread Cecil Westerhof
2018-04-05 10:40 GMT+02:00 Cecil Westerhof :

> 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] LOGBOOK en PROPERTIES log the same

2018-04-05 Thread Cecil Westerhof
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


[O] Repeat three times a week

2018-04-05 Thread Cecil Westerhof
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] Table format error

2017-09-13 Thread Cecil Westerhof
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] Calculating percentage

2017-07-17 Thread Cecil Westerhof
2017-07-16 20:32 GMT+02:00 Eric S Fraga :

> See attached.
>

​Works perfect thanks.​


-- 
Cecil Westerhof


[O] Calculating percentage

2017-07-14 Thread Cecil Westerhof
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


Re: [O] How to place things differently in dot

2015-03-27 Thread Cecil Westerhof
2015-03-27 7:57 GMT+01:00 Cecil Westerhof :

> 2015-03-26 23:19 GMT+01:00 Cecil Westerhof :
>
>> 2015-03-26 22:49 GMT+01:00 Nick Dokos :
>>
>>> Cecil Westerhof  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 Thread Cecil Westerhof
2015-03-26 23:19 GMT+01:00 Cecil Westerhof :

> 2015-03-26 22:49 GMT+01:00 Nick Dokos :
>
>> Cecil Westerhof  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 Thread Cecil Westerhof
2015-03-26 22:49 GMT+01:00 Nick Dokos :

> Cecil Westerhof  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] How to place things differently in dot

2015-03-26 Thread Cecil Westerhof
2015-03-26 21:27 GMT+01:00 Nick Dokos :

> Cecil Westerhof  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:
> >  > 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 Thread Cecil Westerhof
2015-03-26 17:57 GMT+01:00 Cecil Westerhof :

> 2015-03-26 17:07 GMT+01:00 Ken Mankoff :
>
>>
>> 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 Thread Cecil Westerhof
2015-03-26 18:00 GMT+01:00 Thomas S. Dye :

> Cecil Westerhof  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-26 Thread Cecil Westerhof
2015-03-26 17:07 GMT+01:00 Ken Mankoff :

>
> 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


[O] How to place things differently in dot

2015-03-26 Thread Cecil Westerhof
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] Only showing part of a list

2015-03-11 Thread Cecil Westerhof
2015-03-11 14:23 GMT+01:00 John Kitchin :

> 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] Only showing part of a list

2015-03-11 Thread Cecil Westerhof
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] Error running tests on 8.2.10

2015-02-14 Thread Cecil Westerhof
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


Re: [O] Can this table formula be done more efficient

2014-06-09 Thread Cecil Westerhof
2014-06-08 15:07 GMT+02:00 Eric Schulte :

> Nick Dokos  writes:
>
> > Cecil Westerhof  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


Re: [O] Can this table formula be done more efficient

2014-06-09 Thread Cecil Westerhof
2014-06-08 13:53 GMT+02:00 Nick Dokos :

> Cecil Westerhof  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---
>

​Works like a charm. Thanks.

​


> ​​
> See
> ​​
> (info "(org) References")
>

​I should study that more diligently.

-- 
Cecil Westerhof


[O] Can this table formula be done more efficient

2014-06-08 Thread Cecil Westerhof
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] Tests do not work

2014-06-03 Thread Cecil Westerhof
2014-06-03 12:11 GMT+02:00 Bastien :

> Cecil Westerhof  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


Re: [O] Tests do not work

2014-06-03 Thread Cecil Westerhof
2014-06-02 20:17 GMT+02:00 Achim Gratz :

> 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-02 Thread Cecil Westerhof
2014-06-02 13:36 GMT+02:00 Bastien :

> Hi,
>
> Cecil Westerhof  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-01 Thread Cecil Westerhof
2014-06-01 23:14 GMT+02:00 Bastien :

> Achim Gratz  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-01 Thread Cecil Westerhof
2014-06-01 21:14 GMT+02:00 Bastien :

>
> Cecil Westerhof  writes:
>
> > 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?
>
> What returns M-x org-version RET ?
>

​Org-mode version 8.2.6 (8.2.6-dist @ /usr/share/emacs/site-lisp/org/)​




> Perhaps run "make cleanall" before running "make test".
>

​Gives:
rm -fr /tmp/tmp-orgtest
rm -f
find . \( -name \*~ -o -name \*# -o -name .#\* \) -exec rm -f {} \;
find contrib testing mk \( -name \*~ -o -name \*.elc \) -exec rm -f {} \;
find: `testing': No such file or directory
make: [cleanall] Error 1 (ignored)


And ‘make test’ after this still gives:​
​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

-- 
Cecil Westerhof


Re: [O] Difference between two rows

2014-06-01 Thread Cecil Westerhof
2014-06-01 15:18 GMT+02:00 Michael Brand :

> Hi Cecil
>
> On Sun, Jun 1, 2014 at 2:24 PM, Cecil Westerhof 
> 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:
&g

[O] Tests do not work

2014-06-01 Thread Cecil Westerhof
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 Thread Cecil Westerhof
2014-06-01 13:57 GMT+02:00 Michael Brand :

> On Sun, Jun 1, 2014 at 1:38 PM, Cecil Westerhof 
> 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] Difference between two rows

2014-06-01 Thread Cecil Westerhof
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] Check on empty does not work

2014-06-01 Thread Cecil Westerhof
2014-06-01 12:58 GMT+02:00 Michael Brand :

> On Sun, Jun 1, 2014 at 12:00 PM, Cecil Westerhof 
> wrote:
> > 2014-06-01 11:50 GMT+02:00 Cecil Westerhof :
> >> 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


Re: [O] Check on empty does not work

2014-06-01 Thread Cecil Westerhof
2014-06-01 11:50 GMT+02:00 Cecil Westerhof :

> 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


[O] Check on empty does not work

2014-06-01 Thread Cecil Westerhof
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] Sub-totals

2014-02-18 Thread Cecil Westerhof
2014-02-16 10:06 GMT+01:00 Michael Brand :

> > - 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


Re: [O] Sub-totals

2014-02-15 Thread Cecil Westerhof
2014-02-15 18:14 GMT+01:00 Cecil Westerhof :

> 2014-02-15 16:19 GMT+01:00 Michael Brand :
>
> 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-15 Thread Cecil Westerhof
2014-02-15 16:19 GMT+01:00 Michael Brand :

> 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


[O] Sub-totals

2014-02-15 Thread Cecil Westerhof
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] Check checkbox and move to end of list

2014-01-23 Thread Cecil Westerhof
2014/1/23 Cecil Westerhof 

> 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


Re: [O] Check checkbox and move to end of list

2014-01-22 Thread Cecil Westerhof
2014/1/23 Cecil Westerhof 

> (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-01-22 Thread Cecil Westerhof
2014/1/23 Cecil Westerhof 

> 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] API problem

2014-01-22 Thread Cecil Westerhof
2014/1/22 Nicolas Goaziou 

> 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


[O] Check checkbox and move to end of list

2014-01-22 Thread Cecil Westerhof
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


[O] Fwd: org-cycle goes wrong when cursor at the end of the line

2014-01-22 Thread Cecil Westerhof
Went wrong agan. :'( I should repair Gnus.

-- Forwarded message --
From: Cecil Westerhof 
Date: 2014/1/22
Subject: Re: org-cycle goes wrong when cursor at the end of the line
To: Bastien 


2014/1/22 Bastien 

> > I have:
> > * Testing
> > *** Line one
> > *** Line two
> > *** Line tree
> >
> > When in overview mode and with the cursor at the end of the line
> > (after ...),  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  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  when the cursor is not behind
the dots, the asterisks are not shown.It is only a problem when you give a
 with the cursor after the dots.

-- 
Cecil Westerhof


Re: [O] API problem

2014-01-22 Thread Cecil Westerhof
2014/1/22 Nicolas Goaziou 

> Cecil Westerhof  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: #
> >
> > 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


Re: [O] API problem

2014-01-22 Thread Cecil Westerhof
2014/1/22 Cecil Westerhof 

> 2014/1/22 Nicolas Goaziou 
>
>> > 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: #

What is going wrong here?


-- 
Cecil Westerhof


[O] Fwd: API problem

2014-01-22 Thread Cecil Westerhof
Did not go to the list. :'(

-- Forwarded message --
From: Cecil Westerhof 
Date: 2014/1/22
Subject: Re: API problem
To: Nicolas Goaziou 


2014/1/22 Nicolas Goaziou 

> > 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


[O] API problem

2014-01-22 Thread Cecil Westerhof
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] org-cycle goes wrong when cursor at the end of the line

2014-01-22 Thread Cecil Westerhof
I have:
* Testing
*** Line one
*** Line two
*** Line tree

When in overview mode and with the cursor at the end of the line (after
...),  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


Re: [O] Moving checkbox item to end of list when checked

2014-01-22 Thread Cecil Westerhof
2014/1/22 Cecil Westerhof 

> >> 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


Re: [O] Moving checkbox item to end of list when checked

2014-01-22 Thread Cecil Westerhof
2014/1/22 Nicolas Goaziou 

> >> 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


[O] Moving checkbox item to end of list when checked

2014-01-22 Thread Cecil Westerhof
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] Only display hours and minutes, not seconds

2013-11-25 Thread Cecil Westerhof
2013/10/31 Nick Dokos 

> Cecil Westerhof  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


Re: [O] (no subject)

2013-11-06 Thread Cecil Westerhof
2013/11/6 Cecil Westerhof 

> > 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] Latex export does not work

2013-11-06 Thread Cecil Westerhof
2013/11/6 Cecil Westerhof 

> 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] Latex export does not work

2013-11-06 Thread Cecil Westerhof
2013/11/6 Cecil Westerhof 

> 2013/11/6 Cecil Westerhof 
>
>> 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-06 Thread Cecil Westerhof
2013/11/6 Cecil Westerhof 

> 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-06 Thread Cecil Westerhof
2013/11/6 Cecil Westerhof 

>
> 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


[O] Latex export does not work

2013-11-06 Thread Cecil Westerhof
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


[O] (no subject)

2013-11-05 Thread Cecil Westerhof
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


Re: [O] Adding and subtracting from clocked entries.

2013-11-05 Thread Cecil Westerhof
2013/11/5 Cecil Westerhof 

> 2013/11/4 Bastien 
>
>> > 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- 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


Re: [O] Adding and subtracting from clocked entries.

2013-11-04 Thread Cecil Westerhof
2013/11/4 Bastien 

> > 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- 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-04 Thread Cecil Westerhof
2013/11/4 Pete Ley 

> Cecil Westerhof  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.


[O] Adding and subtracting from clocked entries.

2013-11-04 Thread Cecil Westerhof
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


[O] Only display hours and minutes, not seconds

2013-10-30 Thread Cecil Westerhof
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] pc-keys mode does not work in org mode

2011-11-19 Thread Cecil Westerhof
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



[Orgmode] Smart vsum

2010-11-15 Thread Cecil Westerhof
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


[Orgmode] Re: Some problems with times in a spreadsheet

2010-07-22 Thread Cecil Westerhof
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


Re: [Orgmode] Some problems with times in a spreadsheet

2010-07-22 Thread Cecil Westerhof
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] Some problems with times in a spreadsheet

2010-07-21 Thread Cecil Westerhof
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


[Orgmode] Recurrence on Monday, Wednesday and Friday

2007-10-13 Thread Cecil Westerhof
I started today to play with org-mode and agendaview. I like what I see.
But I want something to reoccur every Monday, Wednesday and Friday. Is
this possible, or do I need to generate three different entries?




___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] I do not understand this error

2007-07-12 Thread Cecil Westerhof
I have been experimenting a little bit more. I now have the following
table:

|---++---+---+---+--+---|
|   |   date | previous date | prev  at once | prev with dummy 
field | row date | dagen |

|---++---+---+---+--+---|
| # ||   | filled| empty
 | EMPTY|   |
| # | 2007-07-09 |   | filled| empty
 | FILLED   |-3 |
| # | 2007-09-11 |2007-07-09 | filled| filled   
 | FILLED   |64 |
| # ||2007-09-11 | filled| filled   
 | EMPTY|   |
| # | 2006-12-31 |   | filled| empty
 | FILLED   |  -193 |

|---++---+---+---+--+---|
#+TBLFM: $3='(concat @-1$2);S::$4='(if (not (equal (concat @-1$2) "")) 
"filled" "empty")::$5='(if (not (equal (concat $3   ) "")) "filled" 
"empty")::$6='(if (not (equal (concat $2   ) "")) "filled" "empty")::$7='(if 
(and (not (check-if-after-hline)) (not (equal @-1$2 "")) (not (equal $2 ""))) 
(-  (time-to-days (org-read-date t t (concat $2))) (time-to-days (org-read-date 
t t (concat @-1$2 "");S


When checking for the previous date at once you always get filled. If
the previous date is copied to a field and this field is checked, you
get the expected value.
What is happening here?

Also why is in the column 'row date' everything in caps?

-- 
Cecil Westerhof <[EMAIL PROTECTED]>



___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] I do not understand this error

2007-07-11 Thread Cecil Westerhof
Op do, 12-07-2007 te 08:07 +0200, schreef Cecil Westerhof:
> I have the following table:
> 
> |---++-+-+++---+---+--+|
> |   |  datum | kmstand | prijs/l | liters | dagen  | prijs | km's 
>  | prijs/km |   km/l |
> 
> |---++-+-+++---+---+--+|
> | # ||  155111 | |||   |  
>  |  ||
> | # | 2007-07-09 |  156146 |   102.2 |  62.25 | #ERROR | 63.62 | 1035 
>  |6.147 | 16.627 |
> | # | 2007-09-11 |6953 |97.8 |  47.75 | #ERROR | 46.70 | 
> Verkeerde kmstand |  ||
> | # || | || #ERROR |   |  
>  |  ||
> 
> |---++-+-+++---+---+--+|
> #+TBLFM: $6='(if (and (not (check-if-after-hline)) (nz @-1$2) (nz 
> $2)) (-  (time-to-days (org-read-date t t "$2")) (time-to-days (org-read-date 
> t t "@-1$2"))) "");S::$7='(if (and (nz $4) (nz $5)) (format "%.2f" (/ (* $4 
> $5) 100)) "");N::$8='(if (and (nz @-1$3) (nz $3)) (if (> $3 @-1$3) (- $3 
> @-1$3) (if (not (check-if-after-hline)) "Verkeerde kmstand" "")) 
> "");N::$9='(if (and (nz $8) (nz $7)) (format "%.3f" (/ (* $7 100) $8)) 
> "");N::$10='(if (and (nz $8) (nz $5)) (format "%.3f" (/ $8 $5)) "");N

I should not use 'nz', but 'not' and 'equal'. This gives:

|---++-+-++---+---+---+--+|
|   |  datum | kmstand | prijs/l | liters | dagen | prijs | km's
  | prijs/km |   km/l |

|---++-+-++---+---+---+--+|
| # ||  155111 | ||   |   | 
  |  ||
| # | 2007-07-09 |  156146 |   102.2 |  62.25 |-3 | 63.62 | 1035
  |6.147 | 16.627 |
| # | 2007-09-11 |6953 |97.8 |  47.75 |64 | 46.70 | 
Verkeerde kmstand |  ||
| # || | ||   |   | 
  |  ||

|---++-+-++---+---+---+--+|
#+TBLFM: $6='(if (and (not (check-if-after-hline)) (not (equal @-1$2 
"")) (not (equal $2 ""))) (-  (time-to-days (org-read-date t t (concat $2))) 
(time-to-days (org-read-date t t (concat @-1$2 "");S::$7='(if (and (nz $4) 
(nz $5)) (format "%.2f" (/ (* $4 $5) 100)) "");N::$8='(if (and (nz @-1$3) (nz 
$3)) (if (> $3 @-1$3) (- $3 @-1$3) (if (not (check-if-after-hline)) "Verkeerde 
kmstand" "")) "");N::$9='(if (and (nz $8) (nz $7)) (format "%.3f" (/ (* $7 100) 
$8)) "");N::$10='(if (and (nz $8) (nz $5)) (format "%.3f" (/ $8 $5)) "");N

The only problem is that in the second element of 'dagen' there stands
'-3'. It looks like it that '(not (equal @-1$2 ""))' is not correctly is
evaluated.

-- 
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

2007-07-11 Thread Cecil Westerhof
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


  1   2   >