[PATCH] Fixing endless loop of org-reveal with inline-task

2024-06-07 Thread Marc-Oliver Ihm
Hi all,

If I have this simple buffer:

* foo

*** bar
*** END

i.e. one node with a single inline node.
If now I place the cursor at the end of the buffer and invoke (org-reveal), I 
get stuck in an endless loop.
(of course one needs to (require 'org-inlinetask) before)

I think this can be fixed by patching org-goto-sibling as shown below (against 
HEAD). Could you please consider accepting this patch, as the problem hits me 
every few days.

Background: In my opinion the current behavior of org-goto-sibling is wrong if 
the cursor is at the end of the given example-buffer. In that case cursor gets 
placed at the start of the END-line and the return value is t. This contradicts 
the documentation, which states "Returns t
when a sibling was found.  When none is found, return nil and don’t
move point."
My patch corrects this, so that when invoking org-goto-sibling in this case, 
cursor is not moved and return value is nil.
I did not notice any negative effects with this patch in the past few weeks.

Thanx a lot
Marc Ihm

diff --git a/lisp/org.el b/lisp/org.el
index cf4c9a99e..c786f7719 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -21530,6 +21530,10 @@ move point."
   (when (org-element-type-p (org-element-at-point) 'inlinetask)
 (org-up-heading-safe))
   (setq level (funcall outline-level))
+  (when (org-inlinetask-at-task-p)
+(if previous
+(org-inlinetask-goto-beginning)
+  (org-inlinetask-goto-end)))
   (catch 'exit
(or previous (forward-char 1))
(while (funcall fun re nil t)



[PATCH] choices in org-id-find for handling missing ids

2021-06-12 Thread Marc-Oliver Ihm
Hi,

please find attached a patch to allow more flexible handling of missing ids in 
org-id-find; some people (like me) tend to lose ids now and then and may 
benefit from more choices.

The current behaviour of calling org-id-update-id-locations is pretty perfect 
for situations where the id has been moved to another file (which will be the 
case in most situations, I guess). However, sometimes an id has simply been 
deleted and then searching for it in all files can not be helpful. Especially 
lisp-code calling org-id-find might want to handle things on its own.

To this goal, a new custom org-id-action-on-missing-id has been added; 
reproducing its description from the patch:

> (defcustom org-id-action-on-missing-id 'update
>   "Special action to be taken, if `org-id-find' cannot find an id.
> 
> With 'update (default), org-id-find will silently call
> `org-id-update-id-locations' and try again; this will help,
> e.g. if you have moved the id to another file.
> 
> With 'exception, the exception 'not-found will be thrown, which
> can be useful, if `org-id-find' is called from within lisp and
> the caller wants to handle the situation.
> 
> With 'error, a descriptive error will be raised, causing the
> current command to terminate."
>   :group 'org-id
>   :type '(choice
> (const :tag "Run `org-id-update-id-locations' if an id cannot be 
> found" update)
> (const :tag "Throw exception `not-found'" exception)
> (const :tag "Raise an error" error)
>   ))

the handling in org-id-find is straightforward.

The default corresponds to the current behaviour.
 
I would like to ask for opinions/discussion on this patch and maybe see it 
applied if found fit.

Best regards
Marc Ihm

0001-choices-in-org-id-find-for-handling-missing-ids.patch
Description: Binary data


Assistant to remove unused IDs of org-id

2020-04-13 Thread Marc-Oliver Ihm
Hi,

as I use the excellent package org-id in a somewhat non-standard way, I tend to 
produce IDs, that are not referenced from anywhere. Org-id handles this great 
and does not suffer in performance, but eventually I want to remove those 
unreferenced IDs.
Therefore I have written a small interactive assistant:

https://github.com/marcIhm/org-working-set/blob/master/org-id-cleanup.el

to help with removing those IDs.
The assistant (interactive function: org-id-cleanup) is quite detailed with its 
instructions and checks, so that the risk of doing harm ist reduced to a 
minimum, although not to zero (therefore the first step is to ask for a backup).

In any case I wonder, if this functionality (removing unreferenced IDs) could 
be helpful for anyone else.

So please feel free to have a look.
Finally I would be grateful for any comment whatsoever 
(e.g. regarding the name of org-id-cleanup.el).

Best regards
Marc



Re: [O] Updating to the current org-mode in emacs trunk, and Org stable

2015-03-28 Thread Marc-Oliver Ihm

Hi all,



I mean: get real work done, instead of just nudging the usual activists ?


I don't know what you are trying to say here.  Plenty of work is going on
IRL and in Org master.



Just wanted to know, if I myself could do a bit more, than just nudging the 
usual activists.
(e.g. fixing some minor bugs or the like ...)

I know, that very much work is done on IRL and Org master, and I appreciate 
this work very much !


best regards
Marc




Re: [O] Local key binding gone wrong!

2014-01-05 Thread Marc-Oliver Ihm

Hi Sharon,

not sure, what happened in your setup. Maybe things can get clearer, if you 
would supply
the line of lisp that you employed to bind F13.
Was it something like

(global-set-key [(f13)] 'org-archive-subtree)

?

regards
Marc


Am 05.01.2014 04:35, schrieb Sharon Kimble:

Whilst trying to set a key binding to archive 'DONE' todo items, by
trying to bind F13 [aka CapsLock] to '2', so the finished intended
result would have been - F13 + 2 = DONE  ARCHIVED. This is a global
key binding, although I was trying for a local one. How do I know its
'global'? Because CapsLock now does not work for me to use in this
email!

So, how do I revert CapsLock to being its intended F13 please? And how
do I set up a local key binding to avoid this situation in the future
please?

Thanks
Sharon.






Re: [O] Confused about org-index, org-favtable, org-reftabel, org-refer-by-number

2013-10-28 Thread Marc-Oliver Ihm


Hi Michael,

thanx for the good words about org-index !

And yes all those packages are earlier Versions of org-index :-/
However, I did not try to cover my traces that way, but rather tried to find a 
name,
that at first glimpse gives an idea of this packages purpose ...
Now, org-index is a good fit, I think and I will not change its name again.

Regarding your upgrade path, I think you can easily switch from org-favtable to 
org-index,
only that you should rename org-favtable-id into org-index-id within your .emacs
As far as I can deduce from the version history which is contained in 
org-index.el,
you do not need to convert your index-table; it will work unchanged with 
org-index.
(please tell me, if there are unexpected problems !)

Finally as for the piled up confusion of having several packages with different 
names.
I need help from the org-mode elders in cleaning this up, because I do not have 
commit-bit for org,
only for worg.

What should be done is this:
The only package that should be retained is org-index.el all others 
(org-reftable.el, org-favtable.el
and org-refer-by-number.el) can simply be removed in favour of org-index.el, 
the latest version of which
resides in worg.

Now, if the last paragraph passes unnoticed for some days, I will send out a 
note directly to someone,
asking to help me clean up :-)

Thanx for your feedback and best regards !
Marc


Am 28.10.2013 12:15, schrieb Michael Strey:

Hello,

I'm using org-reftable.el [1] from the contrib path of the Git
repository since several months.  It is a useful addition to integrate
my personal archive of notes, data sheets, and pages that I tore out of
journals into Org Mode documents.

Now that I wanted to refine this system, I stumbled across the other
packages mentioned in the subject.  It seems that they are all revisions
of the same project from Marc Ihm.  IIUC, org-index.el is the newest
version that was preceded by org-favtable.el, org-reftable.el, and
org-refer-by-number.el.  Currently we have org-favtable.el and
org-reftable.el in the contrib path whilst org-index.el is only
available via Worg [2].

Marc, could you please clarify this confusion?  Anyway, thank you for
sharing this add-on!

Best regards
Michael Strey


Footnotes:
[1]  http://orgmode.org/worg/code/elisp/org-reftable.el
[2]  http://orgmode.org/worg/code/elisp/org-index.el






Re: [O] [dev] New version of org-index.el --- A personal index for org and beyond

2013-09-21 Thread Marc-Oliver Ihm

Hi Alan

Alan Schmitt alan.schm...@polytechnique.org writes:


 I'm trying org-index, and I let the assistant build the table for me. At
 the end of the set, this error occurred:

 ,
 | Saved org-index-id '50E94CE9-06B3-452E-96B6-FA47AA08B9D6' to 
 /Users/schmitta/.emacs.d/custom.el
 | let: No catch for tag: created-new-index, nil
 `

 Is this problematic?


No, not really ... The assistant has finished its work properly and this
tag is just thrown to bail out without signaling an error. However, you
still get an error, which is an annoyance to address. Thanx for reporting !

 Here are a few notes I'm taking as I'm playing with it.

 First, the table seems to be different from the one on worg. Here are
 the columns I have:

   | |  |  | |   | comment   |
   | ref | link | created  | count;s | last-accessed | ;c|
   | | 4  |  | |   |   |

 I guess comment includes Type, description, and Keywords? Or can I
 extend this table as I see fit?


Yes, just add any further columns you need. As long as the do not have a
semicolon, they are ignored. You can also reorder columns according to
your needs.

 Second, I don't see how to update a link in a table so that it points
 somewhere else. Should I just copy the Property drawer to the new place?

Yes, this is possible; or you could copy the id-property from the new
place into the index-table.

 Also, I noticed it's impossible to create a link to a file. If a file
 does not have any org entry, then org-index link will fail with Before
 first headline at position 35591 in buffer  I can go around this by
 creating an headline, but then I cannot use saveplace or something like
 that to put me in the same place in the file (typically at the very end
 of a long data table, to input more data).

Currently org-index uses the function org-id-get-create to create the
link. This function needs an org-mode nodes and whence org-index has the
same limitation. However, it might be possible to create more general
links here, that would be able to point to non-org files. I will check
this for the next version.

 Finally, what is the workflow to create a new reference? The way I do it
 is link from the place to link, then call +fill in the table. Is
 there a simpler way (that would do both in one stroke)?

Definitely: With the initial prompt just choose ref; this will only
create a new reference, but not a link. If you want both, then you
currently have to use the workflow you described. However, having a
feature, that allows both, would be easy to implement, if needed.


best regards,
Marc




Re: [O] Call for volunteer -- managing the publication setup wrt orgmode.org/worg and orgmode.org

2013-04-28 Thread Marc-Oliver Ihm

Hi,

would this be enough ? :

- Monitor the list for problems with worg several times a week
- Run the export process once a week to explicitly look for problems
- Contact the authors of any problematic files
- Not really be able to greatly improve the exporting process itself,
  because of a lack of deeper exporter-knowledge :-)

If yes, then I would like to be counted among the volunteers.


best regards, Marc


Am 28.04.2013 09:01, schrieb Bastien:

Hi all,

next week, I will publish the version of Worg Jay and others
have been working on.  I will also try to clean up the server
configuration to make it stable and to have errors reported
accurately.

Then it would be good to have someone in charge of this.

This should not take too much time, because the goal is to let
the system work automatically.  But some occasional monitoring
and fixing is always needed---e.g., when someone pushes a change
that the server does not process correctly, etc.

The person needs to be able to connect through SSH, to know
Org-mode, to edit a crontab and an .emacs.el file.

Let me know if someone is willing to help for this!






Re: [O] Adding new heading results in not in an item

2013-04-23 Thread Marc-Oliver Ihm

Am 23.04.2013 16:41, schrieb Johan Ekh:

Hi all,
I've installed version 8 of org-mode and now I get the message not in an item when I 
try to add new headings with M-RET. What is wrong?

BR / Johan



Hi Johan !


Well, tried but it just works fine for me (which is a very big relief :-)

Which of the installation methodes as sketched in http://orgmode.org/Changes.html (First 
section, Installation)
did you use ?

Do you see any old (i.e. pre-8) lisp-directories in your load-path ? Do you 
find any old lisp-files within
the directories, where you put the files from version 8 ?


regards, Marc




Re: [O] Best way to generate textile from orgmode ?

2013-04-12 Thread Marc-Oliver Ihm

Hm; good reply.
I will try ...

best regards, Marc

Am 12.04.2013 15:09, schrieb Christian Egli:

Bastien b...@gnu.org writes:


Hi Marc-Oliver,

Marc-Oliver Ihm m...@ihm.name writes:


i would like to convert orgmode to textile (which is used within confluence 
wiki).

What is the best way to do this ?


The best way would be to write a textile exporter.


I agree that this would be for the benefit of everyone. But you could
also just export to md and use pandoc to convert to textile.

Christian






[O] Best way to generate textile from orgmode ?

2013-04-11 Thread Marc-Oliver Ihm

Hello list,

i would like to convert orgmode to textile (which is used within confluence 
wiki).

What is the best way to do this ?

New exporter already or external programs ?

Thanx and best regards,
Marc





Re: [O] [WORG] How to ediff folded Org files?

2013-04-06 Thread Marc-Oliver Ihm

Hi,

if I need to ediff two org-files, I just switch their buffers back to 
fundamental mode temporarily.
Not elegant, but works.

regards, Marc


Am 06.04.2013 11:47, schrieb Thorsten Jolitz:


Hi List,

many files on Worg have this startup option:

,--
| +STARTUP:... fold ...
`--

what leads to trouble when there is a merge-conflict in (Ma)git to be
resolved manually with e(diff), because the different versions of the
Org-file are then presented in folded state in the ediff session, so the
diffs are invisible.

But when I call 'show-all' or so on them, it breaks the ediff session.
Is there a simple trick to avoid this problem?

PS
I don't recieve any new messages from my gmane groups any more since
yesterday - am I the only one?






Re: [O] [dev] New version of org-favtable.el -- Lookup table of favorite references and links

2013-03-17 Thread Marc-Oliver Ihm

Hi,

org-favtable now has its own documentation at worg:

  http://orgmode.org/worg/org-contrib/org-favtable.html

Its table of contents reads like this:

  * Introduction and Overview
  * Three scenarios of typical usage
  * Some concepts of org-favtable
  * Installation and setup
  * A working example
  * The commands of org-favtable
  * Further Reading, Version, Contact

Hoping, this makes a good read.

best regards, Marc




Re: [O] Still Wishing for Snooze

2013-01-26 Thread Marc-Oliver Ihm

Hi Andrew !

Sorry, but I forgot to include one line:

(setq org-date-state-wait-state PENDING)

to define the state, that the node should be changed to
(I have PENDING among my org-states).

Now if I have a node like this:


* TODO Foo


and invoke org-date-state, I get asked for a date (lets assume,
that I answer tomorrow) and the node changes like this:


* PENDING Foo
  CLOSED: [2013-01-26 Sa 18:36]
  :PROPERTIES:
  :DATE_STATE: [2013-01-27 So] TODO
  :END:


Now, if on sunday or later I invoke org-date-state with a prefix argument,
the node changes back to its original state.

Hope you can reproduce that behaviour and find it useful ...


best regards, Marc




Am 24.01.2013 21:09, schrieb Marc-Oliver Ihm:

Hi Andrew,

some time ago I did somethin similar (see below), it works with properties and 
might
come close, to what you want ...

best regards, Marc


(defun org-date-state (arg)
   Save away state for current node; with prefix restore for all nodes if time has 
passed.
   (interactive P)
   (if arg
   (progn
 (let ((today (format-time-string
   (substring (car org-time-stamp-formats) 1 -1)))
   (nvisited 0)
   (nchanged 0))
   (message Scanning...)
   (org-map-entries
(lambda ()
  (let
  ((date_state (org-entry-get nil DATE_STATE))
   date state)
(incf nvisited)
(when date_state
  (unless (string-match (concat \\[
org-ts-regexp1
\\] \\(
(regexp-opt org-todo-keywords-1)
\\))
date_state)
(error Property DATE_STATE ('%s') does not consist of date and 
todo keyword !
   date_state))
  (setq date (match-string 1 date_state))
  (setq state (match-string 9 date_state))
  (unless (string today date)
(org-todo state)
(org-delete-property DATE_STATE)
(search-forward-regexp org-property-start-re)
(org-remove-empty-drawer-at PROPERTIES (point))
(incf nchanged)
nil 'agenda)
   (message Visited %d entries and changed %d of them nvisited 
nchanged)))
 (org-entry-put nil DATE_STATE
(concat
 (format-time-string
  (org-time-stamp-format nil t)
  (org-read-date nil t))
  
 (org-get-todo-state)))
 (org-todo org-date-state-wait-state)))




Am 21.01.2013 19:20, schrieb Andrew M. Nuxoll:

A while ago I posted for help in adding an ability to snooze a to-do item:

http://www.mail-archive.com/emacs-orgmode@gnu.org/msg20114.html

At the time, the only solution available was to create a manual copy of the 
item.  This approach creates as many problems as it solves for me. I've gotten 
so frustrated with this that I'm really to knuckle under and fix it myself.

I'd like to modify the org-mode code to support the following:

1.  Add a date tag to an entry that indicates that it is inactive until a 
certain date.  I'm picturing something like this:

* TODO [#B] Verify login to the virtual machines
   SCHEDULED: 2013-01-11 Tue +1w DELAY: 2013-01-24 Thu

2.  Add a command similar to org-deadline that I can use to attach a delay date 
to a to-do item

3.  When I display my agenda, items that are delayed are not displayed.

My e-lisp is pretty rusty so *any* advice or help is great.  Could someone help 
point me to the right files and functions I'll need to modify to accomplish 
this?

Thanks,
Andrew











Re: [O] Still Wishing for Snooze

2013-01-24 Thread Marc-Oliver Ihm

Hi Andrew,

some time ago I did somethin similar (see below), it works with properties and 
might
come close, to what you want ...

best regards, Marc


(defun org-date-state (arg)
  Save away state for current node; with prefix restore for all nodes if time has 
passed.
  (interactive P)
  (if arg
  (progn
(let ((today (format-time-string
  (substring (car org-time-stamp-formats) 1 -1)))
  (nvisited 0)
  (nchanged 0))
  (message Scanning...)
  (org-map-entries
   (lambda ()
 (let
 ((date_state (org-entry-get nil DATE_STATE))
  date state)
   (incf nvisited)
   (when date_state
 (unless (string-match (concat \\[
   org-ts-regexp1
   \\] \\(
   (regexp-opt org-todo-keywords-1)
   \\))
   date_state)
   (error Property DATE_STATE ('%s') does not consist of date and 
todo keyword !
  date_state))
 (setq date (match-string 1 date_state))
 (setq state (match-string 9 date_state))
 (unless (string today date)
   (org-todo state)
   (org-delete-property DATE_STATE)
   (search-forward-regexp org-property-start-re)
   (org-remove-empty-drawer-at PROPERTIES (point))
   (incf nchanged)
   nil 'agenda)
  (message Visited %d entries and changed %d of them nvisited 
nchanged)))
(org-entry-put nil DATE_STATE
   (concat
(format-time-string
 (org-time-stamp-format nil t)
 (org-read-date nil t))
 
(org-get-todo-state)))
(org-todo org-date-state-wait-state)))




Am 21.01.2013 19:20, schrieb Andrew M. Nuxoll:

A while ago I posted for help in adding an ability to snooze a to-do item:

http://www.mail-archive.com/emacs-orgmode@gnu.org/msg20114.html

At the time, the only solution available was to create a manual copy of the 
item.  This approach creates as many problems as it solves for me. I've gotten 
so frustrated with this that I'm really to knuckle under and fix it myself.

I'd like to modify the org-mode code to support the following:

1.  Add a date tag to an entry that indicates that it is inactive until a 
certain date.  I'm picturing something like this:

* TODO [#B] Verify login to the virtual machines
   SCHEDULED: 2013-01-11 Tue +1w DELAY: 2013-01-24 Thu

2.  Add a command similar to org-deadline that I can use to attach a delay date 
to a to-do item

3.  When I display my agenda, items that are delayed are not displayed.

My e-lisp is pretty rusty so *any* advice or help is great.  Could someone help 
point me to the right files and functions I'll need to modify to accomplish 
this?

Thanks,
Andrew







Re: [O] [DEV] New version of org-reftable.el

2012-12-24 Thread Marc-Oliver Ihm

Hi Bastien, Hi all !

Currently I often use this package to quickly navigate within my org-files.
Entering a keyword gives me a list of nodes associated with this keyword;
within this list, often used entries appear at the top, so that the desired
entry can be spotted very fast.

This will be even easier with the support for normal org-mode links, that
will be introduced with version 2.1, next month.

Comments, as always, are welcome.


Best regards, Marc


Am 24.12.2012 09:47, schrieb Bastien:

Hi Marc-Oliver,

Marc-Oliver Ihm m...@ihm.name writes:


Version 2.0 of org-reftable.el has arrived at worg.
Please find it as:

 http://orgmode.org/worg/code/elisp/org-reftable.el


I've not had time to test the package but I hope others will do.
If you/they think this can be a good candidate for contrib/ please
let us know!  In the mean time, thanks for making it available on
Worg.

Best,







[O] [DEV] New version of org-reftable.el

2012-12-08 Thread Marc-Oliver Ihm

Hello all !

Version 2.0 of org-reftable.el has arrived at worg.
Please find it as:

http://orgmode.org/worg/code/elisp/org-reftable.el

Citing from its documentation:

;;; org-reftable.el --- Ordered lookup table for reference numbers
;;
;; Purpose:
;;
;;  Create, search and look up numbers from a dedicated reference table.
;;  These numbers (e.g. R237 or -455-) may be used to refer to:
;;
;;   - Nodes in Org-mode (insert them into the heading)
;;
;;   - Things outside of org (e.g. mailfolders, directories, reports or
;; pieces of paper)
;;
;;  The table is kept sorted for most frequently or most recently used
;;  reference numbers. Additionally, lines can be selected by keywords, so
;;  that specific references can be found very easily. Earlier versions of
;;  this extension had been named org-refer-by-number.el.
;;

For a very simple example, please see three lines to add to your .emacs
and five org-mode nodes. All appended at the bottom of this message.

Now, for this example, say, that you want to visit the node for project bar
but do not remember its name. However, you recall that its related with 
support.

So you type C-+ to invoke org-reftable and then type support and RET.
This will show you the two lines (R2 and R1) from your table,
which contain the keyword support.

  | R2  | project | bar|   8 | [2012-12-07 Fr] | [2012-12-08 Sa 
23:37] | support, legal |
  | R1  | project | foo|   1 | [2012-12-03 Mo] |
   | support|

The first line R2 ist the one with the highest access count (8), because
the table is kept sorted for this count. And indeed, this is your project bar.
Now just need to hit RET, to visit this node !

org-reftable.el has a lot more bells and whistles, e.g. commands to
create new references or search for existing ones in all your org-files.
All this, including the proper setup, is explained in its documentation.

Any comments or suggestions are highly welcome !


regards, Marc-Oliver Ihm


 lines to add to your .emacs 

(require 'org-reftable)
(setq org-reftable-id f3da98e2-e265-4d4e-9c3a-d22c4b7bba23)
(global-set-key (kbd C-+) 'org-reftable)

 example org-mode nodes 

* TODO R1 Project foo

  - [ ] Read paper R3

* TODO R2 Project bar

  - [ ] Talk to Jim

* DONE R5 Project baz
  CLOSED: [2012-12-08 Sa 23:01]

   - [X] Clean up directory R4

* TODO R6 Project qux

  - [ ] Clean shoes

* Reference numbers
  :PROPERTIES:
  :ID:   f3da98e2-e265-4d4e-9c3a-d22c4b7bba23
  :END:

  | Ref | Type| description;c  | count;s | created | last-accessed  
   | Keywords   |
  
|-+-++-+-+---+|
  | R2  | project | bar|   8 | [2012-12-07 Fr] | [2012-12-08 Sa 
23:37] | support, legal |
  | R5  | project | baz|   5 | [2012-12-05 Mi] | [2012-12-08 Sa 
23:03] | financial  |
  | R6  | project | qux|   3 | [2012-12-08 Sa] | [2012-12-08 Sa 
23:01] | sport  |
  | R4  | folder  | directory  |   2 | [2012-12-08 Sa] | [2012-12-08 Sa 
23:04] ||
  | R1  | project | foo|   1 | [2012-12-03 Mo] |
   | support|
  | R3  | paper   | printed report | | [2012-12-04 Di] |
   ||






Re: [O] Table filter.

2012-05-08 Thread Marc-Oliver Ihm

Am 08.05.2012 11:45, schrieb x.pi...@gmail.com:

Hi all.
Is table filtering is implementad in org-mode?
Thanks.




Well, I have done something similar, which includes a few more operations than 
filtering.
It uses org-babel and comes as an org-file, which combines code and 
documentation.

Hope, this might be useful for you.

with kind regards, Marc-Oliver Ihm


* Table operations --- filter or combine tables

  This section within the library of babel provides table operations.
  See the documentation just below for details and working examples.

  Author  : Marc-Oliver Ihm i...@ferntreffer.de
  Version : 1.0

** Documentation

*** Introduction

The table operations (currently four) are grouped in two categories:

- Filtering the rows of a single table: keeping or removing
- Combining two tables into one: merging or intersecting
 
All four operations are demonstrated below.

*** Example tables

To demonstrate we need three tables: upper, lower and keys:

#+name: upper
|  1 | A |
|  3 | C |
|  4 | D |
| 10 | J |
|  2 | B |

#+name: lower
| Position | Letter |
|--+|
|2 | b  |
|4 | d  |
|5 | e  |
|6 | h  |

#+name: keys
| Position |
|--|
|1 |
|2 |
|4 |

The tables upper and lower both have two columns and associate a position in
the alphabet with the matching letter.  E.g. the row | 1 | A | from table
upper, just states that the letter A comes at position 1 in the alphabet.

Nearly the same is true for table lower, only that it contains lower case
letters.  Some of its letters (e.g. b) have counterparts in table upper
(B), some (e.g. e) dont.

The table keys finally, contains keys (i.e. positions within the alphabet),
that can be used to select rows from either table upper or lower.

Note, that tables may have column headings or not.

*** Filtering a table

 Keeping rows

 Let's say, we want to select the upper-case letters (i.e. rows from the
 table upper), that are given in table keys (i.e. the first, second and
 fourth letter).

 This can be described as filtering table upper and keeping only those rows,
 that appear in table keys.

 As a babel-call, this reads:

#+call: table-operations-filter-keep(upper,keys)

#+results: table-operations-filter-keep(upper,keys)
| 1 | A |
| 4 | D |
| 2 | B |

 ,which gives exactly those rows from table upper, that are specified in
 keys.

 Removing rows

 Now, if on the contrary you want to filter table upper to remove any rows,
 which are given in table keys:

#+call: table-operations-filter-remove(upper,keys) :colnames yes

#+results: table-operations-filter-remove(upper,keys)
| Position | t2c2 |
|--+--|
|3 | C|
|   10 | J|

 ,which is the expected result.

 Please note, that the call contains the header argument :colnames yes,
 which causes the result table to contain the headings Position and
 t2c2. These headings are taken from the input-tables upper and
 keys. However, as upper does not contain any headings, the heading t2c2
 is generated artificially; it stands for table 2 column 2.

 If you do not want to have column names in the result table, just leave out
 the header argument :colnames yes like in the first example. Note
 however, that :colnames no does not give the expected effect.

*** Combining tables

Now, lets have a look at the tables upper and lower alone and see how to
combine them.

Note, that we only look at combining two tables for simplicity, however, all
operations can be easily scaled up to seven tables.

 Merging rows

 We have two tables, one with upper case letters and one with lower
 case. What now, if you want to have only one table, which contains both,
 upper and lower case letters ?
 
 You may want to merge them:

#+call: table-operations-combine-merge(upper,lower) :colnames yes

#+results: table-operations-combine-merge(upper,lower)
| Position | t1c2 | Letter |
|--+--+|
|1 | A||
|2 | B| b  |
|3 | C||
|4 | D| d  |
|5 |  | e  |
|6 |  | h  |
|   10 | J||


 This result combines both upper and lower case letters and lists them by
 their position within the alphabet.

 Intersecting rows

 If you only want the rows, that are complete (i.e. have both upper and
 lower case letters) you may compute the intersection:

#+call: table-operations-combine-intersect(upper,lower)

#+results: table-operations-combine-intersect(upper,lower)
| 2 | B | b |
| 4 | D | d |


 ,which has only those keys and letters, that appear in both tables.

 Note, that we have ommitted the headeragument :colnames yes so that the
 result table has no headings.

** Internals

   This section

Re: [O] Ever used org-mode contrib packages?

2012-05-08 Thread Marc-Oliver Ihm

Hello,

Just fixed the broken link to org-refer-by-number.el;
hopefully this gives others a better chance to actually use it :-)

Please find its short description below.

with kind regards, Marc-Oliver Ihm



org-refer-by-number.el – refer to things by number, when direct
 linking is not possible These reference numbers are added to and
 kept in a table along with the timestamp of their creation. The
 reference numbers may then be used to refer to things outside of
 Org (e.g. by writing them on a piece of paper or use them as
 part of a directory name). Within Org you may then refer to
 these things by their number (e.g. R153). Later, these
 reference numbers can be looked up easily. Written by
 Marc-Oliver Ihm. Link to raw file .








Re: [O] [babel] BUG in call lines

2012-03-22 Thread Marc-Oliver Ihm

Hi Andreas,

I think the behaviour you have discovered is governed by the constant 
org-babel-block-lob-one-liner-regexp;
However, tweaking this regular expression the right way seems to be really hard 
(impossible):

 
http://stackoverflow.com/questions/546433/regular-expression-to-match-outer-brackets

,so the only option seems to be to write a function to do the matching 
correctly,
but which is probably a big task ...

So as I understand things, I would recommend to stick with the current 
behaviour and use your workaround :-)


with kind regards, Marc


Am 22.03.2012 09:42, schrieb Andreas Leha:

Hi all,

there seems to be a bug in call lines:

Suppose, I have a src block with two parameters:

#+name: insert_hline
#+header: :var fulltable=mytable() :var after_row=1
#+begin_src emacs-lisp
   (let ((rrr (cons (quote hline) fulltable))
 (bottomrows (nthcdr after_row fulltable))
 (toprows (reverse (nthcdr (- (length fulltable) after_row) (reverse 
fulltable)
 (setcdr rrr bottomrows)
 (setcdr (nthcdr (- after_row 1) fulltable) rrr)
 fulltable)
  #+end_src

As first argument I would like to pass the results of a second
source block:
#+name: mytable
#+begin_src R
   data.frame(par=1:3, val=1:3)
#+end_src

#+results: mytable
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |

So, what I do is:

#+call: insert_hline(fulltable=mytable(),after_row=1) :hlines yes :colnames no

#+results: insert_hline(fulltable=mytable()
| 1 | 1 |
|---+---|
| 2 | 2 |
| 3 | 3 |

But the #+results: name is shortened.

So, the following won't produce another results block, but wrongly update
the block above:
#+call: insert_hline(fulltable=mytable(),after_row=2) :hlines yes :colnames no


The problem seems to be the ) within the parameter list stopping
some parsing.

Note: This works as expected
#+call: insert_hline[:var fulltable=mytable() :var after_row=1]() :hlines yes 
:colnames no

#+results: insert_hline[:var fulltable=mytable() :var after_row=1]()
| 1 | 1 |
|---+---|
| 2 | 2 |
| 3 | 3 |

#+call: insert_hline[:var fulltable=mytable() :var after_row=2]() :hlines yes 
:colnames no

#+results: insert_hline[:var fulltable=mytable() :var after_row=2]()
| 1 | 1 |
| 2 | 2 |
|---+---|
| 3 | 3 |


Regards,
Andreas









[O] [babel] New Version of lob-table-operations.org --- filter or combine tables

2012-03-18 Thread Marc-Oliver Ihm

Hello,

after fixing some bugs, brushing up the doku and adding the ability to handle 
table headings,
I would like to present a new version of lob-table-operations.org (see the 
attachment).

Table operations can be seen as part of the library of babel and offers
an easy way to filter or combine orgmode tables.

Citing its documentation, which together with some working examples and the 
implementing code,
forms the attached orgmode file:


The table operations (currently four) are grouped in two categories:

- Filtering the rows of a single table: keeping or removing
- Combining two tables into one: merging or intersecting

All four operations are demonstrated below.


I hope, that someone will find this useful; any suggestions for
improvement or extension would be very welcome !

In fact I already received a lot of good advice from Eric Schulte, who helped me
very much in improving this package. Having said this, I would be glad,
if table operations could eventually some day be considered fit for inclusion
into the proper library of babel.


with kind regards, Marc-Oliver Ihm

* Table operations --- filter or combine tables

  This section within the library of babel provides table operations.
  See the documentation just below for details and working examples.

  Author  : Marc-Oliver Ihm i...@ferntreffer.de
  Version : 1.0

** Documentation

*** Introduction

The table operations (currently four) are grouped in two categories:

- Filtering the rows of a single table: keeping or removing
- Combining two tables into one: merging or intersecting
 
All four operations are demonstrated below.

*** Example tables

To demonstrate we need three tables: upper, lower and keys:

#+name: upper
|  1 | A |
|  3 | C |
|  4 | D |
| 10 | J |
|  2 | B |

#+name: lower
| Position | Letter |
|--+|
|2 | b  |
|4 | d  |
|5 | e  |
|6 | h  |

#+name: keys
| Position |
|--|
|1 |
|2 |
|4 |

The tables upper and lower both have two columns and associate a position in
the alphabet with the matching letter.  E.g. the row | 1 | A | from table
upper, just states that the letter A comes at position 1 in the alphabet.

Nearly the same is true for table lower, only that it contains lower case
letters.  Some of its letters (e.g. b) have counterparts in table upper
(B), some (e.g. e) dont.

The table keys finally, contains keys (i.e. positions within the alphabet),
that can be used to select rows from either table upper or lower.

Note, that tables may have column headings or not.

*** Filtering a table

 Keeping rows

 Let's say, we want to select the upper-case letters (i.e. rows from the
 table upper), that are given in table keys (i.e. the first, second and
 fourth letter).

 This can be described as filtering table upper and keeping only those rows,
 that appear in table keys.

 As a babel-call, this reads:

#+call: table-operations-filter-keep(upper,keys)

#+results: table-operations-filter-keep(upper,keys)
| 1 | A |
| 4 | D |
| 2 | B |

 ,which gives exactly those rows from table upper, that are specified in
 keys.

 Removing rows

 Now, if on the contrary you want to filter table upper to remove any rows,
 which are given in table keys:

#+call: table-operations-filter-remove(upper,keys) :colnames yes

#+results: table-operations-filter-remove(upper,keys)
| Position | t2c2 |
|--+--|
|3 | C|
|   10 | J|

 ,which is the expected result.

 Please note, that the call contains the header argument :colnames yes,
 which causes the result table to contain the headings Position and
 t2c2. These headings are taken from the input-tables upper and
 keys. However, as upper does not contain any headings, the heading t2c2
 is generated artificially; it stands for table 2 column 2.

 If you do not want to have column names in the result table, just leave out
 the header argument :colnames yes like in the first example. Note
 however, that :colnames no does not give the expected effect.

*** Combining tables

Now, lets have a look at the tables upper and lower alone and see how to
combine them.

Note, that we only look at combining two tables for simplicity, however, all
operations can be easily scaled up to seven tables.

 Merging rows

 We have two tables, one with upper case letters and one with lower
 case. What now, if you want to have only one table, which contains both,
 upper and lower case letters ?
 
 You may want to merge them:

#+call: table-operations-combine-merge(upper,lower) :colnames yes

#+results: table-operations-combine-merge(upper,lower)
| Position | t1c2 | Letter |
|--+--+|
|1 | A||
|2 | B| b  |
|3 | C||
|4 | D

Re: [O] How to get header in second table generated by src block

2012-03-10 Thread Marc-Oliver Ihm

Hi,

if you add :colnames yes, like this:

#+call: raw-to-table[:exports results](table=raw2) :colnames yes

you get the headers, that you expect.

regards, Marc




[O] How to fontify text within a table with elisp ?

2012-03-03 Thread Marc-Oliver Ihm

Hello,

I would like to insert some fontified text into an org-buffer; this works, as 
long as I am not within a table.

If you run this example within an org-mode buffer:

(insert (org-add-props \n\nOutside table\n\n|Inside table|\n '(font-lock-face 
highlight)))

the first line (Outside table) is fontified correctly, whereas the second line 
(Inside table),
which is a simple table, is not.

Probably this is due to the fact, that org has its own opinion, on how the 
table should be fontified.

Is there any way to circumvent this behaviour ?


with kind regards, Marc-Oliver Ihm




Re: [O] Archiving only with confirmation

2012-03-03 Thread Marc-Oliver Ihm

Am 03.03.2012 16:54, schrieb Markus Grebenstein:

Dear List,

from time to time I involuntarily archive parts of my thesis when I want to 
save (it happens
when I mess up the saving keys). Since I recognized this a couple of days or 
even weeks later
this makes recovering complicated.

Therefore I would love to have the possibility to be asked whether I really 
want to do that. I
used org-archive-subtree-default-with-confirmation but I did not get what the 
meaning of that
one is. When I use that command I am sure that I want to archive and as far as 
I see it does not
change the default behavior.

Does anybody have an idea how to achieve what I want?
Thanks in advance,

Markus





Hi Markus,

Maybe

M-x disable-command

could help.

It will ask you for the command you would like to disable (in your case probably 
org-archive-subtree)

and modify your .emacs accordingly.

You could reach the same effect by putting:

(put 'org-archive-subtree 'disabled t)

in your initialization-file (if it is not .emacs).

I think I will try this too, because I remember some occasions,
that I have used it accidentially like you ...

with kind regards, Marc






[O] [patch] Prevent inlinetasks right after a headline from breaking cycling-behaviour

2012-02-11 Thread Marc-Oliver Ihm

Hello all,

the very small patch appended fixes an oddity with inlinetasks and cycling.
Suppose you have required 'org-inlinetask and work on the following subtree:

* 1
*** 5
*** END
** 2
** 3
*** 4

which has an inlinetask 5 right after the toplevel heading 1 and before any 
of its children.

Now, if you fold this tree by pressing TAB you get:

* 1...

If you unfold it again by pressing TAB, you currently (latest git pull) get 
this:

* 1
*** 5
*** END
** 2
** 3
*** 4

i.e. the tree is completely unfolded !

I think this behaviour is a bug, because it collides with the documentation of 
org-cycle.
This documentation says, that pressing TAB once should only reveal the direct
children like this:

* 1
*** 5
*** END
** 2
** 3...

note, that the heading 4 is still invisible.

The attached patch fixes this bug and makes this example behave like expected 
from
the documentation.

This bug gets more annoying if you have larger and more deeply nested 
structures with
an inlinetask right after the firstlevel heading; in that case a single TAB 
opens the
whole tree, which makes navigation quite cumbersome.

The patch below corrects the function org-cycle-internal-local by simply seting 
the
variable outline-regexp to the value of org-outline-regexp for the call to 
show-children.
org-outline-regexp is already prepared to not match inline-tasks, so using its 
value here
avoids the problem. The patch is quite minimal and I did not see any 
side-effects.


with kind regards, Marc-Oliver Ihm



index 882a41c..7107984 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6302,7 +6302,7 @@ in special contexts.
   (if (org-at-item-p)
  (org-list-set-item-visibility (point-at-bol) struct 'children)
(org-show-entry)
-   (show-children)
+   (let ((outline-regexp org-outline-regexp)) (show-children))
(when (memq 'org-cycle-hide-drawers org-cycle-hook)
  (org-cycle-hide-drawers 'subtree))
;; Fold every list in subtree to top-level items.

diff --git a/lisp/org.el b/lisp/org.el
index 882a41c..7107984 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6302,7 +6302,7 @@ in special contexts.
   (if (org-at-item-p)
 	  (org-list-set-item-visibility (point-at-bol) struct 'children)
 	(org-show-entry)
-	(show-children)
+	(let ((outline-regexp org-outline-regexp)) (show-children))
 	(when (memq 'org-cycle-hide-drawers org-cycle-hook)
 	  (org-cycle-hide-drawers 'subtree))
 	;; Fold every list in subtree to top-level items.


[O] [bug ? regression ?] Re: Visibilty of inline tasks

2012-02-08 Thread Marc-Oliver Ihm

Hi Seb,

I tried an example:

* 1
** 2
** 3
*** 4
*** END

This tree works as expected: If it is completly folded and you press TAB on the heading 
* 1, you get this:

* 1
** 2
** 3...

which is, what can be expeced and what is described in the documenatation.

However, things are different, if you modify the tree by adding an inlinetask 
RIGHT BELOW the firstlevel headline:

* 1
*** 5
*** END
** 2
** 3
*** 4
*** END

If this tree is completely folded and you press TAB on the heading, EVERYTHING 
gets unfolded (which looks exactly
as above of course).

This is not what I would expect and in LARGER TREES this makes it impossible to 
get an OVERVIEW.
(sorry for the free overuse of emphasis here ...)

However, this problem only applies to the latest version of orgmode (7.8);
in older Versions (e.g. 7.4, which I had lying around too  :-) you get this
screen after pressing TAB once:

* 1
*** 5
*** END
** 2
** 3...


which is quite nice and hides the Inlinetask 5.

So: As you expected: There has been a state of good behaviour, which we only 
need to restore :-)

Moreover I tried to venture into the code and found, that cycling is probably 
done in
org-cycle-internal-local, which in turn calls show-children from the old 
outline-package.

Reading its docstring says:

 Show all direct subheadings of this heading.
 Prefix arg LEVEL is how many levels below the current level should be shown.
 Default is enough to cause the following heading to appear.

and this explains the unpleasant behaviour shown above: If the first level 
below the current level
is an inlinetask, this will probably cause EVERY heading within the tree to be 
shown.

Okay. Lets summarize: Probably we understood whats happening, and it might be 
possible to fix this
(because it worked not long ago in Version 7.4).

Unfortunately I am not sure, if my lisp-capabilities are strong enough to fix 
this (are yours ?).
But probably I will try over the weekend anyway if nobody else volunteers ...

Afterwards, we either have a patch to test or need to declare bankruptcy and 
ask for
help of a real elisp-wizard :-)


with kind regards, Marc


Am 06.02.2012 21:34, schrieb Sebastien Vauban:

Hi Marc-Oliver,

Marc-Oliver Ihm wrote:

Am 16.12.2010 14:26, schrieb Sébastien Vauban:

Though that is written in =org-inlinetask.el=:

;; Visibility cycling exempts these nodes from cycling.  So whenever their
;; parent is opened, so are these tasks.

I have the impression that, up to a couple of days ago, the inlined headlines
were showed in the =children= view, such as:

--8---cut here---start-8---
* TODO Write document
** TODO Write intro
** TODO Write code
*** WAIT Ask the client about specs
** TODO Write conclusion
--8---cut here---end---8---

Am I right?

- If yes, could it be back like that?
- If no, would others as well be interested in such a behavior?


as far as I can see, Sebastien description still applies. This behaviour
(bug ?) makes it hard to work with inline-tasks (which I do alot), because
once I open the topmost node, all subheadings with any inline task are
opened too, regardless how depp they are nested. This makes it nearly
impossible to get an overview about the contents of the node.

So: This problem still seems to be around.


What I described was the impression that:

- before December, inline tasks were shown when TAB'ing
- at some point in December, they were not anymore. That's wrong. And I had
   mixed impressions because I saw them when C-c / t'ing for tasks inside a
   document.

In fact, I share your point of view: as they don't participate to document
structure (that's why they're inline tasks), they should not be made visible
when cycling. That's not the current behavior.

Best regards,
   Seb







Re: [O] Visibilty of inline tasks

2012-02-06 Thread Marc-Oliver Ihm

Am 16.12.2010 14:26, schrieb Sébastien Vauban:

Hello,

Though that is written in =org-inlinetask.el=:

;; Visibility cycling exempts these nodes from cycling.  So whenever their
;; parent is opened, so are these tasks.

I have the impression that, up to a couple of days ago, the inlined headlines
were showed in the =children= view, such as:

--8---cut here---start-8---
* TODO Write document
** TODO Write intro
** TODO Write code
*** WAIT Ask the client about specs
** TODO Write conclusion
--8---cut here---end---8---

Am I right?

- If yes, could it be back like that?
- If no, would others as well be interested in such a behavior?

Best regards,
   Seb



Hello all,

as far as I can see, Sebastien description still applies. This behaviour (bug 
?) makes it hard to work
with inline-tasks (which I do alot), because once I open the topmost node, all 
subheadings with any
inline task are opened too, regardless how depp they are nested. This makes it 
nearly impossible to get
an overview about the contents of the node.

So: This problem still seems to be around.

with kind regards, Marc-Oliver Ihm

(And sorry for not beeing able to see the immediate elisp-cause of the problem 
!)




[O] [babel] Is there an elisp-way to see the header-arguments, that are passed to a #+call-line ?

2012-02-05 Thread Marc-Oliver Ihm

Hi again,

is there an elisp-way to see the header-arguments, that are passed to a 
#+call-line ?

(This relates to my previous question [babel] #+call-line removes hlines and 
headings ?, but has
 shifted in subject, so I would like to start a new thread, which can be 
understood on its own ...)

I have tried the internal variable params, but that only gives me the 
header-arguments
of the #+begin_src-block and NOT of the #+call-line.

This is illustrated in the example below:

#+call: parameters() :colnames yes

#+results: parameters()
| :colname-names | nil  |
|+--|
| :rowname-names | nil  |
| :result-params | (silent replace) |
| :result-type   | value|
| :comments  |  |
| :shebang   |  |
| :cache | no   |
| :padline   |  |
| :noweb | no   |
| :tangle| no   |
| :exports   | code |
| :results   | silent   |
| :session   | none |
| :padnewline| yes  |
| :hlines| yes  |
| :colnames  | no   |
| :result-type   | value|
| :result-params | (replace)|
| :rowname-names | nil  |
| :colname-names | nil  |

#+name: parameters
#+begin_src emacs-lisp
(mapcar (lambda (x) (list (car x) (cdr x))) params)
#+end_src

#+results: parameters
| :colname-names | nil   |
| :rowname-names | nil   |
| :result-params | (replace) |
| :result-type   | value |
| :comments  |   |
| :shebang   |   |
| :cache | no|
| :padline   |   |
| :noweb | no|
| :tangle| no|
| :exports   | code  |
| :results   | replace   |
| :colnames  | no|
| :hlines| yes   |
| :padnewline| yes   |
| :session   | none  |


The #+call line calls a #+begin_src-block named parameters, which simple 
dumps the
content of the params-variable, which contains all the header arguments.

If I pass :colnames yes as a header argument, I nevertheless get dumped no 
in the example !
This is probably because the #+begin_src-block only has only access to its
own header-arguments (via the variable params).

Therefore my question:

Is there any way to access the header-arguments of the #+call-line within the 
#+begin_src-block ?
Maybe with the params variable or maybe any other way ?

The reason I need to know this: The value of the header-argument :colnames of 
the #+call-line
governs, whether the #+begin_src-block is expected to return a table with or 
without column-names;
so to react accordingly (and not surprise users) I need to know within the 
#+begin_src-block
the value of the :colnames header-argument from the #+call-line.

Thanx a lot !

with kind regards, Marc-Oliver Ihm

P.s.: Possible solutions I can think of:
- Access the variable params not from the local scope but from the outer 
scope, however
  I do not know, if elisp allows this.
- Pass the header-arguments of the #+call-line to the #+begin_src-block, but 
this would probably
  require a patch to babel.
- Something even more elegant I just cannot figure out :-)

Am 30.01.2012 17:10, schrieb Eric Schulte:


 To explain the cause (if not rationale) for the current behavior; when
 executing a call line, an ephemeral code block is created at the point
 of the call line.  The result of the called function is passed into this
 ephemeral block, and the output of the block is inserted into the
 buffer.

 This is why call lines have *two* possible sets of header arguments, one
 to pass to the original called code block, and one for local effect in
 the ephemeral block.

 The reason the colnames header argument is required for the call line
 and not the code block, is because hlines are only stripped when data
 passes *into* a code block as a variable.  In this case the 'hlines are
 stripped when the table passes into the ephemeral code blocks.

 Hope the above is more illuminating that confusing,






Re: [O] [babel] Is there an elisp-way to see the header-arguments, that are passed to a #+call-line ?

2012-02-05 Thread Marc-Oliver Ihm

Phewww !

Hi Eric, Thanx a lot !

Not quite through with understanding your post, but I already see, that there 
is everything I need in there.

Thanx a lot and Thanx again !

with kind regards, Marc



[O] [code] Small elisp snippet to search among toplevel headlines in a file

2012-02-04 Thread Marc-Oliver Ihm

Hello,

I have one big org-file for a lot of smaller projects,
each of them represented by a toplevel item.

And I have difficulties finding them quickly:
In most cases I know a buzzword from the headline;
however, if I do a search-forward I normally find
some other text within the body of an unrelated project
further above in the file; and only after several
repetitions of search I find the toplevel heading
(i.e. the project) I was looking for.

To make it easier to search only among toplevel headings
(i.e. among the the titles of my projects),
I wrote this small piece of elisp,
which lives in my initialization-file (e.g. .emacs):

(define-key org-mode-map
  [(f11)]
  (lambda () (interactive)
(progn
  (occur (concat ^\\* .*
 (read-from-minibuffer
  Occur for toplevel headlines containing: ))
 nil)
  (pop-to-buffer *Occur*)
  (use-local-map (copy-keymap (current-local-map)))
  (local-set-key (kbd RET)
 (lambda () (interactive)
   (progn
 (occur-mode-goto-occurrence)
 (delete-other-windows)))


To find a project I just press f11 (please choose your own key) and
enter a keyword to do an occur for this keyword. Normally several toplevel
headings are found and the right one is chosen by typing return.

I hope, that someone might find this useful too.

with kind regards, Marc-Oliver Ihm




Re: [O] [babel] #+call-line removes hlines and headings ?

2012-01-31 Thread Marc-Oliver Ihm

Hi Eric,

thanx ! That explains very clearly what I have seen, when trying to debug this 
phaenomenon.
So this behaviour is by design and I can work around :-)

kind regards, Marc



Am 30.01.2012 17:10, schrieb Eric Schulte:

Marc-Oliver Ihmmarc-oliver@online.de  writes:


Am 29.01.2012 11:42, schrieb Andreas Leha:

:colnames yes

Hi Andreas,

Thanx, that is definitely a solution !

And I agree with you, that its a bit puzzling, that both cases behave 
differently;
the #+call-line should just have the same result as the #+begin_src-line, to 
which after all
it just refers. Beeing able to change the behaviour of the #+call-line
with header arguments is
of course a good thing, but it should not be necessary here in the first place.

However, this would require a patch to the babel-code, which I am
currently not able to produce, because I already
got lost in debugging this problem :-) And of course I am not sure
what would be the side effects of changing this
behaviour ...

So, thanx again for pointing out this very easy workaround !


with kind regards, Marc-Oliver Ihm



To explain the cause (if not rationale) for the current behavior; when
executing a call line, an ephemeral code block is created at the point
of the call line.  The result of the called function is passed into this
ephemeral block, and the output of the block is inserted into the
buffer.

This is why call lines have *two* possible sets of header arguments, one
to pass to the original called code block, and one for local effect in
the ephemeral block.

The reason the colnames header argument is required for the call line
and not the code block, is because hlines are only stripped when data
passes *into* a code block as a variable.  In this case the 'hlines are
stripped when the table passes into the ephemeral code blocks.

Hope the above is more illuminating that confusing,






[O] [babel] #+call-line removes hlines and headings ?

2012-01-29 Thread Marc-Oliver Ihm

Hello !

Generally enjoying babel very much, I have stumbled across a behaviour, that I 
do not quite understand:
As it seems, a #+call in babel removes hlines from the results.

Here is an example:

#+call: foo()
| 3 | 4 |

#+name: foo
#+begin_src emacs-lisp
'((1 2) hline (3 4))
#+end_src

#+results: foo
| 1 | 2 |
|---+---|
| 3 | 4 |


The #+begin_src-line does what I would expect; however, when it is called 
through a #+call-line the hline
and the heading are removed.

Is this the intended behaviour, a bug or am I missing something obvious ?

Thanx a lot for any help !

with kind regards, Marc-Oliver Ihm




Re: [O] [babel] #+call-line removes hlines and headings ?

2012-01-29 Thread Marc-Oliver Ihm

Am 29.01.2012 11:42, schrieb Andreas Leha:

:colnames yes

Hi Andreas,

Thanx, that is definitely a solution !

And I agree with you, that its a bit puzzling, that both cases behave 
differently;
the #+call-line should just have the same result as the #+begin_src-line, to 
which after all
it just refers. Beeing able to change the behaviour of the #+call-line with 
header arguments is
of course a good thing, but it should not be necessary here in the first place.

However, this would require a patch to the babel-code, which I am currently not 
able to produce, because I already
got lost in debugging this problem :-) And of course I am not sure what would 
be the side effects of changing this
behaviour ...

So, thanx again for pointing out this very easy workaround !


with kind regards, Marc-Oliver Ihm



Re: [O] [babel] Code for simple set-operations on two tables. Asking for some input.

2012-01-14 Thread Marc-Oliver Ihm

Hello,

please find attached an early draft of lob-table-operations.org.

It already has a reasonable documentation and working examples, so it should be 
easy to play with.

Some features are still missing (e.g. handling of column names and hlines)
and the coding needs some improvement (using the cl-package ?).
So it is probably not yet fit for official inclusion into the library of babel.

with kind regards,
Marc-Oliver Ihm

As a side note: I am very pleased and fascinated, how easily babel and org have 
made the task of keeping together
all aspects of development; from user documentation to implementation and (of 
course !) organisation.

This has made my coding even more fun !


* Table Operations
  :PROPERTIES:
  :ID:   1f8371eb-65e8-416d-ac22-b77431a7df3f
  :END:

** Documentation
   :PROPERTIES:
   :ID:   90a0c9e2-6092-492e-bd4b-c1c737087ac5
   :END:

*** Introduction

This section within the library of babel implements some simple operations, 
that act on
one or more tables to produce other tables.

The known operations are grouped in two categories:

- Filtering the rows of a single table
- Merging two tables into one
 
*** Example tables

To demonstrate we need three tables: upper, lower and keys.

Please note, that column-names are currently not supported !

#+name: upper
|  1 | A |
|  3 | C |
|  4 | D |
| 10 | J |
|  2 | B |

#+name: lower
| 2 | b |
| 4 | d |
| 5 | e |
| 6 | h |

#+name: keys
| 1 |
| 2 |
| 4 |

The tables upper and lower both have two columns and associate a numerical 
position
within the alphabet with the matching letter. E.g. the row | 1 | A | 
within table
upper, just states that the letter A comes at position 1 within the 
alphabet.

Nearly the same is true for table lower, only that it contains lower case 
letters only
and deliberatly not quite the same ones as table upper.

The table keys finally, contains keys (i.e. positions within the alphabet), 
that can be
used to select rows from either table upper or lower.

*** Filtering a table

 Keeping rows

 Let's say, we want to select the upper-case letters (i.e. rows from the 
table upper),
 that are given in table keys (i.e. the first, second and fourth letter).

 This can be described as filtering table upper and keeping only those 
rows, that are
 specified in table keys.

 As a babel-call, this reads:

#+call: table-operations-filter-keep(upper,keys)

#+results: table-operations-filter-keep(upper,keys)
| 1 | A |
| 4 | D |
| 2 | B |

 Which gives exactly those rows from table upper, that are specified in 
keys.

 Removing rows

 Now if on the contrary you want to filter table upper to remove any rows, 
which are given
 in table keys:

#+call: table-operations-filter-remove(upper,keys)

#+results: table-operations-filter-remove(upper,keys)
|  3 | C |
| 10 | J |

*** Combining tables

Now, if we have a look at tables upper and lower (and drop table keys for 
the moment),
it comes to combining tables.

(Here we only look at combining two tables for simplicity, however, all 
examples can
be easily scaled up to seven tables.)

 Merging rows

 We have two table, one with upper-case letter and one with lower-case. 
What now if you
 want to have only one table, which contains both, upper- and lower-case ?
 
 Probably you want to merge them:

#+call: table-operations-combine-merge(upper,lower)

#+results: table-operations-combine-merge(upper,lower)
|  1 | A |   |
|  2 | B | b |
|  3 | C |   |
|  4 | D | d |
|  5 |   | e |
|  6 |   | h |
| 10 | J |   |

 This results-table combines both upper- and lower-case letters and lists 
them by
 their position within the alphabet.

 Speaking more abstract, the result is a single table. Its rows are gained 
by
 combining rows from tables upper and lower with the same key.

 Intersecting rows

 If you only want the rows, that are complete (i.e. have both lower- and 
upper-case
 letters, you should compute the intersection:

#+call: table-operations-combine-intersect(upper,lower)

#+results: table-operations-combine-intersect(upper,lower)
| 2 | B | b |
| 4 | D | d |

 which has only those keys, that apear in both tables.

** Internals

   This section is not required reading for normal users of these table 
operations. Only
   if you are curious about its implementation or development, you might want 
to have a
   look.

*** Implementation
   
   Here is the actual lisp code, that implements the functionality of 
[[id:1f8371eb-65e8-416d-ac22-b77431a7df3f][Table Operations]].

 table-operations-filter
* Directly callable blocks

#+name: table-operations-filter-keep
#+begin_src emacs-lisp :noweb yes :var table=() :var filter=() 
lob-table-operations-filter-defun
(lob-table-operations-filter 'keep table filter)
#+end_src

#+name: table-operations-filter-remove
#+begin_src emacs-lisp :noweb yes :var table

Re: [O] [babel] Is there a way to use edebug on emacs-lisp code blocks ?

2012-01-02 Thread Marc-Oliver Ihm

Am 01.01.2012 23:40, schrieb Nicolas Goaziou:

Marc-Oliver Ihmmarc-oliver@online.de  writes:


So, if I have something like:

#+call: foo(1,2)

I cannot see a way to get a buffer with all the code, that foo might
expand into, INCLUDING the assignments for the arguments 1 and 2.

(If babel would give me such a buffer, than it would be easy to use edebug on 
it, I agree.)

So, to be more precise: Is there any command that would expand a full #+call: 
line like above
with all its arguments into pure elisp ?

AFAIK, there is no such command.


Regards,



Okay, thanx !

Than I will simply define an elisp-function and use edebug in that.

That's definitely fair enough for my case !
(but I will keep explicit edebug-support on my wishlist :-)

with kind regards, Marc-Oliver Ihm




[O] [babel] Is there a way to use edebug on emacs-lisp code blocks ?

2012-01-01 Thread Marc-Oliver Ihm

Hi 2012, hi all !

Is there a way to use edebug for debugging my emacs-lisp code blocks ?
(Or is there another preferred way to debug emacs-lisp code in babel ?)

For normal coding I use edebug a lot and it would be great to be able to use it 
in babel too.

The only workaround I can currently imagine would be to define global functions 
to do the work and
only call these functions from the code blocks ...

with kind and curious regards, Marc-Oliver Ihm




Re: [O] [babel] Is there a way to use edebug on emacs-lisp code blocks ?

2012-01-01 Thread Marc-Oliver Ihm

Am 01.01.2012 21:05, schrieb Nicolas Goaziou:

Hello,

Marc-Oliver Ihmmarc-oliver@online.de  writes:


Is there a way to use edebug for debugging my emacs-lisp code blocks ?
(Or is there another preferred way to debug emacs-lisp code in
babel ?)


You can open the block in a temporary buffer, with C-c ', and use C-u
C-M-x from there.


Regards,



Hi Nicolas,

Thanx, that is close ! However, I also need to resolve noweb references.

Resolving noweb references is something, that org-babel-expand-src-block 
does,
which however is still not what I need, because it only works for #+begin_src 
... #+end_src blocks,
but not for #+call: lines and for the arguments, which can be passed.

So, if I have something like:

#+call: foo(1,2)

I cannot see a way to get a buffer with all the code, that foo might expand 
into, INCLUDING the assignments for the
arguments 1 and 2.

(If babel would give me such a buffer, than it would be easy to use edebug on 
it, I agree.)

So, to be more precise: Is there any command that would expand a full #+call: 
line like above
with all its arguments into pure elisp ?

Thanx for your help !





Re: [O] [babel] Code for simple set-operations on two tables. Asking for some input.

2011-12-28 Thread Marc-Oliver Ihm

Am 27.12.2011 21:53, schrieb Eric Schulte:

Marc-Oliver Ihmmarc-oliver@online.de  writes:


Hello,

Please find attached the elisp-file and a tutorial (as an org-file) for 
org-babel-table-proc.

It provides some simple set-operations (mostly merge and intersect),
which treat org-mode tables as sets.

An example for merging two tables would be:


#+name: lower
| 2 | b |
| 4 | d |
| 5 | e |
| 6 | h |

#+name: upper
|  1 | A |
|  3 | C |
|  4 | D |
| 10 | J |
|  2 | B |

#+begin_src emacs-lisp :var t1=lower :var t2=upper
(babel-table-proc-merge t1 t2)
#+end_src

#+results:
|  1 |   | A |
|  2 | b | B |
|  3 |   | C |
|  4 | d | D |
|  5 | e |   |
|  6 | h |   |
| 10 |   | J |


which merges the two input tables lower and upper into a single table,
even, if they do not have all keys (from the first column) in common.
In general this merges information from two different sources without
loosing anything.

The package org-babel-table-proc provides these and a few other
operations, but definitely still needs some debugging and polishing.

However, before finishing this work, I would like to ask, if something
like this is already present in babel or the library of babel ?



Nothing like this is currently available in the library of Babel.  I do
think that such a library of indexed set operations would be a useful
addition to the library.  As for packaging, although it may be more
comfortable to develop these functions in the manner you are currently
using (with side-by-side .el and .org files), when it comes time to add
these code blocks to the library of babel, I would recommend *combining*
the elisp source and the explanatory prose as a single new subtree in
the existing org-babel-library-of-babel.org file.

Rather than exposing these functions as elisp functions they could be
exposed as Babel code blocks, e.g.,

 #+begin_src emacs-lisp :var t1=lower :var t2=upper
(babel-table-proc-merge t1 t2)
 #+end_src

would instead become

 #+call: proc-merge(lower, upper)



Also, I am not sure, which prefix to use for packages and functions;
is org-babel-table-proc the right name or can it be shortened to
ob-table-proc.



If you package these as code blocks in the library of babel then there
is no issue of prefixing, just pick meaningful names for the code blocks
and don't define any global elisp functions.



Any input would be very welcome !



I hope the above helps, please let me know if I have been unclear or if
you have any other questions.

I look forward to your patch!

Cheers,



With kind regards, Marc-Oliver Ihm






Hi Eric,

Thanx, that was exactly the input I was looking for.
Now I have something nice to code over the vacations :-)

I will try to merge it all into the existing library without using global 
functions and come back with a patch ...

with kind regards, Marc-Oliver Ihm





[O] [babel] Code for simple set-operations on two tables. Asking for some input.

2011-12-26 Thread Marc-Oliver Ihm

Hello,

Please find attached the elisp-file and a tutorial (as an org-file) for 
org-babel-table-proc.

It provides some simple set-operations (mostly merge and intersect), which 
treat org-mode tables as sets.

An example for merging two tables would be:


#+name: lower
| 2 | b |
| 4 | d |
| 5 | e |
| 6 | h |

#+name: upper
|  1 | A |
|  3 | C |
|  4 | D |
| 10 | J |
|  2 | B |

#+begin_src emacs-lisp :var t1=lower :var t2=upper
   (babel-table-proc-merge t1 t2)
#+end_src

#+results:
|  1 |   | A |
|  2 | b | B |
|  3 |   | C |
|  4 | d | D |
|  5 | e |   |
|  6 | h |   |
| 10 |   | J |


which merges the two input tables lower and upper into a single table, even, if 
they do not have all
keys (from the first column) in common.
In general this merges information from two different sources without loosing 
anything.

The package org-babel-table-proc provides these and a few other operations, but 
definitely still needs
some debugging and polishing.

However, before finishing this work, I would like to ask, if something like 
this is already present
in babel or the library of babel ?

Also, I am not sure, which prefix to use for packages and functions; is 
org-babel-table-proc the right name or can
it be shortened to ob-table-proc.

Any input would be very welcome !

With kind regards, Marc-Oliver Ihm
;;; org-babel-table-proc.el --- Common operations on tables for use with 
orgmode and lob

;; Copyright (C) 2010-2011
;;   Free Software Foundation, Inc.

;; Author: Marc-Oliver Ihm
;; Keywords: tables library of babel orgmode
;; Version: 0.01

;;; License:

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; Purpose:
;;  
;;  Common operations on tables for use with orgmode and lob:
;;   - simple set operations (intersection and merge)
;;   - filtering one table according to another
;; 
;;
;; Setup:
;;
;;  (require 'org-babel-table-proc)
;;
;; Further reading:
;;
;;  See the file org-babel-table-proc.org for complete examples.

;;

;;; Code:


(defun babel-table-proc-keep (t1 t2)
  Keep only those keys from the second table, that appear within the first
  (lob-tbl-filter 'keep t1 t2)
  )

(defun babel-table-proc-remove (t1 t2)
  Remove those keys from the second table, that appear within the first
  (lob-tbl-filter 'remove t1 t2)
  )

(defun lob-tbl-filter (what t1 t2)
  Internal function to do the work of babel-table-proc-keep and -remove
  (let (keys
result)
(setq keys (mapcar 'car t1))
(dolist (line t2) 
  (if (equal (member (car line) keys)
 (equal what 'keep))
  (setq result (cons line result))
)
  )
(nreverse result)
)
)

(defun babel-table-proc-merge (rest tables)
  Merge two tables by first column; sort the result
  (babel-table-proc-two-tables-to-one 'merge tables))

(defun babel-table-proc-intersect (rest tables)
  Intersect two tables by first column; sort the result
  (babel-table-proc-two-tables-to-one 'intersect tables))

(defun babel-table-proc-two-tables-to-one (what tables)
  Internal function to do the work of babel-table-proc-merge and -intersect
  (let (is-all-numbers  
less-than-function 
equal-function
conversion-function
format-specifier
rests-of-tables
rest-of-rests-of-tables
rest-of-table
widths-of-tables
current-key
current-key-in-intersection
result-table
result-line
i)

;; Find out, if all keys in all tables are numbers or if there are strings 
among them
(setq is-all-numbers
  (catch 'not-a-number
(dolist (table tables) (dolist (line table) (unless (numberp (car 
line)) (throw 'not-a-number 'nil
't))

;; prepare functions to treat table contents in a unified way
(setq format-specifier (if is-all-numbers %g %s))
(setq conversion-function (if is-all-numbers
  (lambda (x) x)
(lambda (x) (if (numberp x) (number-to-string 
x) x))
))
(setq less-than-function (lambda (x y) (if is-all-numbers ( x y) (string 
(funcall conversion-function x) (funcall conversion-function y)
(setq equal-function (lambda (x y) (if is-all-numbers (= x y) (string= 
(funcall conversion-function x

Re: [O] [DEV] Package org-find-timestamps on worg is now deprecated !

2011-12-25 Thread Marc-Oliver Ihm

Am 20.12.2011 01:12, schrieb Bernt Hansen:

Marc-Oliver Ihmmarc-oliver@online.de  writes:


There is probably some overlap here, but I do not see a way to find the 
timstamps of CLOSED
entries with the agenda. So the agenda does not show what you have 
accomplished, only what
is still open.

Another point are maybe inactive timestamps, which I use a lot to simply mark 
my notes with
the current date. I do not know, if they readily show up in the agenda.


Try this in the daily/weekly agenda view:

C-u l to show clock logs, state changes, and closed time stamps [ to show 
inactive
timestamps

HTH, Bernt




Hi Bernt, Hi list,

Now I have checked the commands available in the agenda and you are right: The 
agenda already
contains excellent functionality to do nearly all of the things, my package 
does.

Therefore I deprecated it on Worg by adding this line:


This module is now deprecated, because it mostly duplicates functionality 
already provided
by the agenda; see the list of agenda commands and especially 'v l' for viewing 
logbook
entries, 'v [' for showing inactive timestamps and 'j' to display the agenda 
for a specified
date.


Thanx again for pointing this out !

Before polishing my next package for publishing, I will first ask the mailing list for any 
pointers to prior art :-)


with kind regards, Marc-Oliver Ihm



Re: [O] [DEV] Package org-find-timestamps on worg

2011-12-20 Thread Marc-Oliver Ihm

Hello Bernt,

Frankly spoken, I did not know, that so much of the functionality I tried to 
implement
was already present in orgmode (and I have been using it for a while now ...).

So I will have to check, what, if anything at all, makes a point for using my 
package.

Thanx for your explanations,
which not at last have taught me, never to underestimate the broadness and 
depth of orgmode :-)

with kind regards, Marc-Oliver Ihm

Am 20.12.2011 01:12, schrieb Bernt Hansen:

Marc-Oliver Ihmmarc-oliver@online.de  writes:


There is probably some overlap here, but I do not see a way to find the 
timstamps of CLOSED entries
with the agenda. So the agenda does not show what you have accomplished, only 
what is still open.

Another point are maybe inactive timestamps, which I use a lot to
simply mark my notes with the current date.
I do not know, if they readily show up in the agenda.


Try this in the daily/weekly agenda view:

C-u l
   to show clock logs, state changes, and closed time stamps
[
   to show inactive timestamps

HTH,
Bernt








Re: [O] [DEV] Package org-find-timestamps on worg

2011-12-19 Thread Marc-Oliver Ihm

Hi Marcelo,

Am 19.12.2011 04:39, schrieb Marcelo de Moraes Serpa:

Hey, sounds useful!



Thank you !



I couldn't really use it though, I don't get this prompt:

Start date (or end):

Should I input the start or end date there? It shows twice, with the same 
prompt.



I think the prompt is similar but different in both cases; just enter the two 
endpoints of the interval
and the function will swap them as needed. So you may enter the start-date or 
the end-date first, it does not matter.



Also, what is the difference of using the agenda + log (to include archives) and go back 
in time with b ?



There is probably some overlap here, but I do not see a way to find the 
timstamps of CLOSED entries
with the agenda. So the agenda does not show what you have accomplished, only 
what is still open.

Another point are maybe inactive timestamps, which I use a lot to simply mark 
my notes with the current date.
I do not know, if they readily show up in the agenda.


Hope, this helps.

with kind regards, Marc




[O] [DEV] Package org-find-timestamps on worg

2011-12-17 Thread Marc-Oliver Ihm

Hello all,

just have pushed the file org-find-timestamps.el to the contrib directory of 
worg:

http://orgmode.org/worg/org-contrib/index.html

The elisp file is here

http://ferntreffer.de/elisp/org-refer-by-number.el

Its description reads like this:

 The function org-find-timestamps allows you to bring the notes, that you take 
within org-mode,
 into a chronological order, even if they are scattered across many different 
files and nodes.
 It shows any SCHEDULED, CLOSED or plain timestamp in a listing with easy 
access to the
 repective nodes. Such a listing provides an answer to the common question 
'What have I done
 last week ?'

Hope, that this package can be useful.


regards, Marc-Oliver Ihm




Re: [O] [DEV] New package org-refer-by-number

2011-11-02 Thread Marc-Oliver Ihm

Am 01.11.2011 21:05, schrieb Jambunathan K:



The location of the elisp file is:

http://ferntreffer.de/elisp/org-refer-by-number.el



Copyright line says it is FSF. In that case, you should consider adding
it to GNU ELPA -  http://elpa.gnu.org


Thanx for the suggestion; I will try !
regards, Marc-Oliver Ihm





Re: [O] [DEV] New package org-refer-by-number

2011-11-01 Thread Marc-Oliver Ihm

Hello all,

fixing some bugs I have published a new version of the package 
org-refer-by-number to Worg:

http://orgmode.org/worg/org-contrib/index.html

,where it available as a contributed package.

The location of the elisp file is:

http://ferntreffer.de/elisp/org-refer-by-number.el

The file is documented extensively, so I hope the package can be used readily by anyone, who 
finds it useful.



regards, Marc-Oliver Ihm




[O] [DEV] New package org-refer-by-number

2011-10-15 Thread Marc-Oliver Ihm

Hello All !

I would like to present the new package org-refer-by-number.

The package allows to refer to things outside of Org, that cannot be linked to 
directly.

An example would be a piece of paper, you get handed over. Within Org you write something about 
it and want to refer to it in an unambiguous way. A common solution would be to simply write a 
unique number on this document (e.g. 277) and to use this number within your notes in Org. 
Through this reference number 277 you can later easily make a connection between your 
Org-notes and the piece of paper.


This use case and others are supported by org-refer-by-number. The package makes it easy to keep 
a table of such reference numbers (277, 278, ...) and allows you to look up or search those 
numbers later on.


Citing the head of its documentation (which you may also find in the attached 
source file):

;; Purpose:
;;
;;  Refer to things by number, when direct links are not possible. This is done 
by
;;  keeping a table with increasing numbers in the first column and a timestamp 
in the
;;  second.
;;
;;  These numbers may then be used to refer to things outside of Org (e.g. you 
may write
;;  them on a piece of paper or use them as part of a directory name). Within 
Org you may
;;  then refer to these things by their number (e.g. R277).
;;
;;
;; Setup:
;;
;;  (require 'org-refer-by-number)
;;  (setq org-refer-by-number-id 7f480c3e-312f-4b9b-b833-6a7a253d1404)
;;  (global-set-key (kbd C-c C-x r) 'org-refer-by-number)
;;
;; Further reading:
;;
;;  Setup: See the variable `org-refer-by-number-id'
;;  Usage: See the function `org-refer-by-number'


Hope, you will find it useful.

with kind regards,
Marc-Oliver Ihm

;;; org-refer-by-number.el --- Refer by number, where linking is not possible

;; Copyright (C) 2011
;;   Free Software Foundation, Inc.

;; Author: Marc-Oliver Ihm
;; Keywords: Org-mode, references
;; Version: 0.99

;;; License:

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; Purpose:
;;
;;  Refer to things by number, when direct links are not possible. This is done by
;;  keeping a table with increasing numbers in the first column and a timestamp in the
;;  second.
;;
;;  These numbers may then be used to refer to things outside of Org (e.g. you may write
;;  them on a piece of paper or use them as part of a directory name). Within Org you may
;;  then refer to these things by their number (e.g. R277).
;;
;;
;; Setup:
;;
;;  (require 'org-refer-by-number)
;;  (setq org-refer-by-number-id 7f480c3e-312f-4b9b-b833-6a7a253d1404)
;;  (global-set-key (kbd C-c C-x r) 'org-refer-by-number)
;;
;; Further reading:
;;
;;  Setup: See the variable `org-refer-by-number-id'
;;  Usage: See the function `org-refer-by-number'

;;

;;; Code:

(require 'org-table)

(defvar org-refer-by-number-id nil 
  Id of the node, that contains the table with reference numbers.

Read below on how to set up things. See the documentation of
`org-refer-by-number' for normal usage after setup.

To create the Org-mode structure for `org-refer-by-number', you
need to:

- Create an Org-mode node, anywhere, any level.
- Get or create the Org-mode id of this node with `org-id-get-create'.
- Store this Id within `org-refer-by-number-id'; within your .emacs
  you may have a line like this:

  (setq org-refer-by-number-id \7f480c3e-312f-4b9b-b833-6a7a253d1404\)

  your id, of course, will be different. The easiest way to get 
  your id, is to copy it from the property drawer of your reference node.


- Within your node: Add a table, that has at least two columns: a number 
  and a timstamp.
- Add one initial row to your table.

As an Example, your node may look like this:

*** My node for org-refer-by-number
  :PROPERTIES:
  :ID:   7f480c3e-312f-4b9b-b833-6a7a253d1404
  :END:

  | Number | Date| Commentary  |
  |+-+-|
  | R277   | [2011-09-03 Sa] | My first number |



Now you may invoke `org-refer-by-number' to create a new
reference number.  For convenience, you might like to bind it to
a key like this:

  (global-set-key (kbd \C-c C-x r\) 'org-refer-by-number)


So, putting it all together, your setup may look like this:


  (require 'org-refer-by-number)
  (setq org-refer-by-number-id \7f480c3e-312f-4b9b-b833-6a7a253d1404

Re: [O] [PATCH] New function org-find-timestamps

2011-08-22 Thread Marc-Oliver Ihm

Am 21.08.2011 14:32, schrieb Philip Rooke:

Marc-Oliver Ihmi...@online.de  writes:


By the way: There are surely official documentation standards, that I
could adhere for this. However, at present I cannot find them. Could
anyone provide me a pointer please ?


Does the file doc/Documentation_Standards.org in the source distribution
help at all?

Failing that the Documentation node in the Elisp info manual has more
general advice.

There is also M-x checkdoc which can help check elisp doc strings.

Phil




Hi Phil,

I have read the first document you mentioned, and its good. It seems that 
texinfo is the primary format to use
and so I will go for that and the other references you have will probably help 
me in the process.


Thanx !

with kind regards, Marc






[O] [PATCH] New function org-find-timestamps

2011-08-20 Thread Marc-Oliver Ihm

Hello !


I would like to submit the attached patch for org.el.

This patch introduces the new function org-find-timestamps, which has 
the documentation given below.


Part of its functionality is also added as a new option to the
function org-sparse-tree. However, the full functionality of
org-find-timestamps can only be used if it is called directly.

This is my first patch to org-mode so I would be grateful for any
advice and comments.
(There already has been some very helpful discussion with Bastien
see news://news.gmane.org:119/4e29c4ba.5090...@online.de)

If this patch is deemed acceptable I would be glad to submit a secound 
patch to the documentation as well. By the way: There are surely 
official documentation standards, that I could adhere for this. However, 
at present I cannot find them. Could anyone provide me a pointer please ?


with kind regards, Marc-Oliver Ihm



org-find-timestamps is an interactive Lisp function in `org.el'.

(org-find-timestamps optional FIRST-DATE LAST-DATE BUFFER-NAME WHICH
COLLECT-METHOD SORT)

Find inactive timestamps within a date-range and maybe sort them.

This function can help to bring the notes, that you take within
org-mode, into a chronological order, even if they are scattered
among many different nodes. The result is somewhat like a diary,
listing the timestamps of the notes, that you have taken on each day.
Such a listing might help to provide an answer to the common question
'What have I done last Week ?'
Please be aware however: This intended usage requires,
that you routinely insert (inactive) timestamps into the
notes that you write, which is a prerequisite habit that you may or
may not want to adopt.

org-find-timstamps works in these steps: Create a regular expression
to match a given range of dates; search for it and
display the results either as a sparse tree or with the help
of occur. The original buffer is not modified.

The Arguments FIRST-DATE and LAST-DATE (-mm-dd) define the range
of timestamps to search for. In general anything, that can be
understood by `org-read-date' will be accepted.

BUFFER-NAME specifies the name of the buffer to search. If nil, use
the current buffer.

The Argument WHICH (one of the symbols `active', `inactive'
or `both'), tells the function, which timestamps to search for.

COLLECT-METHOD can be one of `org-occur', `occur' and
`multi-occur' and determines, Which buffers to search (current or
all org-mode buffers) and how to present the matches.

Results will be sorted according to SORT (either the symbol `y'
or `n'). Sorting however is only possible, if results are presented
with `occur' or `multi-occur'.

All Arguments can be `nil' (or ommitted), in which case their values
are queried interactively.
diff --git a/lisp/org.el b/lisp/org.el
index de8c72b..baffde4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12256,10 +12256,11 @@ p  Enter a property name and its value (both with completion on existing
 r  Show entries matching a regular expression (`/' can be used as well)
 d  Show deadlines due within `org-deadline-warning-days'.
 b  Show deadlines and scheduled items before a date.
-a  Show deadlines and scheduled items after a date.
+a  Show deadlines and scheduled items after a date.
+i  Show inactive or active timestamps within a date interval.
   (interactive P)
   (let (ans kwd value)
-(message Sparse tree: [r]egexp [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty\n [d]eadlines [b]efore-date [a]fter-date)
+(message Sparse tree: [r]egexp [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty\n [d]eadlines [b]efore-date [a]fter-date [i]nterval)
 (setq ans (read-char-exclusive))
 (cond
  ((equal ans ?d)
@@ -12268,6 +12269,8 @@ a  Show deadlines and scheduled items after a date.
   (call-interactively 'org-check-before-date))
  ((equal ans ?a)
   (call-interactively 'org-check-after-date))
+ ((equal ans ?i)
+  (org-find-timestamps nil nil nil nil 'org-occur nil))
  ((equal ans ?t)
   (org-show-todo-tree nil))
  ((equal ans ?T)
@@ -20665,6 +20668,198 @@ Still experimental, may disappear in the future.
 ;; make tree, check each match with the callback
 (org-occur CLOSED: +\\[\\(.*?\\)\\] nil callback)))
 
+(defun org-find-timestamps (optional first-date last-date buffer-name which collect-method sort)
+  Find inactive timestamps within a date-range and maybe sort them.
+
+This function can help to bring the notes, that you take within
+org-mode, into a chronological order, even if they are scattered
+among many different nodes. The result is somewhat like a diary,
+listing the timestamps of the notes, that you have taken on each day. 
+Such a listing might help to provide an answer to the common question 
+'What have I done last Week ?'
+Please be aware however: This intended usage requires, 
+that you routinely insert (inactive) timestamps into the 
+notes that you write, which is a prerequisite habit

Re: [O] Bug: emacs crashes when scrolling column view [7.7]

2011-08-10 Thread Marc-Oliver Ihm

I noticed a similar problem under Windows. Column view reproducible crashes for 
me. Emacs 24 and org 7.6
I think this is more a problem with emacs than with org, but I did not take the 
time to post it into an emacs mailing list.

regards, Marc-Oliver Ihm


Am 09.08.2011 14:27, schrieb Skip Collins:

I am reposting an earlier bug report with a slightly different subject
because this appears to be a serious problem not confined to aquamacs
on macos. I have triggered the crash on both windows and mac emacs and
provided a minimal, complete example to reproduce the problem. It
seems likely to be a more general problem with handling overlays in
Emacs 24. I am happy to provide any more details required to debug.

Originally posted with subject:
Bug: aquamacs hangs when scrolling column view [7.7 (release_7.7.104.g8425)]
http://thread.gmane.org/gmane.emacs.orgmode/45327

On Sat, Aug 6, 2011 at 5:50 PM, Skip Collinsskip.coll...@gmail.com  wrote:

On Fri, Aug 5, 2011 at 11:09 PM, Skip Collinsskip.coll...@gmail.com  wrote:

When I move the scroll bar down in column view, Aquamacs typically
hangs. This is repeatable with the following minimal.emacs file:


I tested emacs 24.0.50.1 and stock org 7.7 on windows xp the with the
same minimal.emacs and minimal orgbug.org files. This crashes emacs.
To trigger the crash, I open the file and ensure that the cursor is at
the top. Then I go into column view with C-c C-x C-c. Then I use the
scroll wheel on my mouse to scroll down. Immediately, the emacs abort
dialog appears. I have not generated a backtrace.




On Fri, Aug 5, 2011 at 11:09 PM, Skip Collinsskip.coll...@gmail.com  wrote:

When I move the scroll bar down in column view, Aquamacs typically
hangs. This is repeatable with the following minimal.emacs file:

--8---cut here---start-8---
(add-to-list 'load-path (expand-file-name ~/Documents/elisp/org-mode/lisp))
(add-to-list 'auto-mode-alist '(\\.\\(org\\  |org_archive\\|txt\\)$
. org-mode))
(setq org-agenda-files '(/tmp/test.org))
(require 'org-install)
(require 'org-habit)

(global-set-key \C-cl 'org-store-link)
(global-set-key \C-ca 'org-agenda)
(global-set-key \C-cb 'org-iswitchb)
--8---cut here---end---8---

orgbug.org:

--8---cut here---start-8---
#
* foo
* bar
* baz
* qux
* foo
* bar
* baz
* qux
* foo
* bar
* baz
* qux
* foo
* bar
* baz
* qux
--8---cut here---end---8---

/Applications/Aquamacs.app/Contents/MacOS/Aquamacs -Q -l
~/minimal.emacs ~/orgbug.org

Emacs  : GNU Emacs 24.0.50.3 (i386-apple-darwin10.8.0, NS apple-appkit-1038.36)
  of 2011-08-02 on colli
Package: Org-mode version 7.7 (release_7.7.104.g8425)

current state:
==
(setq
  org-export-preprocess-before-selecting-backend-code-hook
'(org-beamer-select-beamer-code)
  org-tab-first-hook '(org-hide-block-toggle-maybe
  org-src-native-tab-command-maybe
  org-babel-hide-result-toggle-maybe)
  org-speed-command-hook '(org-speed-command-default-hook
  org-babel-speed-command-hook)
  org-occur-hook '(org-first-headline-recenter)
  org-metaup-hook '(org-babel-load-in-session-maybe)
  org-export-preprocess-before-normalizing-links-hook
'(org-remove-file-link-modifiers)
  org-confirm-shell-link-function 'yes-or-no-p
  org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
   org-beamer-auto-fragile-frames
   org-beamer-place-default-actions-for-lists)
  org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
  org-support-shift-select t
  org-after-todo-state-change-hook '(org-clock-out-if-current)
  org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
  org-agenda-before-write-hook '(org-agenda-add-entry-text)
  org-babel-pre-tangle-hook '(save-buffer)
  org-export-blocks-postblock-hook '(org-exp-res/src-name-cleanup)
  org-mode-hook '(#[nil \300\301\302\303\304$\207
   [org-add-hook change-major-mode-hook org-show-block-all
append local]
   5]
 #[nil \300\301\302\303\304$\207
   [org-add-hook change-major-mode-hook
org-babel-show-result-all append local]
   5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
  org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
  org-babel-execute-safely-maybe)
  org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
  org-export-latex-format-toc-function 'org-export-latex-format-toc-default
  org-export-blocks '((src org-babel-exp-src-block nil)
 (comment org-export-blocks-format-comment t

Re: [O] Trouble compiling

2011-07-27 Thread Marc-Oliver Ihm

On 27.07.2011 11:18, Avery Chan wrote:

To whom it may concern,

I am trying to load orgmode via the emacs-starter kit. Following the
instructions, I did the following:

508 cp -R emacs-starter-kit ~/.emacs.d
509 cd /Users/avery/.emacs.d
511 git submodule init
515 git submodule update

The update procedure failed with the following output:

Cloning into src/org...
error: Unable to get pack file
http://orgmode.org/org-mode.git/objects/pack/pack-beb4230c6615129746e9adfd39b5a38d78a4c191.pack

transfer closed with 49103369 bytes remaining to read
error: Unable to find db094c320412204a990668024f88eef00d307a44 under
http://orgmode.org/org-mode.git
Cannot obtain needed object db094c320412204a990668024f88eef00d307a44
error: Fetch failed.
Clone of 'http://orgmode.org/org-mode.git' into submodule path 'src/org'
failed

Is there a way for me to fix this? I suspect that it is a configuration
issue since when I tried the URL I got a 403.

Thanks!

Avery



Hi !
Just try to download this with my browser, and it worked Okay for my. 
Maybe you hav become victim of a network glitch ? In which case a retry 
would help (if you not already have done this)

regards, Marc



Re: [O] New version which is compatible with emacs 24: New function to view your notes in chronological order

2011-07-26 Thread Marc-Oliver Ihm

Am 26.07.2011 13:55, schrieb Bastien:

Hi Marc-Oliver,

Marc-Oliver Ihmmarc-oliver@online.de  writes:


Unfortunately, org-find-timestamps as posted before was not compatible
with emacs 24. (More precise, it hat problems with the read-only
property, that emacs 24 applies to text within the occur-buffer)

The version below is now compatible with both emacs 23 and 24.


Thanks for updating this function, it works okay here (Emacs 24).

One possible improvement: consider other timestamps than just
inactive timestamps?

As I said, part of this function can be integrated into
`org-sparse-tree' by allowing the user to be prompted for
a range of dates, but the display of ordered timestamps
in the occur is still useful.

Thanks,



Hello Bastien,

Thanx for testing again !

I will try to figure out, how to patch `org-sparse-tree'.

And I will add active timestamps. Which was a think, that I have thought of 
before, but postponed until
someone would suggest/request this feature :-)

Cheers !

with kind regards, Marc-Oliver Ihm





[O] New version which is compatible with emacs 24: New function to view your notes in chronological order

2011-07-22 Thread Marc-Oliver Ihm
Hello !

Unfortunately, org-find-timestamps as posted before was not compatible with 
emacs 24.
(More precise, it hat problems with the read-only property, that emacs 24 
applies to text within the occur-buffer)

The version below is now compatible with both emacs 23 and 24.


Have fun !

with kind regards, Marc-Oliver Ihm



(defun org-find-timestamps ()
  Find inactive timestamps within a date-range and maybe sort them.

This function can help to bring the notes, that you take within
org-mode, into a chronological order, even if they are scattered
among many different nodes. The result is somewhat like a diary,
listing your notes for each successive day. Please be aware
however: This intended usage requires, that you routinely
insert inactive timestamps into the notes that you write.

org-find-timstamps works by creating a regular expression to
match a given range of dates, doing a search for it and
displaying the results either as a sparse tree or with the help
of occur. The original buffer is not modified.

  (interactive)
  (let ((occur-buffer-name *Occur*)
(occur-header-regex ^[0-9]+ match\\(es\\)?) ;; regexp to match for 
header-lines in *Occur* buffer
first-date 
last-date 
pretty-dates
swap-dates
(days 0) 
date-regex
position-before-year
collect-method
buff
org-buffers)
(save-window-excursion
  ;; temporary buffer for date-manipulations
  (with-temp-buffer
;; ask user for date-range
(setq last-date (org-read-date nil nil nil End date (or start):  nil 
nil))
(setq first-date (org-read-date nil nil nil Start date (or end):  nil 
nil))
;; swap dates, if required
(when (string last-date first-date)
  (setq swap-dates last-date)
  (setq last-date first-date)
  (setq first-date swap-dates))
(setq pretty-dates (concat from  first-date  to  last-date))
;; construct list of dates in working buffer
;; loop as long we did not reach end-date
(while (not (looking-at-p last-date))
  (end-of-buffer)
  ;; only look for inactive timestamps
  (insert [)
  (setq position-before-year (point))
  ;; Monday is probably wrong, will be corrected below
  (insert first-date  Mo]\n) 
  (goto-char position-before-year)
  ;; advance number of days and correct day of week
  (org-timestamp-change days 'day) 
  (setq days (1+ days))
  )
(end-of-buffer)
;; transform constructed list of dates into a single, optimized regex
(setq date-regex (regexp-opt (split-string (buffer-string) \n t)))
)
  )
;; ask user, which buffers to search and how to present results
(setq collect-method 
  (car (split-string (org-icompleting-read Please choose, which 
buffers to search and how to present the matches:  '(multi-occur -- all 
org-buffers, list org-occur -- this-buffer, sparse tree) nil t nil nil 
occur -- this buffer, list)))
  )
;; Perform the actual search
(save-window-excursion
  (cond ((string= collect-method occur)
 (occur date-regex)
 )
((string= collect-method org-occur)
 (if (string= major-mode org-mode)
 (org-occur date-regex)
   (error Buffer not in org-mode))
 )
((string= collect-method multi-occur)
 ;; construct list of all org-buffers
 (dolist (buff (buffer-list))
   (set-buffer buff)
   (if (string= major-mode org-mode)
   (setq org-buffers (cons buff org-buffers
 (multi-occur org-buffers date-regex)))
  )
;; Postprocessing: Optionally sort buffer with results
;; org-occur operates on the current buffer, so we cannot modify its 
results afterwards
(if (string= collect-method org-occur)
(message (concat Sparse tree with matches  pretty-dates))
  ;; switch to occur-buffer and modify it
  (if (not (get-buffer occur-buffer-name))
  (message (concat Did not find any matches  pretty-dates))
(let ((original-inhibit-read-only inhibit-read-only))
  (unwind-protect 
  (progn
;; next line might be risky, so we unwind-protect it
(setq inhibit-read-only t)
(set-buffer occur-buffer-name)
(goto-char (point-min))
;; beautify the occur-buffer by replacing the potentially long 
original regexp
(while (search-forward (concat  for \ date-regex \) nil t)
  (replace-match  nil t))
(goto-char (point-min))
;; Sort results by matching date ?
(when (y-or-n-p Sort results by date ? )
  (when (string= collect-method multi-occur)
;; bring all header lines ('xx matches

Re: [O] Possibly new function to view your notes in chronological order

2011-07-18 Thread Marc-Oliver Ihm

Hello Bastien !

Thanx for testing !

Currently I think, that this function is most useful, if applied to all 
org-buffers.
So I personally prefer the mulit-occur option, which gives me a list for all of 
my org-buffers.

Therefore I feel a bit ashamed, that this does not work for you :-/
Did you get any errors ? Anything within the *Messages* Buffer ?
Is at least an *Occur*-Buffer created ?

A guess about a possible cause:
I assume that you alread use emacs 24, whereas I still cling to emacs 23.
Maybe some details of the contents of the created *Occur*-buffer has changed,
which might have broken my code (I found that I need to rely on the contents of 
the *Occur*-buffer).
If you find that such an *Occur*-Buffer is created, when you run my function, 
would it be possible to
send it to me ?

Thanx a lot !

with kind regards, Marc-Oliver Ihm



Am 18.07.2011 10:20, schrieb Bastien:

Hi Marc-Oliver,

Marc-Oliver Ihmi...@online.de  writes:


I would like to submit the new function org-find-timestamps for
disussion.


Thanks for this piece of code and for this idea!

I've tested it a bit and I encourage others to test it.

I was able to create a sparse tree with inactive timestamps,
but I was not able to display a buffer with ordered items.
I will test more carefully and give feedback/debugging.

My main reaction is: your idea/code could partially sneak into
`org-sparse-tree' by adding a new ran[g]e option, asking the
starting and ending dates, and creating the sparse tree.

What do you think?







[O] Possibly new function to view your notes in chronological order

2011-07-17 Thread Marc-Oliver Ihm
Hello All !

I would like to submit the new function org-find-timestamps for disussion. 
Citing its documentation:


 Find inactive timestamps within a date-range and maybe sort them.

 This function can help to bring the notes, that you take within
 org-mode, into a chronological order, even if they are scattered
 among many different nodes. The result is somewhat like a diary,
 listing your notes for each successive day. Please be aware
 however: This intended usage requires, that you routinely
 insert inactive timestamps into the notes that you write.

 org-find-timstamps works by creating a regular expression to
 match a given range of dates, doing a search for it and
 displaying the results either as a sparse tree or with the help
 of occur. The original buffer is not modified.


I would be grateful to for any comments; please find the defun below.


regards, Marc




(defun org-find-timestamps ()
  Find inactive timestamps within a date-range and maybe sort them.

This function can help to bring the notes, that you take within
org-mode, into a chronological order, even if they are scattered
among many different nodes. The result is somewhat like a diary,
listing your notes for each successive day. Please be aware
however: This intended usage requires, that you routinely
insert inactive timestamps into the notes that you write.

org-find-timstamps works by creating a regular expression to
match a given range of dates, doing a search for it and
displaying the results either as a sparse tree or with the help
of occur. The original buffer is not modified.

  (interactive)
  (let ((working-buffer (get-buffer-create *org-find-timestamps working 
buffer*))
(occur-buffer-name *Occur*)
(occur-header-regex ^[0-9]+ match\\(es\\)?) ;; regexp to match for 
header-lines in *Occur* buffer
first-date 
last-date 
pretty-dates
swap-dates
(days 0) 
date-regex
position-before-year
collect-method
buff
org-buffers)
(save-window-excursion
  ;; temporary buffer for date-manipulations
  (set-buffer working-buffer)
  (erase-buffer)
  ;; ask user for date-range
  (setq first-date (org-read-date nil nil nil Starting date:  nil nil))
  (setq last-date (org-read-date nil nil nil End date:  nil nil))
  ;; swap dates, if required
  (when (string last-date first-date)
(setq swap-dates last-date)
(setq last-date first-date)
(setq first-date swap-dates))
  (setq pretty-dates (concat from  first-date  to  last-date))
  ;; construct list of dates in working buffer
  ;; loop as long we did not reach end-date
  (while (not (looking-at-p last-date))
(end-of-buffer)
;; only look for inactive timestamps
(insert [)
(setq position-before-year (point))
;; Monday is probably wrong, will be corrected below
(insert first-date  Mo]\n) 
(goto-char position-before-year)
;; advance number of days and correct day of week
(org-timestamp-change days 'day) 
(setq days (1+ days))
)
  (end-of-buffer)
  ;; transform constructed list of dates into a single, optimized regex
  (setq date-regex (regexp-opt (split-string (buffer-string) \n t)))
  ;; done with temporary buffer
  (kill-buffer working-buffer)
  )
;; ask user, which buffers to search and how to present results
(setq collect-method 
  (car (split-string (org-icompleting-read Please choose, which 
buffers to search and how to present the matches:  '(multi-occur -- all 
org-buffers, list org-occur -- this-buffer, sparse tree) nil t nil nil 
occur -- this buffer, list)))
  )
;; Perform the actual search
(save-window-excursion
  (cond ((string= collect-method occur)
 (occur date-regex)
 )
((string= collect-method org-occur)
 (if (string= major-mode org-mode)
 (org-occur date-regex)
   (error Buffer not in org-mode))
 )
((string= collect-method multi-occur)
 ;; construct list of all org-buffers
 (dolist (buff (buffer-list))
   (set-buffer buff)
   (if (string= major-mode org-mode)
   (setq org-buffers (cons buff org-buffers
 (multi-occur org-buffers date-regex)))
  )
;; Postprocessing: Optionally sort buffer with results
;; org-occur operates on the current buffer, so we cannot modify its 
results afterwards
(if (string= collect-method org-occur)
(message (concat Sparse tree with matches  pretty-dates))
  ;; switch to occur-buffer and modify it
  (if (not (get-buffer occur-buffer-name))
  (message (concat Did not find any matches  pretty-dates))
(set-buffer occur-buffer-name)
(toggle-read-only)
(goto-char 

[O] Re: Non-stop capture?

2011-04-07 Thread Marc-Oliver Ihm

Am 07.04.2011 21:40, schrieb Mark S:

Hello!

I have the emacs org-protocol setup to capture with a default template.
But I still have to C-c C-c and then move back to the browser. Is there
a way to make it so that as text is captured it is automatically and
continuously sent to the capture location without interruption?

Thanks!
Mark




Hello,

Not sure, if I understand correctly.
As far as I know, capture does not set up a seperate buffer (at least 
with recent versions of org). What you see, is just the destination 
buffer narrowed down to a single entry. Therefore your input is never 
sent to the destination buffer, because you already type it there ...


regards, Marc-Oliver Ihm



[O] Re: [PATCH 0/5] Improvements to Taskjuggler export

2011-03-16 Thread Marc-Oliver Ihm

Hello Christian,

Great news !

I am using your wonderful exporter with the extensions from Anthony Lander.
The exporter connects two great tools: Org and taskjuggler and I like it 
very much. Thanx a lot for this work !


Two questions however:

Does your fork incorporate Anthonys enhancements (e.g. the :TJ:-Drawer) ?
Is it available at your github (https://github.com/egli/org-mode) ?


with kind regards, Marc-Oliver Ihm


Am 16.03.2011 12:04, schrieb Christian Egli:

Hi all

I have some long standing improvements to Taskjuggler export which I'd
finally like to push to the repo.

Thanks

Christian Egli (5):
   Add some minimal infrastructure to handle export to both tj2 and tj3
   Mark a task as a milestone if it is a leaf node and cannot be
 scheduled
   Replace recursive functions with iterative ones
   Remove a spurious debug statement
   Escape double quotes in headlines

  lisp/org-taskjuggler.el |   76 +++---
  1 files changed, 58 insertions(+), 18 deletions(-)








[Orgmode] Re: Stuck projects and unbacked priorities

2011-02-27 Thread Marc-Oliver Ihm

Am 27.02.2011 11:28, schrieb Bastien:

Hi Marc-Olivier,

thanks for very clear explanations about the problem you're trying to
fix, and thanks for the code.

I'm not using the GTD-methodology myself, so I cannot really see whether
it meets a general need in the GTD world or not.

Your email and your code are good candidates for Worg, where people
share their specific problems and solutions.  If you want to contribute,
please read this page :

   http://orgmode.org/worg/worg-about.html

Best,



Hello Bastien,

Yes, thats a very good suggestion ! I will post my explanation and code 
on worg, which is a more fitting place for this kind of information.


Thanx !

regards, Marc-Oliver


___
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] Stuck projects and unbacked priorities

2011-02-26 Thread Marc-Oliver Ihm

Hello,

It is well known, that orgmode supports (but does not enforce) David
Allens GTD-approach. One aspect of this approach is to make sure, that
every project (which translates to a toplevel TODO-entry in orgmode),
has at least one subentry in state NEXT.

Now, if someone tries to advance his projects, he simply draws one of
those NEXT-entries and starts to work on it. And of course, this is
supported by orgmode, which makes it very easy to generate such a list
of NEXT-entries as part of a custom agenda.

This is how I, and probably many more people, do their daily work.

However things are not so clear, if one tries to work with priorities
too. Probably one would try to assign priorities (lets say A to D)
to projects (i.e. toplevel TODO-entries); but those priorities (assigned
to TODO-entries) are not visible in the list of NEXT-entries, which is
the basis for daily work.

Inheritance would be an option, giving each NEXT-entry the priority of
its parent TODO-entry; that however would give the same priority to
*all* NEXT-entries within a given project, making it impossible to
differentiate between them. And if a project has many NEXT-entries, than
each one would have the same priority.

So (in my opinion) one needs to assign individual priorities to each
NEXT-entry, or at least to one of them. This priority assigned to the
NEXT-entry should then not be less than the priority of its project (the
toplevel TODO-entry), because if the project is important, than it
should be important too, to work on one of its pieces.

This check (Is there any project, which has no NEXT-entries of equal
priority ?) is done by the function org-unbacked-priorities, which
you find below and which I would like to present here for discussion.

A small example. Lets assume that you have two projects (project 1 and 
2), each with some NEXT-entries (task 1 to 5):


* TODO [#A] project 1
** NEXT [#A] task 1
** NEXT [#B] task 2
* TODO [#B] project 2
** NEXT [#C] task 3
** NEXT [#D] task 4
** WAIT task 5

Now, you may see, that neither of these two projects is stuck (because
they both have NEXT-entries ready to be worked upon).

Project 2 however, has (as I would like to call it) an *unbacked
priority*. The project itself has priority B, but none of its
NEXT-entries matches this overall priority; the highest ranking entry is
task 3 with priority of only C.

To spot such a situation, one could use the function org-unbacked
priorities. For the given example it would produce a list with project
2 as a single entry:

* TODO [#B] project 2

With such a list, one could then decide, either to increase the priority
of a NEXT-entry (lets say from C to B) or (just the other way
around) to decrease the overall priority of project 2 from B down to C.

Okay, I hope, that describes the case. Please find the named function
below. Currently it is far from perfect and has no options to be
customized (and takes no arguments either). However, if people think it
could be useful, I would be glad for any suggestions for improvements.


with kind regards, Marc-Oliver Ihm



(defun org-unbacked-priorities ()
  Find toplevel entries, that do not have at least one child in state 
NEXT and of priority equal or higher

  (interactive)
  (let ((level-1-prio 0)
(level-other-highest-prio 0)
level-1-heading
level-1-state
level-1-marker
insert-helper
result-buffer)

(setq result-buffer (get-buffer-create *Unbacked priorities*))
(save-excursion (set-buffer result-buffer)
(erase-buffer)
(insert These TODO-entries have a higher priority 
than any of its subentries\nin state NEXT (or they have no such 
subentry).\n\n)

)

(setq insert-helper (lambda ()
  (when (and
 (string= level-1-state TODO)
 ( level-other-highest-prio level-1-prio))
(org-add-props level-1-heading nil 
'org-marker level-1-marker)

(save-excursion
  (set-buffer result-buffer)
  (end-of-buffer)
  (insert level-1-heading \n)

(org-map-entries (lambda () (let (this-heading this-prio this-level 
this-todo)

  (setq this-heading (org-get-heading))
  (setq this-prio (org-get-priority 
this-heading))

  (setq this-level (org-current-level))
  (setq this-todo (org-get-todo-state))
  (if ( this-level 1) (if (and
( 
this-prio level-other-highest-prio)
(member 
(org-get-todo-state) '(NEXT WAIT)))
   (setq 
level-other-highest-prio

[Orgmode] [CODE] Stuck projects and unbacked priorities

2011-02-26 Thread Marc-Oliver Ihm

Hello,

I would like to offer some code to find *unbacked priorities* in ones 
projects. Let me explain.


It is well known, that orgmode supports (but does not enforce) David
Allens GTD-approach. One aspect of this approach is to make sure, that
every project (which translates to a toplevel TODO-entry in orgmode),
has at least one subentry in state NEXT.

Now, if someone tries to advance his projects, he simply draws one of
those NEXT-entries and starts to work on it. And of course, this is
supported by orgmode, which makes it very easy to generate such a list
of NEXT-entries as part of a custom agenda.

This is how I, and probably many more people, do their daily work.

However things are not so clear, if one tries to work with priorities
too. Probably one would try to assign priorities (lets say A to D)
to projects (i.e. toplevel TODO-entries); but those priorities (assigned
to TODO-entries) are not visible in the list of NEXT-entries, which is
the basis for daily work.

Inheritance would be an option, giving each NEXT-entry the priority of
its parent TODO-entry; that however would give the same priority to
*all* NEXT-entries within a given project, making it impossible to
differentiate between them. And if a project has many NEXT-entries, than
each one would have the same priority.

So (in my opinion) one needs to assign individual priorities to each
NEXT-entry, or at least to one of them. This priority assigned to the
NEXT-entry should then not be less than the priority of its project (the
toplevel TODO-entry), because if the project is important, than it
should be important too, to work on one of its pieces.

This check (Is there any project, which has no NEXT-entries of equal
priority ?) is done by the function org-unbacked-priorities, which
you find below and which I would like to present here for discussion.

A small example. Lets assume that you have two projects (project 1 and
2), each with some NEXT-entries (task 1 to 5):

* TODO [#A] project 1
** NEXT [#A] task 1
** NEXT [#B] task 2
* TODO [#B] project 2
** NEXT [#C] task 3
** NEXT [#D] task 4
** WAIT task 5

Now, you may see, that neither of these two projects is stuck, because
they both have NEXT-entries ready to be worked upon.

Project 2 however, has (as I would like to call it) an
*unbacked priority*: The project itself has priority B, but none of
its NEXT-entries matches this overall priority; the highest ranking
entry is task 3 with priority of only C.

To spot such a situation, one could use the function org-unbacked
priorities. For the given example it would produce a list with project
2 as a single entry:

* TODO [#B] project 2

With such a list, one could then decide, either to increase the priority
of a NEXT-entry (lets say from C to B) or (just the other way
around) to decrease the overall priority of project 2 from B to C.

Okay, I hope, that describes the case. Please find the named function
below. Currently it is far from perfect and has no options to be
customized (and takes no arguments either). However, if people think it
could be useful, I would be grateful for any suggestions for improvements.


with kind regards, Marc-Oliver Ihm



(defun org-unbacked-priorities ()
  Find toplevel entries, that do not have at least one child in state 
NEXT and of priority equal or higher

  (interactive)
  (let ((level-1-prio 0)
(level-other-highest-prio 0)
level-1-heading
level-1-state
level-1-marker
insert-helper
result-buffer)

(setq result-buffer (get-buffer-create *Unbacked priorities*))
(save-excursion (set-buffer result-buffer)
(erase-buffer)
(insert These TODO-entries have a higher priority 
than any of its subentries\nin state NEXT (or they have no such 
subentry).\n\n)

)

(setq insert-helper (lambda ()
  (when (and
 (string= level-1-state TODO)
 ( level-other-highest-prio level-1-prio))
(org-add-props level-1-heading nil 
'org-marker level-1-marker)

(save-excursion
  (set-buffer result-buffer)
  (end-of-buffer)
  (insert level-1-heading \n)

(org-map-entries (lambda () (let (this-heading this-prio this-level 
this-todo)

  (setq this-heading (org-get-heading))
  (setq this-prio (org-get-priority 
this-heading))

  (setq this-level (org-current-level))
  (setq this-todo (org-get-todo-state))
  (if ( this-level 1) (if (and
( 
this-prio level-other-highest-prio)
(member 
(org-get-todo-state) '(NEXT WAIT

[Orgmode] Re: A way to export agenda with links into org-files to html ?

2011-02-21 Thread Marc-Oliver Ihm

Am 05.02.2011 22:46, schrieb Marc-Oliver Ihm:

Hello,

I have some co-workers with whom I would like to share my notes from org
and even some of the todos, which are recorded there.

Unfortunately they are not very emacs savy, so that I need another way
besides emacs to give access to this information. Html is an obvious
option.

The html exporter gives excellent results for all of my org-files and
with org-write-agenda it is very easy to write the agenda to file.

However, in the html-version of the agenda there are no links.

Is there a way around this or is there another way to do this ?

I know, there have been discussions on this topic, but I have found no
solution yet.

Is there a way ?

Any help would be appreciated.

with kind regards, Marc-Oliver Ihm


___
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



Thanx for holding up this thread while I was away :-)

To be me more precise than my original posting: With links in the 
agenda buffer, I meant the feature, that precssing return in the agenda 
buffer sends one to the corresponding position in the original buffer.


It would be very useful, if such links could be converted to 
html-links when exporting the agenda.


Thanx for considering such a feature.

kind regards, Marc-Oliver Ihm


___
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] A way to export agenda with links into org-files to html ?

2011-02-05 Thread Marc-Oliver Ihm

Hello,

I have some co-workers with whom I would like to share my notes from org 
and even some of the todos, which are recorded there.


Unfortunately they are not very emacs savy, so that I need another way 
besides emacs to give access to this information. Html is an obvious option.


The html exporter gives excellent results for all of my org-files and 
with org-write-agenda it is very easy to write the agenda to file.


However, in the html-version of the agenda there are no links.

Is there a way around this or is there another way to do this ?

I know, there have been discussions on this topic, but I have found no 
solution yet.


Is there a way ?

Any help would be appreciated.

with kind regards, Marc-Oliver Ihm


___
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] Antwort: Re: org-babel: feature-request: allow table-cells to be passed as strings

2010-11-04 Thread marc-oliver . ihm
Hello Eric,


Thanx for coming back on me !

In fact I have found this problem when trying to use calc with babel.
And yes, I agree, using calc for parsing will probably solve this problem.

In fact I am quite excited about the plans for adding calc as a new 
language to babel. It will be a great tool and toy !


with kind regards, Marc-Oliver Ihm





Eric Schulte schulte.e...@gmail.com 
03.11.2010 21:12

An
Marc-Oliver Ihm i...@online.de
Kopie
emacs-orgmode@gnu.org
Thema
Re: org-babel: feature-request: allow table-cells to be passed as strings





Hi Marc,

Sorry to stall this thread for so long.

Now that I've worked some with Calc it seems that it provides a mature
library of working with large numbers.  My new hope is to convert Babel
to using Calc for all of its numerical string parsing and printing.
That should solve your dilemma in the most natural way.

Does anyone foresee any problems in this potential approach?

Thanks -- Eric

Marc-Oliver Ihm i...@online.de writes:

 Hello,

 This would be such an example. The Input table contains some numbers,
 the last of them larger than allowed for an integer.

 As the result table show, the last one is converted to float thereby
 using some precision.

 I would like to see them all as strings.

 with kind regards, Marc-Oliver Ihm


 #+tblname: numbers

 |   1 |
 |   2 |
 |  12 |
 |  45 |
 | 166 |
 |12567890 |
 | 23123128237198327938999 |


 #+begin_src emacs-lisp :var numbers=numbers
 (mapcar
  (lambda (line)
  (let ((number (car line)))
(list number (type-of number))
)
  )
numbers)
 #+end_src

 #+results:
 |  1 | integer |
 |  2 | integer |
 | 12 | integer |
 | 45 | integer |
 |166 | integer |
 |   12567890 | integer |
 | 2.3123128237198328e+26 | float   |




 Am 04.10.2010 15:30, schrieb Eric Schulte:
 Hi,

 Could you send an example of the contents of such a cell, and what it 
is
 converted to?  Maybe it will be possible to improve the parsing of
 numerals in Babel s.t. we don't lose precision in these cases.

 Thanks -- Eric

 Marc-Oliver Ihm i...@online.de writes:

 Hello !

 Currently org-babel, when passing a table as input to a
 source-code-block, behaves like this:
 If the cell looks like a number, it will be converted to an integer or 
a
 float. Otherwise the cell-content is passed unconverted as a string.

 Now, dealing with very large numbers (which I want to process with
 calc), I found this behavior annoying, because babel converts my large
 numbers to float, loosing precision in the process.

 Now my request would be, to have a switch (maybe as a header argument)
 which would tell babel to pass all cells as unconverted strings.

 I have checked the documentation and the sources and have not been 
able
 to find such a switch.


 with kind regards, Marc-Oliver Ihm


 ___
 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

 ___
 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




Namensgeber des neuen Mainzer Fussballstadions 
Aktuelle Infos zur Coface Arena: www.coface-arena.de


Naming right sponsor of the new Mainzer football stadium 
Latest news on the Coface Arena: www.coface-arena.de

___
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] [Babel] Proposed addition to the Library of Babel: Merge two or more (possibly incomplete) tables by first column. And a question.

2010-10-25 Thread Marc-Oliver Ihm
Hello !

Well, here is an example:

 #+tblname: lower
 | 2 | b |
 | 4 | d |
 | 5 | e |
 | 6 | h |
 
 #+tblname: upper
 |  1 | A |
 |  3 | C |
 |  4 | D |
 | 10 | J |
 |  2 | B |
 
 #+begin_src emacs-lisp :var t1=lower :var t2=upper
   (merge-tables-by-first-column t1 t2)
 #+end_src
 
 #+results:
 |  1 |   | A |
 |  2 | b | B |
 |  3 |   | C |
 |  4 | d | D |
 |  5 | e |   |
 |  6 | h |   |
 | 10 |   | J |
 

This example uses two tables as input; both of which associate numbers
(first column, simply the position within the alphabet) with letters
(second column). There is one table for lower- and one table for
upper-case letters.

Both tables are processed with babel and the function
merge-tables-by-first-column.

The third table is the result, which merges the two input tables: It
contains all lines and all columns from both tables. Note, that not
every number needs to appear in both input-tables; e.g. 1 does not
appear in the table lower and therefore the corresponding cell (first
line, second column) within the result table is empty; this is probably
different from existing ways of merging tables.

This function might be useful for consolidating results from different
data sources. Please find the elisp-code for
merge-tables-by-first-column below.

Having explained so far, I have a question: Currently I have defined the
function merge-tables-by-first-column within my emacs startup file.
However, I think, that this defun should be placed within the library of
babel (if acceptable); and for efficency reasons maybe even in a way,
that it will only be compiled at emacs startup (and not at every
invocation). Is that possible ?

In the meantime, however this code works well, if placed within your
.emacs-file.


I hope this code might proof useful
and would like to thank for any answers to my question !


With kind regards, Marc-Oliver Ihm



(defun merge-tables-by-first-column (rest tables)
  Merge any number of tables by treating their first column as a key;
sort the result
  (interactive)
  (let (is-all-numbers
less-than-function
equal-function
conversion-function
format-specifier
rests-of-tables
rest-of-rests-of-tables
rest-of-table
widths-of-tables
current-key
result-table
result-line
i)

;; Find out, if all keys in all tables are numbers or if there are
strings among them
(setq is-all-numbers
  (catch 'not-a-number
(dolist (table tables) (dolist (line table) (unless (numberp
(car line)) (throw 'not-a-number 'nil
't))

;; prepare functions to treat table contents in a unified way
(setq format-specifier (if is-all-numbers %g %s))
(setq conversion-function (if is-all-numbers
  (lambda (x) x)
(lambda (x) (if (numberp x)
(number-to-string x) x))
))
(setq less-than-function (lambda (x y) (if is-all-numbers ( x y)
(string (funcall conversion-function x) (funcall conversion-function y)
(setq equal-function (lambda (x y) (if is-all-numbers (= x y)
(string= (funcall conversion-function x) (funcall conversion-function y)


;; sort tables
(setq tables (mapcar (lambda (table) (sort table (lambda (x y)
(funcall less-than-function (car x) (car y) tables))

;; compute and remember table widths
(setq widths-of-tables (mapcar (lambda (x) (length (car x))) tables))

(setq rests-of-tables (copy-list tables))

;; loop as long as the rest of table still contains lines
(while (progn
 ;; find lowest key among all tables, which is the key for
the next line of the result
 (setq current-key nil)
 (dolist (rest-of-table rests-of-tables) (when (and
rest-of-table
   (or (null
current-key)

(funcall less-than-function (caar rest-of-table) current-key)))
  (setq current-key
(caar rest-of-table
 current-key)

  (progn

(setq result-line (list current-key))

;; go through all tables and collect one line for the result
table ...
(setq i 0) ; table-count
;; cannot use dolist like above, because we need to modify the
cons-cells
(setq rest-of-rests-of-tables rests-of-tables)
(while (progn
 (setq rest-of-table (car rest-of-rests-of-tables))
 (setq i (1+ i))
 ;; if table contains current key
 (if (and rest-of-table
  (funcall equal-function current-key (caar
rest-of-table)))
 ;; then copy rest of line
 (progn (nconc result-line (cdar rest-of-table))
;; and shorten rest
(setcar rest-of-rests-of-tables (cdar
rest-of-rests-of-tables

[Orgmode] Re: Tiny piece of customization for ctrl-c ctrl-c within a timestamp

2010-10-17 Thread Marc-Oliver Ihm
Am 16.10.2010 21:58, schrieb Nick Dokos:
 Jeff Horn jrhorn...@gmail.com wrote:
 
 Very useful, since I often do the same! Thanks for this.

 On Sat, Oct 16, 2010 at 12:34 PM, Marc-Oliver Ihm i...@online.de wrote:
 Hello !


 I sometimes find myself adjusting timestamps just by editing its text;
 e.g. changing 2010-10-16 Su to 2011-10-16 Su. However after that
 editing, the day of week is usually wrong (or might be right, I just
 dont know).

 With this small piece of lisp, one just needs to press ctrl-c ctrl-c
 while the cursor is in a timestamp and the day of week is adjusted.


 (defun org-set-weekday-of-timestamp ()
  Check if cursor is within a timestamp and compute weekday from numeric
 date
  (interactive)
  (when (org-at-timestamp-p t)
(org-timestamp-change 0 'year)
(message Weekday of timestamp has been adjusted.)
t
  ))

 (add-hook 'org-ctrl-c-ctrl-c-hook 'org-set-weekday-of-timestamp)


 Maybe someone else might find that useful too.


 With kind regards, Marc-Oliver Ihm

 
 My hack for this is S-right S-left: it advances the date up and down
 by 1 but has the side effect of setting the day of the week correctly.
 
 Nick
 
 ___
 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
 

S-right S-left is nearly as short, and I did not think about it :-)
The only remaining advantage of my hack (besides the apparent
disadvantage of needing explicit customization) is, that it increases
the dwimity of ctrl-c ctrl-c ...

Thanx and kind regards, Marc-Oliver Ihm


___
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] Tiny piece of customization for ctrl-c ctrl-c within a timestamp

2010-10-16 Thread Marc-Oliver Ihm
Hello !


I sometimes find myself adjusting timestamps just by editing its text;
e.g. changing 2010-10-16 Su to 2011-10-16 Su. However after that
editing, the day of week is usually wrong (or might be right, I just
dont know).

With this small piece of lisp, one just needs to press ctrl-c ctrl-c
while the cursor is in a timestamp and the day of week is adjusted.


(defun org-set-weekday-of-timestamp ()
  Check if cursor is within a timestamp and compute weekday from numeric
date
  (interactive)
  (when (org-at-timestamp-p t)
(org-timestamp-change 0 'year)
(message Weekday of timestamp has been adjusted.)
t
  ))

(add-hook 'org-ctrl-c-ctrl-c-hook 'org-set-weekday-of-timestamp)


Maybe someone else might find that useful too.


With kind regards, Marc-Oliver Ihm


___
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: [Babel] Library calls and begin_example, where may I find the code ?

2010-10-16 Thread Marc-Oliver Ihm
Hello !

Sorry for bothering but I have not been able to find this code.
Could you please provide a pointer ?

Thanx a lot !

with kind regards, Marc-Oliver Ihm


Am 16.10.2010 04:55, schrieb Thomas S. Dye:
 Aloha all,
 
 I'm working with Eric Fraga's GANTT chart code, posted here recently.  
 I'd like to move it into the Library of Babel so I can call it from any
 Org-mode buffer.  Here is the (modified) header:
 
 #+source: elispgantt
 #+begin_src emacs-lisp :var table=gantttest :results output latex
 :exports code
 
 When this code is in the Org-mode buffer, the results are wrapped in
 BEGIN_latex ... END_latex, which is just what I want.
 
 When the same code is in the Library of Babel and is called like this:
 
 #+lob: elispgantt(table=gantttest)
 
 the results are wrapped in begin_example ... end_example, which is not
 what I want.
 
 How can I get the LOB code to perform like its in-buffer sibling and
 wrap the output in BEGIN_latex ... END_latex?
 
 All the best,
 Tom
 
 
 ___
 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
 



___
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] org-babel: feature-request: allow table-cells to be passed as strings

2010-10-04 Thread Marc-Oliver Ihm
Hello !

Currently org-babel, when passing a table as input to a
source-code-block, behaves like this:
If the cell looks like a number, it will be converted to an integer or a
float. Otherwise the cell-content is passed unconverted as a string.

Now, dealing with very large numbers (which I want to process with
calc), I found this behavior annoying, because babel converts my large
numbers to float, loosing precision in the process.

Now my request would be, to have a switch (maybe as a header argument)
which would tell babel to pass all cells as unconverted strings.

I have checked the documentation and the sources and have not been able
to find such a switch.


with kind regards, Marc-Oliver Ihm


___
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: org-babel: feature-request: allow table-cells to be passed as strings

2010-10-04 Thread Marc-Oliver Ihm
Hello,

This would be such an example. The Input table contains some numbers,
the last of them larger than allowed for an integer.

As the result table show, the last one is converted to float thereby
using some precision.

I would like to see them all as strings.

with kind regards, Marc-Oliver Ihm


#+tblname: numbers

|   1 |
|   2 |
|  12 |
|  45 |
| 166 |
|12567890 |
| 23123128237198327938999 |


#+begin_src emacs-lisp :var numbers=numbers
(mapcar
 (lambda (line)
 (let ((number (car line)))
   (list number (type-of number))
   )
 )
   numbers)
#+end_src

#+results:
|  1 | integer |
|  2 | integer |
| 12 | integer |
| 45 | integer |
|166 | integer |
|   12567890 | integer |
| 2.3123128237198328e+26 | float   |




Am 04.10.2010 15:30, schrieb Eric Schulte:
 Hi,
 
 Could you send an example of the contents of such a cell, and what it is
 converted to?  Maybe it will be possible to improve the parsing of
 numerals in Babel s.t. we don't lose precision in these cases.
 
 Thanks -- Eric
 
 Marc-Oliver Ihm i...@online.de writes:
 
 Hello !

 Currently org-babel, when passing a table as input to a
 source-code-block, behaves like this:
 If the cell looks like a number, it will be converted to an integer or a
 float. Otherwise the cell-content is passed unconverted as a string.

 Now, dealing with very large numbers (which I want to process with
 calc), I found this behavior annoying, because babel converts my large
 numbers to float, loosing precision in the process.

 Now my request would be, to have a switch (maybe as a header argument)
 which would tell babel to pass all cells as unconverted strings.

 I have checked the documentation and the sources and have not been able
 to find such a switch.


 with kind regards, Marc-Oliver Ihm


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



___
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