Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.

2009-12-30 Thread James TD Smith
Hi Manish,

On 2009-12-30 17:02:47(+0530), Manish wrote:
 I cloned the repo at git://yog-sothoth.mohorovi.cc/org-mode.git but
 did not find `misc-new-features' branch and could not find the changes
 in the org-mode proper as well.  The changes sound very interesting
 and I recently found a need for it.  Hope you have not decided to
 abandon the feature.

No, it's finished and working; I deleted the branch once Carsten had merged it
into the main org branch. The changes are definately in 6.33 and later, it's
mentioned in the Changelog. What version of org-mode are you using?

 Warm regards and a very happy new year!

And to you as well.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] Setting PROPERTIES in remember templates automatically

2009-11-27 Thread James TD Smith
Hi Tassilo,

On 2009-11-27 10:48:06(+0100), Tassilo Horn wrote:

snip
 
 What I'd like to have is something like the existing
 
   %^{prop}p   Prompt the user for a value for property `prop'
 
 but more like
 
   %{prop,escape}p   Insert property `prop' with value taken from escape,
 if that is non-nil
 
 With this
 
   %{created,U} %{link,a}
 
 in a template would always create a :created: property with an inactive
 timestamp, and :link: would only be inserted, if there is an annotation
 for that remember invocation.
 
 What do you think?

I've actually got something like this working, as part of a whole load of
improvements to remember which I've been working on for ages. If you want to
take a look it's in the remember-lite branch at
git://yog-sothoth.mohorovi.cc/org-mode.

The first major change is that remember templates are now plists. Old-style
templates are automatically converted to the new format, but if you want to
access any of the new features you will need to use the new template format, and
add your templates to org-remember-templates-2.

Properties are now set by adding a :properties property to the list. This should
be followed by a list containing either:
- A string. Query the user for the property value.
- A cons cell. The head should be a string (the property name) and the tail can
  be either:
  - Another string: add the property with that string as its value
  - A variable: add the property with the value of the variable 
  - A function: call the function to get the property value.

There is also a variable `org-remember-default-properties', for properties you
want added to all remembered items.

Mine is set like this

--8---cut here---start-8---
(setq org-remember-default-properties
  '((CREATED .
   (lambda () (format-time-string (org-time-stamp-format t t)
   org-remember-current-time)))
   (CONTEXT .
(lambda () (if (and (marker-buffer org-clock-marker)
 (not (eq (marker-buffer org-clock-marker)
   (current-buffer
   (org-substring-no-properties org-clock-heading)
 Idle)
--8---cut here---end---8---

which adds two properties to every item I remember, one containing the current
time as an inactive timestamp and the other containing the name of the currently
clocked task or 'Idle' if I'm not clocked into anything.

Here's an example template with properties:

--8---cut here---start-8---
(:key ?r :type headline :name Book
  :target ~/Personal/ReadingList.org::Books
  :properties (AUTHOR ISBN) :tag t :tagscope file
  :template * MEDIA %^{Title} %?)
--8---cut here---end---8---

When I remember something using this template, the CREATED and CONTEXT
properties are added automatically, and I get asked for the values for AUTHOR
and ISBN.

Anyway, there are lots of other changes, and probably a few bugs, and there
isn't much in the way of documentation yet :). Let me know how you get on.

James 

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] Re: Bug with time summary in column view?

2009-11-25 Thread James TD Smith
Hi Norbert,

On 2009-11-25 08:25:08(-0400), Norbert Zeh wrote:
 Norbert Zeh [2009.11.25  543 -0400]:
 Alright, while we're at it ;), here's another somewhat unexpected
 behaviour.  I'm not even sure this should be considered a bug, but it's
 more a matter of defining what the right behaviour should be.

It seems like a bug to me, in that the effort summary for the day will be wrong.

 If I have an entry with an effort estimate of, say, 1:00 and it is shown
 in today's agenda because it is scheduled today and the deadline is in 2
 days, the 1:00 time effort is counted twice in the effort summary for
 the day.  To me, this doesn't make much sense, as it's only one task,
 not two.  So, if I were to choose how to treat this situation, I would
 simply say that all entries shown because of their deadline should not
 be listed in this summary.  Then, of course, this may not be the right
 rule in all situations.
 
 Any ideas how one could let the user specify on a per-column basis
 whether entries shown because of a deadline should be included in the
 summary or not?

I think this will be quite complicated to fix. There are multiple reasons an
item can appear in the agenda: active timestamps, deadlines, scheduling, and in
log mode clocked time and inactive timestamps, so any solution would need to
handle all of those. As far as column view is concerned each line in the agenda
is a different item.

If we attach a property to each line in the agenda indicating where it came from
(using org ids or similar), the summary calculation code for the agenda could
skip entries it had already seen, though I'm not sure it's the right thing to do
for all summary types.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] Bug with time summary in column view?

2009-11-24 Thread James TD Smith
Hi Norbert,

On 2009-11-24 16:56:27(-0400), Norbert Zeh wrote:
 I just tried the latest org-mode version 6.33f, and I've run into the
 following problem that is not there with version 6.32b but which I can
 also reproduce with version 6.33c (sorry didn't try any other versions).

I've just tried this with the latest org-mode from git and it seems to be
working fine. There have been no changes to column view since 6.33f was tagged.

 In my agenda, I assign an Effort property to each TODO item.  In column
 view, I have set up a summary for this column with
 
 #+COLUMNS: Effort(Estimate){:}

Each column definition should start with a '%'. Try 

#+COLUMNS: %TODO %Effort(Estimate){:}

 Using version 6.32b, the effort estimate is shown for each day in column
 view.  Using the 6.33 versions I tried, no such summary is shown.  Is
 this a bug or a feature?

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


___
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: Bug with time summary in column view?

2009-11-24 Thread James TD Smith
Hi Matt and Norbert,

On 2009-11-24 19:00:18(-0500), Matt Lundin wrote:
 James TD Smith ahktenz...@mohorovi.cc writes:
  On 2009-11-24 16:56:27(-0400), Norbert Zeh wrote:
  I just tried the latest org-mode version 6.33f, and I've run into the
  following problem that is not there with version 6.32b but which I can
  also reproduce with version 6.33c (sorry didn't try any other versions).
 
  I've just tried this with the latest org-mode from git and it seems to
  be working fine. There have been no changes to column view since 6.33f
  was tagged.
 
 I'm experiencing the same problem the OP reports (i.e., no effort or
 clocksum summaries) when viewing columns in the agenda. I reported this
 in an earlier email:
 
 http://article.gmane.org/gmane.emacs.orgmode/19937

Ah, I missed that. Sorry.

I've looked into this further and found what I think was causing it. The code
which calculates the summaries in the agenda was mixing up properties and
titles, and failing to find the data it was supposed to be summarising. It
worked if there was no title set on the column being summarised, which is why
the test I did earlier seemed OK.

It should be fixed now, there's a patch (b0eaeaa) for this in the bugfixes 
branch at
git://yog-sothoth.mohorovi.cc/org-mode.

Can one of you give it a try and confirm it fixes your problem? 

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|




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


Re: [Orgmode] Org-mode version 6.32trans (release_6.32b.127.g471c2); Tasks with blank effort show up as 0:00

2009-11-11 Thread James TD Smith
Hi Carsten, Bernt,

On 2009-11-11 13:24:42(+0100), Carsten Dominik wrote:
 Thanks,
 
 I have pulled this in, let assume it is the right fix.
 
 Thanks Bernt.

Yes, the other patch is not needed.

I've found another problem with column view in the agenda though;
org-agenda-colview-summarize doesn't work properly with the new summary
operators. I'm working on a patch.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|




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


[Orgmode] [PATCH 2/2] Make org-agenda-columns-summarize work properly with the new summary types.

2009-11-11 Thread James TD Smith
It was assuming the values should be summarised by adding them together. It's
now updated to use the summary functions in org-columns-compile-map, and also
handles summary types with calculated values properly.
---
 lisp/org-colview.el |   62 +++---
 1 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index d0784f5..0fc843f 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1044,9 +1044,16 @@ Don't set this, this is meant for dynamic scoping.)
   (if s
   (cond
((memq fmt '(min_age max_age mean_age))
-   (if (string= s )
-   org-columns-time
- (time-to-number-of-days (apply 'encode-time (org-parse-time-string s 
t)
+   (cond ((string= s ) org-columns-time)
+ ((string-match
+   \\([0-9]+\\)d \\([0-9]+\\)h \\([0-9]+\\)m \\([0-9]+\\)s
+   s)
+  (+ (* 60 (+ (* 60 (+ (* 24 (string-to-number (match-string 1 s)))
+   (string-to-number (match-string 2 s
+  (string-to-number (match-string 3 s
+ (string-to-number (match-string 4 s
+ (t (time-to-number-of-days (apply 'encode-time
+   (org-parse-time-string s t))
((string-match : s)
(let ((l (nreverse (org-split-string s :))) (sum 0.0))
  (while l
@@ -1363,10 +1370,11 @@ and tailing newline characters.
   Summarize the summarizable columns in column view in the agenda.
 This will add overlays to the date lines, to show the summary for each day.
   (let* ((fmt (mapcar (lambda (x)
-   (list (car x) (if (equal (car x) CLOCKSUM)
- 'add_times (nth 4 x
+   (if (equal (car x) CLOCKSUM)
+   (list CLOCKSUM (nth 2 x) add_times + identity)
+ (cdr x)))
  org-columns-current-fmt-compiled))
-line c c1 stype props lsum entries prop v)
+line c c1 stype calc sumfunc props lsum entries prop v)
 (catch 'exit
   (when (delq nil (mapcar 'cadr fmt))
;; OK, at least one summation column, it makes sense to try this
@@ -1389,24 +1397,40 @@ This will add overlays to the date lines, to show the 
summary for each day.
  (setq props
(mapcar
 (lambda (f)
-  (setq prop (car f) stype (nth 1 f))
+  (setq prop (car f)
+stype (nth 3 f)
+sumfunc (nth 5 f)
+calc (or (nth 6 f) 'identity))
   (cond
((equal prop ITEM)
 (cons prop (buffer-substring (point-at-bol)
  (point-at-eol
((not stype) (cons prop ))
-   (t
-;; do the summary
-(setq lsum 0)
-(mapc (lambda (x)
-(setq v (cdr (assoc prop x)))
-(if v (setq lsum (+ lsum
-
(org-columns-string-to-number
- v stype)
-  entries)
-(setq lsum (org-columns-number-to-string lsum stype))
-(put-text-property
- 0 (length lsum) 'face 'bold lsum)
+   (t ;; do the summary
+(setq lsum nil)
+(dolist (x entries)
+  (setq v (cdr (assoc prop x)))
+  (if v
+  (push
+   (funcall
+(if (not (get-text-property 0 'org-computed v))
+calc
+  'identity)
+(org-columns-string-to-number
+ v stype))
+   lsum)))
+(setq lsum (remove nil lsum))
+(setq lsum
+  (cond (( (length lsum) 1)
+ (org-columns-number-to-string
+  (apply sumfunc lsum) stype))
+((eq (length lsum) 1)
+ (org-columns-number-to-string
+  (car lsum) stype))
+(t )))
+(put-text-property 0 (length lsum) 'face 'bold lsum)
+(if (neq calc 'identity)
+(put-text-property 0 (length lsum) 'org-computed t 

[Orgmode] [PATCH 1/2] Fix a bug in org-link-display-format.

2009-11-11 Thread James TD Smith
It would break if there was a '\' in the link description.
---
 lisp/ChangeLog |4 
 lisp/org.el|9 +
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 112e0bc..0ce2d50 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -72,6 +72,10 @@
* org-docbook.el (org-export-as-docbook): Protect targets in
verbatim emphasis.
 
+2009-11-07  James TD Smith  ahktenz...@mohorovi.cc
+
+   * org.el (org-link-display-format): Should be literal replacement.
+
 2009-11-06  Carsten Dominik  carsten.domi...@gmail.com
 
* org-clock.el (org-show-notification): Handle messages that
diff --git a/lisp/org.el b/lisp/org.el
index c0afd10..ed32b94 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17575,10 +17575,11 @@ Show the heading too, if it is currently invisible.
 if no description is present
   (save-match-data
 (if (string-match org-bracket-link-analytic-regexp link)
-   (replace-match (or (match-string 5 link)
-  (concat (match-string 1 link)
-  (match-string 3 link)))
-  nil nil link)
+   (replace-match (if (match-end 5)
+  (match-string 5 link)
+(concat (match-string 1 link)
+(match-string 3 link)))
+  nil t link)
   link)))
 
 ;; Speedbar support
-- 
1.6.5



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


[Orgmode] Re: [PATCH 2/2] Make org-agenda-columns-summarize work properly with the new summary types.

2009-11-11 Thread James TD Smith
Both patches are in the bugfixes branch on my repo.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] Org-mode version 6.32trans (release_6.32b.127.g471c2); Tasks with blank effort show up as 0:00

2009-11-10 Thread James TD Smith
Hi Bernt,

On 2009-11-10 07:09:28(-0500), Bernt Hansen wrote:
 James TD Smith ahktenz...@mohorovi.cc writes:
  On 2009-11-09 10:52:55(-0500), Bernt Hansen wrote:
  As part of my weekly review I look for NEXT tasks with no effort
  defined.  A recent change to org-mode now displays entries with no
  Effort property as 0:00 in column view -- these used to be blank.
  This is less convenient for me since it's easy to miss tasks with no
  effort defined when they don't stand out in the list.
 
  Can you try applying d8865d62646977a2fb15917d63eee680e3ad12e3 in the 
  bugfixes
  branch at yog-sothoth.mohorovi.cc? That should fix it. 
 
 I tried this patch by cherry picking it on top of 
 e8fbed7 (Better error message when creating block diary entry but no mark 
 exists, 2009-11-10)
 but it doesn't seem to help.
 
 I created a remember task with no PROPERTY..END drawer and column view
 shows the estimated column as 0:00 instead of blank.

Ah, I missed the add_times summary off my columns deinfition when I was trying
to fix this yesterday. Try commit ca60156d. 

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|




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


Re: [Orgmode] Org-mode version 6.32trans (release_6.32b.127.g471c2); Tasks with blank effort show up as 0:00

2009-11-09 Thread James TD Smith
Hi Bernt,

On 2009-11-09 10:52:55(-0500), Bernt Hansen wrote:
 As part of my weekly review I look for NEXT tasks with no effort
 defined.  A recent change to org-mode now displays entries with no
 Effort property as 0:00 in column view -- these used to be blank.
 This is less convenient for me since it's easy to miss tasks with no
 effort defined when they don't stand out in the list.
 
 It's really easy to scan the list of NEXT tasks in column view and see
 where there is a blank entry for estimate.  It's not so obvious when
 the effort value is 0:00 and it's buried in the middle of other tasks
 with effort values.  Scanning for blank effort NEXT tasks used to take
 about 10 seconds but now I have to carefully scrutinize the list to
 make sure I didn't miss any.

Can you try applying d8865d62646977a2fb15917d63eee680e3ad12e3 in the bugfixes
branch at yog-sothoth.mohorovi.cc? That should fix it. 

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.

2009-11-01 Thread James TD Smith
Hi Carsten and Mikael,

On 2009-11-01 18:24:41(+0100), Carsten Dominik wrote:
 Hi Mikael, thanks for doing the testing!

Yes, thanks a lot.

 James, do you want to integrate Mikaels changes? If yes, can you please do so
 and let me know when and from where I can pull?

I've already applied the patch and pushed it to misc-new-features in my repo.

 Also, if one of you would like to go through the trouble to adapt the XEmacs
 version, that would be very nice.

I'll have a go at it. I had forgotten there was another version of colview; if I
had known I would made the changes there. I'll let you know when it's done.

 P.S. What needs to be added to the manual?

I have added the new summary types to the column attributes section. I have also
menetioned the limitation that you can only have one summary type for any
property in the column view..

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|
 


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


Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.

2009-10-29 Thread James TD Smith
Hi Mikael,

On 2009-10-29 14:17:11(+0100), Mikael Fornius wrote:
 Maybe someone other than me should test this because I am not sure if I
 understand it correctly? 
 
 The only reference to age or creation time I can find is in the
 documentation string of org-sort-entries-or-items.
 
 ... creation time, which is assumed to be the first inactive time stamp
 at the beginning of a line.
 
Sorry, I could have been more specific in my description of what the patch does.
What it does is add three operators which can be applied to properties
containing timestamps, which show the length of time between the timestamp and
the current time for leaf entries, and either the minimum, maximum or average
elapsed time for entries with children.

The age/creation time thing is just a suggested usage. All my remember templates
add a CREATED property containing a timestamp, so by adding %creat...@min} to
the columns for a tree I can get a display of the time which has elapsed since
that item was added.

 I pulled from your git://yog-sothoth.mohorovi.cc/org-mode.git
 misc-new-features branch and have tried a basic setup with timestamps as
 described with no success. I must have missed something.
 
 When I use org-columns-new (M-S-right/left) to add a column there is no
 choice named age or creation time, should I use TIMESTAMP_IA?
 
 When I do I have three (new?) options age, age, age as summary options
 and I think it should be min_age, mean_age, max_age instead?

I didn't test org-columns-new much; I tend to set up columns manually using the
COLUMNS property. I'll have to take a look at that.
 
 When I manually tried to summarize a %timestamp_...@mean} I got just
 numbers when I expected a date.

You shouldn't see a date. You should see something like '22d 3h 4m 11s' giving
the time since the first inactive timestamp in each item, and if an item has
children the average of the values from the childen. 

If you have a file like:
--8---cut here---start-8---
#+COLUMNS: %20ITEM %16timestamp_...@min}
* Test 1
  [2008-10-29 Thu 21:05]
* Test 2
  [2009-10-29 Thu 21:05]
* Test 3
** Test 4
   [2009-10-29 Thu 20:05]
** Test 5
   [2009-11-29 Thu 21:05]
--8---cut here---end---8---

You should see something like this (from the column view dblock):

--8---cut here---start-8---
| ITEM  | TIMESTAMP_IA |
|---+--|
| * Test 1  | 365d 00h 04m 01s |
|---+--|
| * Test 2  | 0d 00h 04m 01s   |
|---+--|
| * Test 3  | -31d 00h 04m 01s |
| ** Test 4 | 0d 01h 04m 01s   |
| ** Test 5 | -31d 00h 04m 01s |
--8---cut here---end---8---

 I also have another problem with org-columns-new that when selecting a
 summary type the #+COLUMNS row is not updated, format specification
 works. I do not know if this is introduced by this patch or some other
 but it used to work...

It's probably the patch.

Thanks for testing this, and also for the improvements you made to column view
which made this possible.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|



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


Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.

2009-10-29 Thread James TD Smith
Hi Mikael,

On 2009-10-29 21:10:50(+0100), Mikael Fornius wrote:
 Mikael Fornius m...@abc.se writes:
 
  Maybe someone other than me should test this because I am not sure if I
  understand it correctly? 
 
  The only reference to age or creation time I can find is in the
  documentation string of org-sort-entries-or-items.
 
 Now I found a reference in ChangeLog, SINCE it should be called, great,
 I will give it another try later on.

The SINCE property was from my previous attempt at doing this. It doesn't exist
in the new patch. 

I've fixed the problems with org-column-new you were having and pushed it to my
repo, and fixed another bug which stopped the new operators working in column
view in the agenda. 

Let me know if you have any more problems with the patch.. 

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|




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


Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.

2009-10-28 Thread James TD Smith
Hi Carsten,

On 2009-10-28 18:01:44(+0100), Carsten Dominik wrote:
 this is a reasonably complex patch - could we get some volunteers
 putting this to the test?

If anyone wants to test this, please pull from my git repo; there's a couple of
missing brackets in this patch. 

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] Setting org-remember-store-without-prompt specifically for certain templates?

2009-10-25 Thread James TD Smith
Hi Ryan and Carsten,

On 2009-10-25 11:50:05(+0100), Carsten Dominik wrote:
 On Oct 25, 2009, at 11:31 AM, Ryan C. Thompson wrote:
  My original idea for a per-template solution was to create a  
  function to set buffer-local values of the appropriate variables in  
  the rememebr buffer, and have that function return an empty string,  
  and then put it inside a %(sexp) in the template itself. Should this  
  work? Would buffer-local values take precedence when I press C-c C-c  
  after finishing my note?
 
  My first few attempts were unsuccessful, but I'm not sure I got the  
  code right. I suppose I should try manually setting buffer-local  
  values and observing the effects.
 
 Well, yes you should try, it might work, something like this:
 
 %(progn (org-set-local 'org-remember-store-without-prompt nil) )

That isn't going to work. When org-remember-mode is turned on in the
org-remember-apply-template , all local variables get cleared (there's a
kill-all-local-variables in remember-mode), and embedded elisp is processed
before this.

Try adding this to your emacs:

--8---cut here---start-8---
(defun org-no-store-without-prompt ()
  (org-set-local 'org-remember-store-without-prompt nil)
  (remove-hook 'post-command-hook 'org-no-store-without-prompt))
--8---cut here---end---8---

And putting

%(progn (add-hook 'post-command-hook 'org-no-store-without-prompt) )

in your template.

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


[Orgmode] [PATCH] Add min/max/mean age operators to column view.

2009-10-25 Thread James TD Smith
I posted a patch to the list in July which added two new special properties
intended for displaying the age of an entry in column view. After some
discussion with Bastien (who was maintainer at the time) we decided I would
reimplement this functionality using column summary operators. It took me a
while bit I've finally got a working version.

The patch is also available in the misc-new-features branch at
git://yog-sothoth.mohorovi.cc/org-mode.git.

---
 lisp/ChangeLog  |   38 +++---
 lisp/org-colview.el |  198 ---
 lisp/org.el |4 +-
 3 files changed, 156 insertions(+), 84 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1b5848e..5677058 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,27 @@
+2009-10-25  James TD Smith  ahktenz...@mohorovi.cc
+
+   * org-colview.el (org-format-time-period): Function to format
+   times in fractional days for display.
+   (org-columns-display-here): Add support for showing a calculated
+   value in place of the property.
+   (org-columns): Set `org-columns-time' to the current time so time
+   difference calculations will work.
+   (org-columns-time): Use to store the current time when column view
+   is displayed, so all time differences will use the same reference
+   point.
+   (org-columns-compile-map): There is now an extra position in each
+   entry specifying the function to use to calculate the displayed
+   value for the non-calculated properties in the column,
+   (org-columns-compute-all): Set `org-columns-time' to the current
+   time so time difference calculations will work.
+   (org-columns-compute): Handle column operators where the values
+   used are calculated from the underlying property.
+   (org-columns-number-to-string): Handle the 'age' column format
+   (org-columns-string-to-number): Correct the function name (was
+   org-column...). Add support for the 'age' column format.
+   (org-columns-compile-format): Support the additional parameter in
+   org-columns-compile-map.
+
 2009-10-25  Carsten Dominik  carsten.domi...@gmail.com

* org-clock.el (org-clock-has-been-used): New variable.
@@ -1543,20 +1567,14 @@
* org-exp.el (org-export-format-source-code-or-example): Fix
bad line numbering when exporting examples in HTML.

-2009-07-12  James TD Smith  ahktenz...@mohorovi.cc
-
* org-colview.el (org-format-time-period): Formats a time in
fractional days as days, hours, mins, seconds.
(org-columns-display-here): Add special handling for SINCE and
SINCE_IA to format for display.

-   * org.el (org-time-since): Add a function to get the time since an
-   org timestamp.
-   (org-entry-properties): Add two new special properties: SINCE and
-   SINCE_IA. These give the time since any active or inactive
-   timestamp in an entry.
-   (org-special-properties): Add SINCE, SINCE_IA.
-   (org-tags-sort-function): Add custom declaration for tags
+2009-07-12  James TD Smith  ahktenz...@mohorovi.cc
+
+   * org.el (org-tags-sort-function): Add custom declaration for tags
sorting function.
(org-set-tags): Sort tags if org-tags-sort-function is set

@@ -4423,7 +4441,7 @@
(org-agenda-change-all-lines, org-tags-sparse-tree)
(org-time-string-to-absolute, org-small-year-to-year)
(org-link-escape): Re-apply changes accidentially overwritten
-   by last commit to Emacs.
+   by last commit to Emacs

 2008-11-23  Carsten Dominik  carsten.domi...@gmail.com

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 374d22a..87c1412 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -111,8 +111,8 @@ This is the compiled version of the format.)
 (org-defkey org-columns-map [(shift meta left)] 'org-columns-delete)
 (dotimes (i 10)
   (org-defkey org-columns-map (number-to-string i)
-  `(lambda () (interactive)
- (org-columns-next-allowed-value nil ,i
+ `(lambda () (interactive)
+(org-columns-next-allowed-value nil ,i

 (easy-menu-define org-columns-menu org-columns-map Org Column Menu
   '(Column
@@ -165,7 +165,7 @@ This is the compiled version of the format.)
 (face1 (list color 'org-agenda-column-dateline ref-face))
 (pl (or (get-text-property (point-at-bol) 'prefix-length) 0))
 (cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp))
-pom property ass width f string ov column val modval s2 title)
+pom property ass width f string ov column val modval s2 title calc)
 ;; Check if the entry is in another buffer.
 (unless props
   (if (eq major-mode 'org-agenda-mode)
@@ -189,19 +189,25 @@ This is the compiled version of the format.)
  (nth 2 column)
  (length property))
f (format

Re: [Orgmode] directory tree size browsing with column view

2009-10-24 Thread James TD Smith
Hi Michael,

On 2009-10-24 15:45:32(+0200), Michael Brand wrote:
 Hi all,
 
 I would like to use the column view for browsing a hierarchical tree with a
 summed up property like e. g. the directory sizes (inclusive cluster waste and
 subdirectories from `du -sk`) of a directory tree. Just similar (only
 unsorted) to the upper left pane of this GUI screenshot of WinDirStat here
 http://windirstat.info/images/windirstat.jpg
 
 Let me make an example how I think to do the same with column view when given
 a directory with the two shell outputs
 
 
 $ ls -lR dir_node
 total 16
 drwxr-xr-x  2 usr  grp  136 Oct 24 12:00 a
 drwxr-xr-x  2 usr  grp  102 Oct 24 12:00 b
 -rw-r--r--  1 usr  grp 9070 Oct 24 13:00 t.txt
 
 dir_node/a:
 total 2400
 -rw-r--r--  1 usr  grp 4535 Oct 24 12:00 x.txt
 -rw-r--r--  1 usr  grp  1217312 Oct 24 12:00 y.txt
 
 dir_node/b:
 total 16
 -rw-r--r--  1 usr  grp 4535 Oct 24 12:00 z.txt
 
 
 
 $ find dir_node -type d -exec du -sk {} \;
 1220  dir_node
 1200  dir_node/a
 8 dir_node/b
 
 
 For this I would like to have `some software' which uses the path to this
 directory `dir_node' as input and produces the following output file
 
 
 -*- mode: org; eval: (org-columns) -*-
 #+STARTUP: odd hidestars
 #+PROPERTY: size
 #+COLUMNS: %20ITEM %size{+}
 
 * dir_node
 *** a
 :PROPERTIES:
 :size: 1200
 :END:
 -rw-r--r--  1 usr  grp 4535 Oct 24 12:00 x.txt
 -rw-r--r--  1 usr  grp  1217312 Oct 24 12:00 y.txt
 *** b
 :PROPERTIES:
 :size: 8
 :END:
 -rw-r--r--  1 usr  grp 4535 Oct 24 12:00 z.txt
 *** .
 :PROPERTIES:
 :size: 12
 :END:
 -rw-r--r--  1 usr  grp 9070 Oct 24 13:00 t.txt
 
 
 Opening this file in org-mode using column view now is comfortable to browse
 and can look e. g. like here
 
 
 ITEM | size |
 * dir_node   | 1220 |
 *** a| 1200 |
 :PROPERTIES:...
 -rw-r--r--  1 usr  grp 4535 Oct 24 12:00 x.txt
 -rw-r--r--  1 usr  grp  1217312 Oct 24 12:00 y.txt
 *** b| 8|...
 *** .| 12   |...
 
 
 where all not of interest can be left hidden and one can see easily that
   - the directory `a' is by far the largest
   - most of the disk usage is caused only by the file dir_node/a/y.txt.
   - etc
 
 I would be able to implement this `some software' in a shell script (if I
 would take the necessary time some day) but not within Emacs itself which
 would be easier to use and IMHO would not be concerned that much with
 portability issues.
 
 What do you think?

Have you looked at org-fstree? http://repo.or.cz/w/org-fstree.git

It generates an org tree for the contents of a directory. It doesn't have an
option to include the size or other file attributes as properties as the moment,
but I don't think this would be hard to add. Andreas and I have been working on
it quite a lot over the last week, I'll see if I can add an option which would
do what you want.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] Remember put new item in the top of the list

2009-10-24 Thread James TD Smith
Hi Carsten,

On 2009-10-24 14:24:18(+0200), Carsten Dominik wrote:
 I am working on a rewrite for much of the remember functionality, and  
 this will be one of the options.

I don't know how far you've got with your work on org-remember, but if you'd
like to look at my rewrite, a cleaned-up and mostly working version is
in the remember-lite branch in my org-mode repo. 

I've got it into a state where I can actually use it over the last couple of
weeks, but there are still quite a few bugs in it and some of the new features
don't quite work properly.

I am continuing to work on it, fixing bugs as I find them. I'll try and write up
a summary of the changes I've made (and which ones are working properly) and
post it to the list later so you can decide what you want to do with the code.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|



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


Re: [Orgmode] directory tree size browsing with column view

2009-10-24 Thread James TD Smith
Hi Michael,

On 2009-10-24 16:51:17(+0100), James TD Smith wrote:
 On 2009-10-24 15:45:32(+0200), Michael Brand wrote:
  I would like to use the column view for browsing a hierarchical tree with a
  summed up property like e. g. the directory sizes (inclusive cluster waste 
  and
  subdirectories from `du -sk`) of a directory tree. Just similar (only
  unsorted) to the upper left pane of this GUI screenshot of WinDirStat here
  http://windirstat.info/images/windirstat.jpg

[snip]

  What do you think?
 
 Have you looked at org-fstree? http://repo.or.cz/w/org-fstree.git
 
 It generates an org tree for the contents of a directory. It doesn't have an
 option to include the size or other file attributes as properties as the 
 moment,
 but I don't think this would be hard to add. Andreas and I have been working 
 on
 it quite a lot over the last week, I'll see if I can add an option which would
 do what you want.

OK, I have added support for including file attributes as properties to
org-fstree. You will need to use the merge_jtd_smiths_patch branch.

Once you have loaded org-fstree put the following in an orgfile and fill in the
directory name.

--8---cut here---start-8---
* Disk usage
  :PROPERTIES:
  :COLUMNS: %80ITEM %size{+}
  :END:
#+BEGIN: fstree :dir dir name :file-attributes (size)
#+END:
--8---cut here---end---8---

Hit C-c C-c on the #+BEGIN line to fill in the file details. 

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] [PATCH 0/2] Soem more minor patches

2009-10-22 Thread James TD Smith
Hi Carsten,

On 2009-10-22 07:38:04(+0200), Carsten Dominik wrote:

 On Oct 21, 2009, at 11:52 AM, James TD Smith wrote:

  I found the changes John Wiegley made to org-repeat-re stopped it from
  matching repeaters with just a '+' at the start. I have fixed this.

 Hi James, can you please provide an example for this bug?

I've had another look at this and it looks like it's already been fixed. The
version of org-repeat-re in b40c4e did fail to match repeated timestamps like
2009-10-22 Thu +4d but would not match 2009-10-22 Thu .+4d or
2009-10-22 Thu ++4d, so org-log-repeat would return nil and repeated tasks
stop repeating.

The org-repeat-re in f93ace works fine.

 
  Also, I've added a way for the clock resolution code to use system
  idle time
  under X11, using a small C program which uses the xscreensaver
  extension.
 
  James TD Smith (2):
   Add an X11 equivalent to org-mac-idle-seconds.
   org-repeat-re was no longer matching simple +2d type repeaters. Fix.
 
  .gitignore  |1 +
  ChangeLog   |6 +-
  UTILITIES/x11idle.c |   21 +
  lisp/ChangeLog  |   11 ++-
  lisp/org-clock.el   |   10 --
  lisp/org.el |2 +-
  6 files changed, 46 insertions(+), 5 deletions(-)
  create mode 100644 UTILITIES/x11idle.c

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


[Orgmode] [PATCH 1/2] Add an X11 equivalent to org-mac-idle-seconds.

2009-10-21 Thread James TD Smith
This needs a small C program (in UTILITIES/x11idle.c) to work.
---
 .gitignore  |1 +
 ChangeLog   |6 +-
 UTILITIES/x11idle.c |   21 +
 lisp/ChangeLog  |8 +++-
 lisp/org-clock.el   |   10 --
 5 files changed, 42 insertions(+), 4 deletions(-)
 create mode 100644 UTILITIES/x11idle.c

diff --git a/.gitignore b/.gitignore
index ab68b2a..c21fc91 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,3 +58,4 @@ TODO
 # fill-column: 72
 # mode: conf
 # End:
+/UTILITIES/x11idle
diff --git a/ChangeLog b/ChangeLog
index 95387ea..77cca37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-21  James TD Smith  ahktenz...@mohorovi.cc
+
+   * UTILITIES/x11idle.c: Add a small C program which outputs the X11
+   idle time
+
 2009-09-16  Carsten Dominik  carsten.domi...@gmail.com
 
* Makefile: Add dependencies for org-crypt.el.
@@ -65,4 +70,3 @@
 2008-04-25  Carsten Dominik  domi...@science.uva.nl
 
* Makefile (BATCH): Fix the path to the local lisp files.
-
diff --git a/UTILITIES/x11idle.c b/UTILITIES/x11idle.c
new file mode 100644
index 000..33d0035
--- /dev/null
+++ b/UTILITIES/x11idle.c
@@ -0,0 +1,21 @@
+#include X11/extensions/scrnsaver.h
+#include stdio.h
+
+/* Based on code from
+ * http://coderrr.wordpress.com/2008/04/20/getting-idle-time-in-unix/
+ *
+ * compile with 'gcc -l Xss x11idle.c -o x11idle' and copy x11idle into your
+ * path
+ */
+main() {
+XScreenSaverInfo *info = XScreenSaverAllocInfo();
+Display *display = XOpenDisplay(0);
+
+//check that X11 is running or else you get a segafult/coredump
+if (display != NULL) {
+   XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
+}
+XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
+printf(%u\n, info-idle);
+return 0;
+}
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bcd6a8a..75bdc38 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -37,6 +37,12 @@
modeline when habits are being displayed (if that module is being
loaded).
 
+2009-10-21  James TD Smith  ahktenz...@mohorovi.cc
+
+   * org-clock.el (org-x11-idle-seconds): Add a method to get the X11
+   idle time using the xscreensaver extension.
+   (org-user-idle-seconds): Use X11 idle time if available.
+
 2009-10-20  Carsten Dominik  carsten.domi...@gmail.com
 
* org-agenda.el (org-agenda-next-line): New command.
@@ -161,7 +167,7 @@
currently active clock if the user has exceeded the time returned
by `org-user-idle-seconds', based on the value of
`org-clock-idle-time'.
-   (org-clock-in): If, after resolving clocks, 
+   (org-clock-in): If, after resolving clocks,
(org-clock-out): Cancel the `org-clock-idle-timer' on clock out.
 
* org-clock.el (org-clock-resolve-clock): New function that
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index c7ebbf8..fddf3f8 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -762,16 +762,22 @@ non-dangling (i.e., currently open and valid) clocks.
   Return the current Mac idle time in seconds
   (string-to-number (shell-command-to-string ioreg -c IOHIDSystem | perl -ane 
'if (/Idle/) {$idle=(pop @F)/10; print $idle; last}')))
 
+(defun org-x11-idle-seconds ()
+  Return the current X11 idle time in seconds
+  (/ (string-to-number (shell-command-to-string x11idle)) 1000))
+
 (defun org-user-idle-seconds ()
   Return the number of seconds the user has been idle for.
 This routine returns a floating point number.
-  (if (eq system-type 'darwin)
+  (if (or (eq system-type 'darwin) (eq window-system 'x))
   (let ((emacs-idle (org-emacs-idle-seconds)))
;; If Emacs has been idle for longer than the user's
;; `org-clock-idle-time' value, check whether the whole system has
;; really been idle for that long.
(if ( emacs-idle (* 60 org-clock-idle-time))
-   (min emacs-idle (org-mac-idle-seconds))
+   (min emacs-idle (if (eq system-type 'darwin)
+   (org-mac-idle-seconds)
+ (org-x11-idle-seconds)))
  emacs-idle))
 (org-emacs-idle-seconds)))
 
-- 
1.6.3.3



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


[Orgmode] [PATCH 2/2] org-repeat-re was no longer matching simple +2d type repeaters. Fix.

2009-10-21 Thread James TD Smith
---
 lisp/ChangeLog |3 +++
 lisp/org.el|2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 75bdc38..9bd532d 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -39,6 +39,9 @@
 
 2009-10-21  James TD Smith  ahktenz...@mohorovi.cc
 
+   * org.el (org-repeat-re): The changed org-repeat-re no longer
+   matched simple +2d type repeaters. Fix it so it does.
+
* org-clock.el (org-x11-idle-seconds): Add a method to get the X11
idle time using the xscreensaver extension.
(org-user-idle-seconds): Use X11 idle time if available.
diff --git a/lisp/org.el b/lisp/org.el
index cdb8d25..d5a30ac 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -475,7 +475,7 @@ An entry can be toggled between QUOTE and normal with
   :type 'string)
 
 (defconst org-repeat-re
-  [0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] 
[^\n]*?\\([.+]?\\+[0-9]+[dwmy]\\(/[0-9]+[dwmy]\\)?\\)
+  [0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] 
[^+.\n]*\\([.+]?\\+[0-9]+[dwmy]\\(/[0-9]+[dwmy]\\)?\\)
   Regular expression for specifying repeated events.
 After a match, group 1 contains the repeat expression.)
 
-- 
1.6.3.3



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


Re: [Orgmode] use todo-keyword to assign category

2009-10-19 Thread James TD Smith
On 2009-10-20 01:55:38(+0200), Eraldo Helal wrote:
 Great James!

 Thank you very much for this function!
 That will update the prop if I change the headline wording, right?

No, it only updates the property when the todo keyword is set to CATEGORY. If
you want to change the category you would need to either change the property
directly (with C-c C-x p CATEGORY RET) or set the todo keyword to CATEGORY
again after editing the headline.

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


[Orgmode] [PATCH 2/3] Add a way to display names for tag groups in fast tag selection.

2009-10-19 Thread James TD Smith
If the nil term in the start or end group cells are replaced by strings, these
are displayed before or after the brackets for the group.
---
 lisp/ChangeLog |6 ++
 lisp/org.el|   12 ++--
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 47b44cd..83af7a4 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -29,6 +29,12 @@
(org-mobile-create-index-file): Sort the files to be listed in
index.org.
 
+2009-10-17  James TD Smith  ahktenz...@mohorovi.cc
+
+   * org.el (org-fast-tag-selection): Add a way to display a
+   description for a tag group. This is done by adding a string to
+   either the startgroup or endgroup cell.
+
 2009-10-17  Carsten Dominik  carsten.domi...@gmail.com
 
* org-clock.el (org-clock-resolve, org-resolve-clocks)
diff --git a/lisp/org.el b/lisp/org.el
index a394443..3f8bbee 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11542,15 +11542,15 @@ Returns the new tags string, or nil to not change the 
current settings.
   (setq tbl fulltable char ?a cnt 0)
   (while (setq e (pop tbl))
(cond
-((equal e '(:startgroup))
+((equal (car e) :startgroup)
  (push '() groups) (setq ingroup t)
  (when (not (= cnt 0))
(setq cnt 0)
(insert \n))
- (insert { ))
-((equal e '(:endgroup))
+ (insert (if (cdr e) (format %s:  (cdr e)) ) { ))
+((equal (car e) :endgroup)
  (setq ingroup nil cnt 0)
- (insert }\n))
+ (insert } (if (cdr e) (format  (%s)  (cdr e)) ) \n))
 ((equal e '(:newline))
  (when (not (= cnt 0))
(setq cnt 0)
@@ -11595,8 +11595,8 @@ Returns the new tags string, or nil to not change the 
current settings.
   (setq rtn
(catch 'exit
  (while t
-   (message [a-z..]:Toggle [SPC]:clear [RET]:accept 
[TAB]:free%s%s
-(if groups  [!] no groups  [!]groups)
+   (message [a-z..]:Toggle [SPC]:clear [RET]:accept [TAB]:free 
[!] %sgroups%s
+(if (not groups) no  )
 (if expert  [C-c]:window (if exit-after-next  
[C-c]:single  [C-c]:multi)))
(setq c (let ((inhibit-quit t)) (read-char-exclusive)))
(cond
-- 
1.6.3.3



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


[Orgmode] [PATCH 3/3] Some small fixes in org-registry.

2009-10-19 Thread James TD Smith
org-registry-assoc-all removed matching links from the registry. This meant
subsequent calls with the same parameters would return nothing.

Add another function for finding entries in the register, which used find-if to
get entries satisfying a predicate.
---
 contrib/ChangeLog|9 +++--
 contrib/lisp/org-registry.el |   40 
 2 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index e30c28f..8524c9f 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,10 @@
+2009-10-19  James TD Smith  ahktenz...@mohorovi.cc
+
+   * lisp/org-registry.el (org-registry-assoc-all): Stop this from
+   deleting the links it finds from the registry.
+   (org-registry-find-all): Add a new function which returns all
+   registry entries which satisfy a test function.
+
 2009-10-02  Carsten Dominik  carsten.domi...@gmail.com
 
* lisp/org-special-blocks.el (org-special-blocks-ignore-regexp):
@@ -284,5 +291,3 @@
* lisp/org-irc.el: New file.
 
* ChangeLog: New file.
-
-
diff --git a/contrib/lisp/org-registry.el b/contrib/lisp/org-registry.el
index f8d3d61..01b2fc8 100644
--- a/contrib/lisp/org-registry.el
+++ b/contrib/lisp/org-registry.el
@@ -39,25 +39,25 @@
 ;;
 ;; This is were org-registry comes in handy.
 ;;
-;; M-x org-registry-show will tell you the name of the file 
+;; M-x org-registry-show will tell you the name of the file
 ;; C-u M-x org-registry-show will directly jump to the file
 ;;
-;; In case there are several files where the link lives in: 
+;; In case there are several files where the link lives in:
 ;;
 ;; M-x org-registry-show will display them in a new window
 ;; C-u M-x org-registry-show will prompt for a file to visit
 ;;
 ;; Add this to your Org configuration:
-;; 
+;;
 ;; (require 'org-registry)
 ;; (org-registry-initialize)
 ;;
 ;; If you want to update the registry with newly inserted links in the
 ;; current buffer: M-x org-registry-update
-;; 
+;;
 ;; If you want this job to be done each time you save an Org buffer,
 ;; hook 'org-registry-update to the local 'after-save-hook in org-mode:
-;; 
+;;
 ;; (org-registry-insinuate)
 
 ;;; Code:
@@ -94,7 +94,7 @@ buffer.
 (match-string-no-properties 1 blink)))
 (desc (or (and (string-match org-bracket-link-regexp blink)
(match-string-no-properties 3 blink)) No description))
-(files (org-registry-assoc-all link)) 
+(files (org-registry-assoc-all link))
 file point selection tmphist)
 (cond ((and files visit)
   ;; result(s) to visit
@@ -103,7 +103,7 @@ buffer.
  (setq tmphist (mapcar (lambda(entry)
  (format %s (%d) [%s]
  (nth 3 entry) ; file
- (nth 2 entry) ; point 
+ (nth 2 entry) ; point
  (nth 1 entry))) files))
  (setq selection (completing-read File:  tmphist
   nil t nil 'tmphist))
@@ -123,7 +123,7 @@ buffer.
   ;; result(s) to display
   (cond  ((eq 1 (length files))
   ;; show one file
-  (message Link in file %s (%d) [%s] 
+  (message Link in file %s (%d) [%s]
(nth 3 (car files))
(nth 2 (car files))
(nth 1 (car files
@@ -132,25 +132,33 @@ buffer.
 
 (defun org-registry-display-files (files link)
   Display files in a separate window.
-  (switch-to-buffer-other-window 
+  (switch-to-buffer-other-window
(get-buffer-create  *Org registry info*))
   (erase-buffer)
   (insert (format Files pointing to %s:\n\n link))
   (let (file)
 (while (setq file (pop files))
-  (insert (format %s (%d) [%s]\n (nth 3 file) 
+  (insert (format %s (%d) [%s]\n (nth 3 file)
  (nth 2 file) (nth 1 file)
   (shrink-window-if-larger-than-buffer)
   (other-window 1))
 
 (defun org-registry-assoc-all (link optional registry)
   Return all associated entries of LINK in the registry.
-  (let ((reg (or org-registry-alist registry)) entry output)
+  (let ((reg (copy-list (or org-registry-alist registry))) entry output)
 (while (setq entry (assoc link reg))
   (add-to-list 'output entry)
   (setq reg (delete entry reg)))
 (nreverse output)))
 
+(defun org-registry-find-all (test optional registry)
+  Return all entries satisfying `test' in the registry.
+  (let ((reg (copy-list (or org-registry-alist registry))) entry output)
+(while (setq entry (find-if test reg))
+  (add-to-list 'output entry)
+  (setq reg (delete entry reg)))
+(nreverse output)))
+
 ;;;###autoload
 (defun org-registry-visit

[Orgmode] A few small patches

2009-10-19 Thread James TD Smith

A few small patches for org-mode.

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


[Orgmode] [PATCH 1/3] Add a missing entry, and fix some formatting in the changelog.

2009-10-19 Thread James TD Smith
---
 lisp/ChangeLog |   19 ---
 1 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 822bd57..47b44cd 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -983,21 +983,10 @@
* org-remember.el (org-remember-finalize): Avoid buffer-modified
messages.
 
+2009-08-06  James TD Smith  ahktenz...@mohorovi.cc
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+   * org-plot.el (org-plot/gnuplot): Stop datafile from being deleted
+   before gnuplot can read it.
 
 2009-08-05  Carsten Dominik  carsten.domi...@gmail.com
 
@@ -5455,7 +5444,7 @@
(org-clock-special-range): Also undertand yesterday, lastweek etc.
 
 2008-06-18  Glenn Morris  r...@gnu.org
-* org.el (org-map-entries): Let-bind `file'.
+   * org.el (org-map-entries): Let-bind `file'.
 
 2008-06-19  Carsten Dominik  domi...@science.uva.nl
 
-- 
1.6.3.3



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


Re: [Orgmode] use todo-keyword to assign category

2009-10-18 Thread James TD Smith
Hi Eraldo,

On 2009-10-19 02:40:19(+0200), Eraldo Helal wrote:
 I have a keyword CATEGORY which I use on headlines to make me aware
 that they define a category for everything below them.

[snip]

 Is it possible to let emacs know that every headline with the
 CATEGORY todo-keyword should be used as a category?

[snip]

 Any ideas on how to get there or feedback on the idea?

I tend to set categories on any task with lots of subtasks for the same reason.
I do this by setting the CATEGORY property on the top level task, usually by
hand as I want to keep the category names short. I think the inline #+CATEGORY
lines are deprecated in favour of using properties.

Add the following to your .emacs;

--8---cut here---start-8---
(add-hook 'org-after-todo-state-change-hook
  (lambda ()
  (if (string= state CATEGORY)
  (save-excursion
(org-back-to-heading)
  (org-set-property CATEGORY
  (nth 4 (org-heading-components)))
--8---cut here---end---8---

When you set the todo state of an entry to CATEGORY, it will copy the headline
text to the CATEGORY property.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


[Orgmode] org-protocol firefox keybinding

2009-10-17 Thread James TD Smith
I was cleaning out my Firefox tabs, using org-protocol to drop links into my org
buffers, when it occured to me that having keybindings for the store link and
remember functions would be quicker than clicking on the bookmarklets. I use a
Firefox plugin called keyconfig which lets you change the keybindings and add
new ones, so after a bit of Javascript hacking I managed to get some keybindings
working. Here's how to do it:

Install keyconfig from http://mozilla.dorando.at/keyconfig.xpi.

Open the keyconfig dialog by going to Tools and then Keyconfig.

Click the 'Add a new Key' button. Enter Org store link as the name.
Enter the following in the box with /* CODE */ in it:

--8---cut here---start-8---
var orgProtoString = 'org-protocol://store-link://'+
  encodeURIComponent(gBrowser.currentURI.spec) + '/' +
  encodeURIComponent(gBrowser.contentWindow.title) + '/' +
  encodeURIComponent(window.getSelection());

gBrowser.loadURI(orgProtoString);
--8---cut here---end---8---

Click OK. You will then need to bind a key by clicking in the box next to the
'Apply' button and pressing whatever key combination you want. Click 'Apply' to
store the keybinding.

Repeat the steps, but call the next key Org remember and use the code below:

--8---cut here---start-8---
var orgProtoString = 'org-protocol://remember://'+
  encodeURIComponent(gBrowser.currentURI.spec) + '/' +
  encodeURIComponent(gBrowser.contentWindow.title) + '/' +
  encodeURIComponent(window.getSelection());

gBrowser.loadURI(orgProtoString);
--8---cut here---end---8---

Click Close, then OK, and then restart Firefox. You should then be able to
access the org-protocol functions with your chosen keys.

I've added a section to the Worg page for org-protocol with the instructions.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


[Orgmode] org-fstree

2009-10-17 Thread James TD Smith

Hi Andy,

I finally got around to merging my changes to org-fstree into the current
version. While I was applying my changes I decided to make fstree blocks use the
general org dblocks framework, which eliminates the need for all the code to
find the boundaries of the region to put the tree in and for parsing the
options.

I did had a look at the code you wrote to integrate org-registry, but I haven't
managed to integrate it with my changes. I'll

James

--
No fortunes found
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


[Orgmode] [PATCH] Various improvements to org-fstree.

2009-10-17 Thread James TD Smith
Fstree blocks are now org dblocks, which removes the need for the code for
finding fstree blocks and parsing the options.

Make the recursive directory filtering less ugly (and faster).

Trigger the dynamic updates from properties. It still doesn't quite work right,
but it was experimental anyway.
---
 org-fstree.el |  419 -
 1 files changed, 174 insertions(+), 245 deletions(-)

diff --git a/org-fstree.el b/org-fstree.el
index a4a5847..3be7f35 100644
--- a/org-fstree.el
+++ b/org-fstree.el
@@ -1,9 +1,11 @@
 ;;; org-fstree.el --- include a filesystem subtree into an org file
 
 
-;; Copyright 2009 Andreas Burtzlaff
+;; Copyright 2009 Andreas Burtzlaff, James TD Smith
 ;;
 ;; Author: Andreas Burtzlaff  andreas at burtz[REMOVE]laff dot de 
+;;James TD Smith  ahktenzero at mohorovi dot cc 
+;;
 ;; Version: 0.4
 ;; Keywords: org-mode filesystem tree
 ;; X-URL: http://www.burtzlaff.de/org-fstree/org-fstree.el
@@ -27,282 +29,209 @@
 ;;; Commentary:
 
 ;; org-fstree inserts the filesystem subtree for a given directory.
-;; Each file/directory is formatted as a headline, provides links back 
-;; to all headlines that are associated with it (by containing links to the 
file) 
+;; Each file/directory is formatted as a headline, provides links back
+;; to all headlines that are associated with it (by containing links to the 
file)
 ;; and is assigned their tags.
 ;;
 ;; Installation:
-;;   - put this file into your load-path 
+;;   - put this file into your load-path
 ;;   - insert (require 'org-fstree) into ~/.emacs
 ;;
 ;; Usage:
-;;   - enter a line containing #+BEGIN_FSTREE: dir into an org buffer, 
-;; where dir is the directory, that is to be inserted.
+;;   - enter a line containing #+BEGIN fstree :dir dir into an org buffer,
+;; where dir is the directory that is to be inserted, and an #+END line
+;; afterwards.
 ;;   - while the cursor is in the line mentioned, press C-c C-c
 ;;
 ;; Options:
 ;;   Specify options in the form:
-;;   #+BEGIN_FSTREE: dir :optionname1 optionvalue1 :optionname2 
optionvalue2  ...
+;;   #+BEGIN fstree :dir dir [:optionname1 optionvalue1]...
 ;;   Options are:
 ;; - :non-recursive t , to suppress recursion into directories
-;; - :exclude-regexp-name list of regexp strings , exclude 
file/directory names matching either 
-;;  of the given regexp 
expressions
-;;   Examples: 
-;; :exclude-regexp-name (.*\\.pdf$ .*\\.zip$), excludes 
files/directories ending with either .pdf or .zip
-;; :exclude-regexp-name (^\\.git$) , excludes files/directories 
named .git
 ;;
-;; - :exclude-regexp-fullpath list of regexp strings, same as 
:exclude-regexp-name but matches absolute path to file/directory
+;; - :exclude-regexp-name list of regexp strings, exclude file / 
directory
+;;   names matching either of the given regexp expressions
+;;
+;;   Examples:
+;;
+;; :exclude-regexp-name (.*\\.pdf$ .*\\.zip$), excludes files /
+;; directories ending with either .pdf or .zip
+;;
+;; :exclude-regexp-name (^\\.git$), excludes files/directories named
+;; .git
+;;
+;; - :exclude-regexp-fullpath list of regexp strings, same as
+;;   :exclude-regexp-name but matches absolute path to file/directory
+;;
 ;; - :relative-links t , generates relative instead of absolute links
+;;
 ;; - :show-only-matches t , only files that are being linked to show up
+;;
 ;; - :only-directories t , only directories are listed
+;;
 ;; - :only-regular-files t , only regular files are listed
-;; - :dynamic-update t , [EXPERIMENTAL] dynamically update a subtree on 
visibility cycling.
-;; - :links-as-properties t, sets the links as properties Link1, Link2,... 
for use in column view [Does not work with dynamic-update!]
-;; - :no-annotations t, suppresses the search and display of file 
annotations
+;; - :dynamic-update t , [EXPERIMENTAL] dynamically update a subtree on
+;;   visibility cycling.
+;; - :links-as-properties t, sets the links as properties Link1, Link2,...
+;;   for use in column view [Does not work with dynamic-update!]
+;; - :no-annotations t, suppresses the search and display of file
+;;annotations
 ;;
-;; Limitations and warnings:
+;; - :links-as-properties t, sets the links as properties Link1, Link2,...
+;;   for use in column view [Does not work with dynamic-update!]
 ;;
-;;   - when triggering an update (by pressing C-c C-c while in the line 
mentioned above)
-;; the COMPLETE REGION BETWEEN #+BEGIN_FSTREE AND #+END_FSTREE IS 
REPLACED.
-;;   - speed  
-;; 
-;; Code:
-
-(provide 'org-fstree)
+;; - :no-annotations t, suppresses the search and display of file
+;;annotations
+;;
+;;   To automatically update the contents of fstree blocks set the 
FSTREE_UPDATE
+;;   property to t
+;;
+;;  Limitations and warnings

Re: [Orgmode] [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.

2009-08-28 Thread James TD Smith
Hi Manish,

On 2009-08-27 21:20:53(+0530), Manish wrote:
 On Sat, Jul 18, 2009 at 3:05 PM, Bastien wrote:
 
  This patch is just a workaround, though. I think we should have a way of
  adding more than one custom function, as Mikael Fornius suggested when
  sending his first patch.
 
  Let's see what's Carsten take on this.

 This is/was a very interesting idea. Any thoughts if this would go in? Or did
 it already go in and I missed it?

Carsten and I agreed offlist not to apply my original patch, and that I would
work on a better implementation using column summaries. I've got it mostly
working.

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist.

2009-08-03 Thread James TD Smith
Hi Carsten,

On 2009-08-03 16:47:55(+0200), Carsten Dominik wrote:
 I have applied this patch, with one modification:

 I added a 'no-erro argument to the (load a2ps-print) form,
 to make sure that people who have not installed a2ps-print.el can
 still use the other functionality in your package.  Please let me
 know if this was not the right thing to do.

Yes, that's fine.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] Re: Orgmodeorg-export-generic gives an error

2009-07-23 Thread James TD Smith
On 2009-07-23 09:11:00(+0200), Bastien wrote:
 Wes Hardaker wjhns...@hardakers.net writes:

  On Wed, 22 Jul 2009 01:59:12 +0200, Bastien 
  bastiengue...@googlemail.com said:
 
  B Those two functions come from alist.el which is included in Apel:
 
  So does that mean it's safe to leave the functions in use within
  org-export generic,

 AFAIK `set-alist' is not defined in vanilla Emacs. So no, it's not safe
 to leave this function in use in org-export-generic.el.

  or should I replace it with a locally defined
  slightly-different-named version?

 Either do that or advertize the need for the Apel package, or integrate
 what set-alist does without even creating a function.  Up to you :)

You could use the aput function instead. which does the same thing. It's in
assoc.el which is included with both GNU Emacs and XEmacs.

,- C-h f aput RET 
| aput is a compiled Lisp function in `assoc.el'.
| (aput alist-symbol key optional value)
|
| Inserts a key-value pair into an alist.
| The alist is referenced by alist-symbol. The key-value pair is made
| from key and optionally, value. Returns the altered alist or nil if
| ALIST is nil.
|
| If the key-value pair referenced by key can be found in the alist, and
| value is supplied non-nil, then the value of key will be set to value.
| If value is not supplied, or is nil, the key-value pair will not be
| modified, but will be moved to the head of the alist. If the key-value
| pair cannot be found in the alist, it will be inserted into the head
| of the alist (with value nil if value is nil or not supplied).
`

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.

2009-07-17 Thread James TD Smith
Hi Bastien

On 2009-07-17 18:55:01(+0200), Bastien wrote:
 sorry for the delay.  As I said, I will let Carsten decides about this
 patch.  While I like the idea of displaying this information in column
 view, I'm unsure whether it's relevant to add another special property.

 Two arguments: (1) this special property, contrary to other ones, is a
 _relative_ property.  The information it displays in the column view is
 not displayed in the subtree, it is dynamically computed when displaying
 the column.  So it is a special special property. (2) The 2nd argument
 is that, it would be more useful to have a custom summary-type mechanism
 rather than adding too many special properties.  Displaying SINCE could
 be done by such a mechanism.

 What do you think?

Actually, I've been thinking the same thing. When I wrote the patch adding a new
property looked like the easiest way to get what I wanted, but it's somewhat
limited. It would be useful to be able to use a property for the creation time
of an entry, rather than putting an inactive timestamp in the entry. There's
also the problem of being dependent on the order of the contents of the entry
(the TIMESTAMP and TIMESTAMP_IA special properties return the first timestamp in
the entry), so it only does the right thing if the LOGBOOK and PROPERTIES
drawers are at the top of the entry and in that order.

Having a column view operator for calculating time since would avoid this
problem and be much more flexible. I've been looking at the changes Mikael
Fornius' patch to org-columnview added, and I think I can add a new operator for
this fairly easily.

I still might want to add another special property, for the latest clocked time
for an entry. That way I can have a column for the creation time (stored in a
property) and a column for the last time I worked on the entry.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist.

2009-07-14 Thread James TD Smith
Hi Bastien,

On 2009-07-14 14:09:12(+0200), Bastien wrote:
 I will apply this one tomorrow.  Note that your changelog announces
 changes to org.texi that your patch don't contain.

I started the patch before the documentation for modules in contrib was
moved to Worg. I pushed the docs just now.

The changelog is fixed in the version in my git repo.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] [misc-new-features 3/5] Add an option to sort tags automatically.

2009-07-14 Thread James TD Smith
Hi Bastien,

On 2009-07-14 13:59:11(+0200), Bastien wrote:
 Thanks James.

 Can people try this and give some feedback if they find it useful?

Sure. I wrote it because I thought having tags in alphabetical order would look
better, but I think it also makes the tags easier to read. For example if you
have many entries with similar tags it's much easier to compare the tag lists
when they are ordered.

I'm thinking about writing a sort function which would sort by tag group as well
as the tag name. I have tag groups for things like location, activity type,
people I need to work with etc and putting those in a consistent order would
make it easier to pick out the relevant information quickly.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.

2009-07-14 Thread James TD Smith
Hi Bastien,

On 2009-07-14 13:48:09(+0200), Bastien wrote:
 Hi James,

 welcome back.  Carsten is on vacation for three weeks and I'm
 maintaining Org in the meanwhile.

Thanks. I'd forgotten Carsten was away.

 I won't take the decision of adding new special properties without
 asking him so I don't apply this patch for now.  But I will use your
 patch for a while and see if I find it useful.  If others can test it
 as well and give their feedback, even better.

I use this mostly to check the age of entries when reviewing my todo lists;
either to cull old tasks I haven't started and aren't interested in any more, 
or to
remind me that I haven't worked on a task for a while and ought to do so.

I used to use the TIMESTAMP and TIMESTAMP_IA properties for this, and the new
properties work in more or less the same way but display the results
differently.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


[Orgmode] Working on org again

2009-07-13 Thread James TD Smith
After a long absence I am returning to org development. Those of you who haven't
forgotten about my proposed rewrite of org-remember will be wondering what
happened to it. I have been working on it when I've had time, and most of the
new features are implemented but not fully tested. I plan on making a test
branch available with the parts I think are usable available in the next week or
so.

In the meantime, I have a few other patches for Org:
- Add two new properties for the age or time since last activity of an entry. 
These
  are based on the first timestamps in an entry. Age/time since are displayed in
  column view in dd hh mm ss format.
- Bugfixes and improvements for my org-checklist module.
- Automatic tag sorting.
- org-insert-link can now include links on the X clipboard or in the Emacs
  kill-ring in the available links list.
- A bugfix for org-plot when using the script: option.

These patches are available from git://yog-sothoth.mohorovi.cc/org-mode in the
misc-new-features branch.

I also have a modified version of org-fstree with a few improvements (default
excludes for .git/.svn dirs, emacs backup files etc, speed enhancement for the
'what links to this file' option and some general code cleanup), but it's based
on an old version. I was also planning on adding an option to use org-registry
to get the links to entries, which would speed things up even more. I'll post a
patch to the list when I've done that and merged my changes into the current
version.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|




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


[Orgmode] [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data fil

2009-07-13 Thread James TD Smith
---
 lisp/org-plot.el |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 0e8f5a2..c9d61b3 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -333,12 +333,12 @@ line directly before or after the table.
   (with-temp-buffer
(if (plist-get params :script) ;; user script
(progn (insert
-(org-plot/gnuplot-script data-file num-cols params t))
-   (insert \n)
-   (insert-file-contents (plist-get params :script))
-   (goto-char (point-min))
-   (while (re-search-forward $datafile nil t)
- (replace-match data-file nil nil)))
+   (org-plot/gnuplot-script data-file num-cols params t))
+  (insert \n)
+  (insert-file-contents (plist-get params :script))
+  (goto-char (point-min))
+  (while (re-search-forward $datafile nil t)
+(replace-match data-file nil nil)))
  (insert
   (org-plot/gnuplot-script data-file num-cols params)))
;; graph table
@@ -346,7 +346,7 @@ line directly before or after the table.
(gnuplot-send-buffer-to-gnuplot))
   ;; cleanup
   (bury-buffer (get-buffer *gnuplot*))
-  (delete-file data-file
+  (run-with-idle-timer 0.1 nil (lambda () (delete-file data-file))
 
 (provide 'org-plot)
 
-- 
1.6.3.3



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


[Orgmode] [misc-new-features 3/5] Add an option to sort tags automatically.

2009-07-13 Thread James TD Smith
---
 lisp/ChangeLog |3 +++
 lisp/org.el|   17 -
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 348ade3..9ce7a17 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -11,6 +11,9 @@
SINCE_IA. These give the time since any active or inactive
timestamp in an entry.
(org-special-properties): Add SINCE, SINCE_IA.
+   (org-tags-sort-function): Add custom declaration for tags
+   sorting function.
+   (org-set-tags): Sort tags if org-tags-sort-function is set
 
 2009-07-08  Carsten Dominik  carsten.domi...@gmail.com
 
diff --git a/lisp/org.el b/lisp/org.el
index d08155a..854d09c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2337,6 +2337,15 @@ is better to limit inheritance to certain tags using the 
variables
  (const :tag Yes, do list them t)
  (const :tag List them, indented with leading dots indented)))
 
+(defcustom org-tags-sort-function nil
+  When set, tags are sorted using this function as a comparator
+  :group 'org-tags
+  :type '(choice
+ (const :tag No sorting nil)
+ (const :tag Alphabetical string)
+ (const :tag Reverse alphabetical string)
+ (function :tag Custom function nil)))
+
 (defvar org-tags-history nil
   History of minibuffer reads for tags.)
 (defvar org-last-tags-completion-table nil
@@ -10840,11 +10849,17 @@ With prefix ARG, realign all tags in headings in the 
current buffer.
  ;; No boolean logic, just a list
  (setq tags (replace-match : t t tags
 
+  (if org-tags-sort-function
+ (setq tags (mapconcat 'identity
+   (sort (org-split-string tags (org-re 
[^[:alnum:]...@]+))
+ org-tags-sort-function) :)))
+
   (if (string-match \\`[\t ]*\\' tags)
-  (setq tags )
+ (setq tags )
(unless (string-match :$ tags) (setq tags (concat tags :)))
(unless (string-match ^: tags) (setq tags (concat : tags
 
+
   ;; Insert new tags at the correct column
   (beginning-of-line 1)
   (cond
-- 
1.6.3.3



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


[Orgmode] [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much ea

2009-07-13 Thread James TD Smith
You can customise `org-link-check-clipboards' to check either the X clipboards
or kill-ring only, or both, or none. If you have the interprogram-cut/paste
functions set, you probably only want to use the kill-ring only.
---
 lisp/ChangeLog |5 
 lisp/org.el|   66 ---
 2 files changed, 53 insertions(+), 18 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9ce7a17..662a585 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -14,6 +14,11 @@
(org-tags-sort-function): Add custom declaration for tags
sorting function.
(org-set-tags): Sort tags if org-tags-sort-function is set
+   (org-link-check-clipboards): Add a custom option for
+   clipboard link checking
+   (org-insert-link): If enabled, check the X clipboard and emacs
+   kill ring for strings which look like links, and include them in
+   the stored links to select from.
 
 2009-07-08  Carsten Dominik  carsten.domi...@gmail.com
 
diff --git a/lisp/org.el b/lisp/org.el
index 854d09c..47fb0b6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1024,6 +1024,15 @@ to use.
   :group 'org-link
   :type 'function)
 
+(defcustom org-link-check-clipboards nil
+  Should org-insert-link check clipboards for links
+  :group 'org-link
+  :type '(choice
+ (const :tag Just stored links nil)
+ (const :tag The X11 clipboards x)
+ (const :tag The Emacs kill-ring emacs)
+ (const :tag Both both)))
+
 (defgroup org-link-store nil
   Options concerning storing links in Org-mode.
   :tag Org Store Link
@@ -7323,6 +7332,7 @@ used as the link location instead of reading one 
interactively.
 (desc region)
 tmphist ; byte-compile incorrectly complains about this
 (link link-location)
+(stored-links org-stored-links)
 entry file all-prefixes)
 (cond
  (link-location) ; specified by arg, just use it.
@@ -7342,26 +7352,46 @@ used as the link location instead of reading one 
interactively.
  ((member complete-file '((4) (16)))
   ;; Completing read for file names.
   (setq link (org-file-complete-link complete-file)))
- (t
-  ;; Read link, with completion for stored links.
-  (with-output-to-temp-buffer *Org Links*
-   (princ Insert a link.
+ (t ;; Read link, with completion for stored links.
+  ;;Check clipboards/kill ring for links
+  (when org-link-check-clipboards
+   (setq stored-links
+ (append stored-links
+ (mapcar
+  (lambda (x) (list x Link from clipboard))
+  (remove
+   nil
+   (remove-duplicates
+(mapcar
+ (lambda (x)
+   (when (and x (string-match org-link-types-re x)) x))
+ (append (when
+ (or (eq org-link-check-clipboards 'x)
+ (eq org-link-check-clipboards 'both))
+   (list (org-get-x-clipboard 'PRIMARY)
+ (org-get-x-clipboard 'CLIPBOARD)
+ (org-get-x-clipboard 'SECONDARY)))
+ (when
+ (or (eq org-link-check-clipboards 'emacs)
+ (eq org-link-check-clipboards 'both))
+   (mapcar 'org-no-properties 
kill-ring))
+   (with-output-to-temp-buffer *Org Links*
+ (princ Insert a link.
 Use TAB to complete link prefixes, then RET for type-specific completion 
support\n)
-   (when org-stored-links
- (princ \nStored links are available with up/down or M-p/n (most 
recent with RET):\n\n)
- (princ (mapconcat
- (lambda (x)
-   (if (nth 1 x) (concat (car x)  ( (nth 1 x) )) (car x)))
- (reverse org-stored-links) \n
-  (let ((cw (selected-window)))
-   (select-window (get-buffer-window *Org Links*))
+ (when stored-links
+   (princ \nStored links are available with up/down or M-p/n 
(most recent with RET):\n\n)
+   (princ (mapconcat
+   (lambda (x)
+ (if (nth 1 x) (concat (car x)  ( (nth 1 x) )) (car 
x)))
+   (reverse stored-links) \n
+   (let ((cw (selected-window)))
+ (select-window (get-buffer-window *Org Links*))
(setq truncate-lines t)
(unless (pos-visible-in-window-p (point-max))
  (org-fit-window-to-buffer))
(and (window-live-p cw) (select-window cw)))
   ;; Fake a link history, containing the stored links.
-  (setq tmphist (append (mapcar 'car org-stored-links)
-   org-insert-link-history))
+  (setq tmphist (append (mapcar 'car stored-links) 

[Orgmode] [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist.

2009-07-13 Thread James TD Smith
* contrib/lisp/org-checklist.el
  - Fix some problems with the print/export feature in org-checklist.
  - Add custom options for this module
  - Fix some interaction with a2ps
  - Only reset checkboxes if TODO state is done.

* doc/org.texi
  - Add documentation for org-checklist

* lisp/org.el
  - Add org-checklist to org-modules
---
 contrib/ChangeLog |   16 ++
 contrib/lisp/org-checklist.el |   67 +++-
 lisp/org.el   |1 +
 3 files changed, 69 insertions(+), 15 deletions(-)

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 7e62df0..6a5c2a2 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,19 @@
+2009-07-12  James TD Smith  ahktenz...@mohorovi.cc
+
+   * lisp/org-checklist.el (org-checklist): Add a custom group for
+   org-checklist. The options are all for the unchecked items export
+   function.
+   (org-checklist-export-time-format): Allow customising the
+   timestamp appended to the saved unchecked items list
+   (org-checklist-export-function): Allow customising the output
+   format for the unchecked items list.
+   (org-checklist-export-params): Options for the exporter.
+   (org-checklist-a2ps-params): Printing options.
+   (org-make-checklist-export): Use values from custom vars. Printing
+   is now controlled by the PRINT_EXPORT property in the entry, and
+   the user is only asked if it is missing. Pass the switches to
+   a2ps-buffer properly.
+
 2009-06-20  Carsten Dominik  carsten.domi...@gmail.com
 
* README: List new file org-export-generic.el
diff --git a/contrib/lisp/org-checklist.el b/contrib/lisp/org-checklist.el
index 26d228f..4ebf91b 100644
--- a/contrib/lisp/org-checklist.el
+++ b/contrib/lisp/org-checklist.el
@@ -42,11 +42,37 @@
 ;;
 ;;; Code:
 (require 'org)
+(load a2ps-print)
 
-(defvar export-time-format %Y%m%d%H%M
-  format of timestamp appended to export file)
-(defvar export-function 'org-export-as-ascii
-  function used to prepare the export file for printing)
+(defgroup org-checklist nil
+  Extended checklist handling for org
+  :tag Org-checklist
+  :group 'org)
+
+(defcustom org-checklist-export-time-format %Y%m%d%H%M
+  The format of timestamp appended to LIST_EXPORT_BASENAME to
+  make the name of the export file.
+  :link '(function-link format-time-string)
+  :group 'org-checklist
+  :type 'string)
+
+(defcustom org-checklist-export-function 'org-export-as-ascii
+  function used to prepare the export file for printing
+  :group 'org-checklist
+  :type '(radio (function-item :tag ascii text org-export-as-ascii)
+   (function-item :tag HTML  org-export-as-html)
+   (function-item :tag LaTeX :value org-export-as-latex)
+   (function-item :tag XOXO :value org-export-as-xoxo)))
+
+(defcustom org-checklist-export-params nil
+  options for the export function file for printing
+  :group 'org-checklist
+  :type '(repeat string))
+
+(defcustom org-checklist-a2ps-params nil
+  options for a2ps for printing
+  :group 'org-checklist
+  :type '(repeat string))
 
 (defun org-reset-checkbox-state-maybe ()
   Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set
@@ -54,23 +80,30 @@
   (if (org-entry-get (point) RESET_CHECK_BOXES)
   (org-reset-checkbox-state-subtree)))
 
+
 (defun org-make-checklist-export ()
   Produce a checklist containing all unchecked items from a list
 of checkbox items
   (interactive *)
   (if (org-entry-get (point) LIST_EXPORT_BASENAME)
-  (let* ((export-file (concat (org-entry-get (point) 
LIST_EXPORT_BASENAME)
- - (format-time-string export-time-format)
+  (let* ((export-file (concat (org-entry-get (point) 
LIST_EXPORT_BASENAME nil)
+ - (format-time-string
+  org-checklist-export-time-format)
  .org))
+(print (case (org-entry-get (point) PRINT_EXPORT nil)
+ (( nil nil) nil)
+ (t t)
+ (nil (y-or-n-p Print list? 
 exported-lines
-title)
+title Checklist export)
(save-restriction
  (save-excursion
(org-narrow-to-subtree)
+   (org-update-checkbox-count-maybe)
(org-show-subtree)
(goto-char (point-min))
-   (if (looking-at org-complex-heading-regexp)
-   (setq title (match-string 4)))
+   (when (looking-at org-complex-heading-regexp)
+ (setq title (match-string 4)))
(goto-char (point-min))
(let ((end (point-max)))
  (while ( (point) end)
@@ -85,14 +118,18 @@ of checkbox items
(dolist (entry exported-lines) (insert entry))
(org-update-checkbox-count-maybe)
(write-file export-file)
-   (if (y-or-n-p Print list

[Orgmode] [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.

2009-07-13 Thread James TD Smith
These give the elapsed time since the TIMESTAMP and TIMESTAMP_IA
properties. This value is in days, as a floating point number.

For display in column view, this is converted to a human-readable time
interval in the form 8d 02h 12m 22s.
---
 lisp/ChangeLog  |   18 --
 lisp/org-colview.el |   36 
 lisp/org.el |   23 ++-
 3 files changed, 58 insertions(+), 19 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 351731d..348ade3 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
+2009-07-12  James TD Smith  ahktenz...@mohorovi.cc
+
+   * org-colview.el (org-format-time-period): Formats a time in
+   fractional days as days, hours, mins, seconds.
+   (org-columns-display-here): Add special handling for SINCE and
+   SINCE_IA to format for display.
+
+   * org.el (org-time-since): Add a function to get the time since an
+   org timestamp.
+   (org-entry-properties): Add two new special properties: SINCE and
+   SINCE_IA. These give the time since any active or inactive
+   timestamp in an entry.
+   (org-special-properties): Add SINCE, SINCE_IA.
+
 2009-07-08  Carsten Dominik  carsten.domi...@gmail.com
 
* org-clock.el (org-clock-goto): Find hidden headlines as well.
@@ -561,7 +575,7 @@
`org-export-push-to-kill-ring'.
 
* org-exp.el (org-export-show-temporary-export-buffer): New
-   option. 
+   option.
 
* org-latex.el (org-export-as-latex): Use
`org-export-show-temporary-export-buffer'.
@@ -2861,7 +2875,7 @@
(org-agenda-change-all-lines, org-tags-sparse-tree)
(org-time-string-to-absolute, org-small-year-to-year)
(org-link-escape): Re-apply changes accidentially overwritten
-   by last commit to Emacs.
+   by last commit to Emacs
 
 2008-11-23  Carsten Dominik  carsten.domi...@gmail.com
 
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 7633b5b..6a89849 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -190,18 +190,19 @@ This is the compiled version of the format.)
  (length property))
f (format %%-%d.%ds |  width width)
val (or (cdr ass) )
-   modval (or (and org-columns-modify-value-for-display-function
-   (functionp
-org-columns-modify-value-for-display-function)
-   (funcall
-org-columns-modify-value-for-display-function
-title val))
-  (if (equal property ITEM)
-  (if (org-mode-p)
-  (org-columns-cleanup-item
-   val org-columns-current-fmt-compiled)
-(org-agenda-columns-cleanup-item
- val pl cphr org-columns-current-fmt-compiled)
+   modval (cond ((and org-columns-modify-value-for-display-function
+  (functionp
+   org-columns-modify-value-for-display-function))
+ (funcall org-columns-modify-value-for-display-function
+  title val))
+  ((equal property ITEM)
+   (if (org-mode-p)
+   (org-columns-cleanup-item
+val org-columns-current-fmt-compiled)
+ (org-agenda-columns-cleanup-item
+  val pl cphr org-columns-current-fmt-compiled)))
+  ((or (equal property SINCE) (equal property 
SINCE_IA))
+   (org-format-time-period val
   (setq s2 (org-columns-add-ellipses (or modval val) width))
   (setq string (format f s2))
   ;; Create the overlay
@@ -1388,6 +1389,17 @@ This will add overlays to the date lines, to show the 
summary for each day.
   (equal (nth 4 a) (nth 4 fm)))
  (org-columns-compute (car fm)))
 
+(defun org-format-time-period (interval)
+  (if (stringp interval)
+  
+(let* ((days (floor interval))
+  (frac-hours (* 24 (- interval days)))
+  (hours (floor frac-hours))
+  (minutes (floor (* 60 (- frac-hours hours
+  (seconds (floor (* 60 (- (* 60 (- frac-hours hours)) minutes)
+  (format %dd %02dh %02dm %02ds days hours minutes seconds
+
+
 (provide 'org-colview)
 
 ;; arch-tag: 61f5128d-747c-4983-9479-e3871fa3d73c
diff --git a/lisp/org.el b/lisp/org.el
index feaa115..8843486 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6481,7 +6481,10 @@ WITH-CASE, the sorting considers case as well.
   (string-to-char (match-string 2))
 org-default-priority))
  ((= dcst ?r)
-  (or (org-entry-get nil property) ))
+  (or (org-entry-get nil

[Orgmode] Re: [misc-new-features 4/5] extra long subject lines

2009-07-13 Thread James TD Smith
Hi Bernt,

On 2009-07-13 07:55:04(-0400), Bernt Hansen wrote:
 James TD Smith ahktenz...@mohorovi.cc writes:

  You can customise `org-link-check-clipboards' to check either the X 
  clipboards
  or kill-ring only, or both, or none. If you have the interprogram-cut/paste
  functions set, you probably only want to use the kill-ring only.
  ---

 Hi James,

 The summary line (subject) is way too long.  If this gets applied it
 won't show up very nicely in git shortlog or git log.

 Normally the subject line (first line of the commit) is a short one-line
 summary of the patch that fits in less than 80 chars.  If you find you
 that is not enough that is usually a sign that the patch should be split
 into multiple smaller commits.

 You can put as much detail as you want in the body of the patch (line
 3+).  Line 2 is blank - to separate the one-line summary from the
 description for the commit.

Sorry about that, guess I'm a bit rusty :). I've fixed the commit logs and
pushed them to my git repository.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] Re: Advice sought on managing decision alternatives.

2009-02-01 Thread James TD Smith
Hi Tom,

On 2009-01-31 13:36:20(-0500), Tom Breton (Tehom) wrote:
  Also, I am interested in the testing environment, and what
  you made here may end up to be enough to establish a testing
  framework for Org-mode.

  If it turns out to be like this, maybe you can make a tutorial
  on test creation and put that up on Worg?  I would be willing
  to put the code needed for the testing environment into the
  contrib directory.

 Certainly.  One thing, once my testing package rtest is in a stable state,
 I plan to release it on its own, possibly as a sourceforge project.  But I
 have no objection to you also putting in the org contrib directory.

As part of the rewrite of org-remember I am working on I have been adding tests
using ert (at the time I started it you suggested not to use rtest as it was
undergoing a lot of changes[1]). I haven't run into any problems with ert so
far, but I would be willing to switch to another testing package if it becomes
the standard for org-mode.

I'd like to take a look at rtest, but the only version of I can find on the web
is at http://www.panix.com/~tehom/my-code/rtest-3-0.tar.gz, which appears to be
from 2001. Is there a more recent version available?

James

[1] http://article.gmane.org/gmane.emacs.orgmode/8817

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] Broken plain list check boxes?

2009-01-29 Thread James TD Smith
Hi Chris,

On 2009-01-29 14:05:27(-), Chris Randle wrote:
 Hi Carsten

 Just updated to 6.20e. Before, on 6.18c, if I had a plain list like
 this:

 * Test
   - [ ] A
   - [ ] B
   - [ ] C

 With the cursor on the test line, typing `c-c c-x c-b' would check all
 the boxes, and repeating would uncheck them. Now it doesn't seem to
 toggle, only check.

 I hope this isn't a permanent change, or that there's another way to
 turn them all off because I use lists of check boxes 20 or 30 items long
 to mark off the little bits  pieces I like to get done every day. It'd
 be a bit tedious to have to manually set them all unchecked at the
 beginning of each day, even with a macro.

Have you looked at org-checklist.el in contrib? I wrote that to handle this kind
of thing.

Make sure org-checklist.el is in your load path, and add
(require 'org-checklist)
 to your .emacs. You can then set up your daily task like so:

,[ test.org ]
| * TODO test
|   SCHEDULED: 2009-01-29 Thu + 1d
|   :PROPERTIES:
|   :RESET_CHECKBOXES: t
|   :END:
|   - [ ] Task 1
|   - [ ] Task 2
|   - [ ] Task 3
`

and when you mark it done all the checkboxes will be cleared.

James

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


[Orgmode] Re: Suggestion with bad patch for org-remember-templates

2009-01-06 Thread James TD Smith
On 2009-01-05 19:41:09(+0100), Carsten Dominik wrote:

 On Jan 5, 2009, at 5:31 PM, Wes Hardaker wrote:

  On Sun, 4 Jan 2009 08:23:04 +0100, Carsten Dominik 
  domi...@science.uva.nl
   said:
 
  CD I think it would be better not to use the remember buffer for this,
  CD but another, dedicated, temporary buffer.
 
  Why would it matter though? You're already opening and displaying it...
  Granted, you could stop doing that.
 
  The only benefit to using another buffer is if the person canceled the
  request (ctrl-g) in mid-selection then the original contents of the remember
  buffer would be unaltered.

 There are more reasons why it matters.

 It is possible to make setup that will pop up the remember buffer in a
 different/new frame, but you might still want to have the template selection
 in your current frame. Also, it is allowed to call org-remember again in an
 existing remember buffer, to apply a new template to the existing context.

Also, the template selection interface needs to be usable when there is no
remember buffer, as it is also used to select a template to jump to the last
note stored using that template.

 Most of all, it is much cleaner this way. A dispatcher splash screen is by
 definition a one-off temporary buffer. Creating and displaying temporary
 buffer is very cheap and easily done, and it is the standard way to do this
 kind of stuff.

 I have reasonably strong feelings about this, because at the beginning of my
 career, I did work with legacy computer codes which where done in the old days
 when dynamic allocation was not possible and computer memory was small, so
 people would write programs where the same vector was used for different
 purposes, in different locations of the program... :-)

Agreed.

--
|-James TD Smith-email/ahktenz...@mohorovi.cc-|


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


Re: [Orgmode] template specific commit functions.

2008-12-03 Thread James TD Smith
Hi Richard and Carsten,

On 2008-12-03 09:33:56(+0100), Carsten Dominik wrote:
 please make this proposal to JD Smith, I think this fits well into his  
 new design for the Org - Remember interaction.  I will not add new  
 features to Remember for the time being, only fix bugs.
 
 On Nov 29, 2008, at 8:21 PM, Richard Riley wrote:
  Carsten, I see there is a check function to determine if the template can
  be used - is there, or could there please be, a function called which is
  template specific with the committed remember item (i.e after merging title
  etc at C-c C-c time)? I guess that item would be a record of some sort and
  the function called could well be, for example, an interface to twitter or
  blorg or  etc.

I've already seen this and will be implementing it.

James

--
|-James TD Smith-email/[EMAIL PROTECTED]-|



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


Re: [Orgmode] RFC: Improvements to org-remember

2008-11-29 Thread James TD Smith
 * %^s %u %^g\n%i%u%? Journal.org bottom)
(Shopping ?s * %i%? Shopping.org bottom)

where %^s is a new expansion which allows entering a todo keyword.

Currently if you call org-remember in the remember buffer, it prompts you for a
template again and applies it, which wipes out everything you have entered. If
this was changed so that the contents of the remember buffer are stored, and
inserted into appropriate places in the new template, it would be possible to
type your idea into the remember buffer, and then apply a template to it,
provided the template contains suitable expansions.  

So the process would be (with org-remember bound to C-c m):

1. C-c m RET to run org-remember and select no template.
2. Enter your idea.
3. C-c m to run org-remember again.
4. Select the appropriate template.
5. Fill in any prompts for todo keywords and tags, or leave blank as 
appropriate.
6. C-c C-c to file the note.

Would that be suitable?

James

-- 
|-James TD Smith-email/[EMAIL PROTECTED]-|


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


Re: [Orgmode] RFC: Improvements to org-remember

2008-11-29 Thread James TD Smith
Hi Ben, 

On 2008-11-24 11:50:53(+0200), Ben Alexander wrote:
 On 2008-Nov-24, at 04:25, [EMAIL PROTECTED] wrote:
  ** Automatic sorting
 
 Right now, I have a :SORT: property in my property drawer which looks  
 like:
:SORT: C-c S-6 p
 This is just a reminder to me for the key chord I need to play to get  
 the sort I want.  It's conveniently located near the headline and not  
 too hard to open and read when I need to resort manually.
 
 It seems to me that having an hook like 'org-remember-after-filing  
 would allow people to choose what kinds of updating they wanted done  
 after a remember template was used.   Mixing this with different types  
 of templates may take some care: you don't want to run all the hooks  
 inside a save-excursion if the point to to allow the hook to move  
 point to a special place, but then all hooks would have to be written  
 with that in mind. Perhaps the hooks should be run inside a (let )  
 with some official bindings for markers for the following:
   - org-remember-marker-to-beginning-of-new-text
   - org-remember-marker-to-end-of-new-text
   - org-remember-marker-to-parent-headline (perhaps most useful for  
 non-headline remember templates)
   - org-remember-template-type

This is basically how I was thinking of implementing the sort after filing (and
the other post-commit update functions).

 But automatic sorting seems useful in many other contexts (like after  
 scheduling or rescheduling an item, or changing priority, or editing  
 the headline text) so perhaps some wishes/ideas from the list would be  
 appropriate.  Could org-mode take ownership of the :SORT: property for  
 headlines, and have a org-sort-file-using-property (or a org-sort- 
 headline-using-property) which could be added to hook lists where-ever  
 the user wanted?

I think it would be rather difficult to get automatic sorting working for
editing the headline text. Org doesn't have hook lists for priority or
scheduling changes either.

I do like the idea of defining a default sort for a tree. We would need
a :SORT_KEY: property as well, for sorting by property or table column, and a
#+SORT: facility for file level sorting. The property could be used to determine
a default sort for org-sort, with a new option added to select the default
(maybe C-c ^ RET).

 Or is this too specific?  Would it be nice to have plain lists (or  
 checkboxed lists) have some kind of sort property too? Where could a  
 user store this data so it could be easy to see but also easy to ignore.

I'm not sure it's necessary to be able to do this in plain lists. If a plain
list item has enough activity under it to need sorting on a regular basis its
probably worth promoting it to a headline.

--
|-James TD Smith-email/[EMAIL PROTECTED]-|


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


Re: [Orgmode] RFC: Improvements to org-remember

2008-11-29 Thread James TD Smith
Hi Carsten, 

On 2008-11-25 20:27:31(+0100), Carsten Dominik wrote:
 On Nov 25, 2008, at 12:46 PM, James TD Smith wrote:
  On 2008-11-24 09:58:49(+0100), Carsten Dominik wrote:
  On Nov 24, 2008, at 12:25 AM, James TD Smith wrote:
  I think it would make sense to move the code to get values for remember
  expansions out of `org-remember-apply-template' into separate functions.
  These could be added to an association list indexed by the expansion
  character. This would also make it easier to add new expansions.
 
  Yes. However, it is necessary to keep the sequence of handling the escapes,
  in particular first filling in all non-interactive ones, and only then
  doing the interactive ones.
 
  I'll probably use two lists, one of interactive escapes and one of
  non-interactive escapes.
 
 I believe it makes some sense to fill in the interactive parts in place, while
 the partially filled template is visible. The context may help.

I agree. I'm not going to change that.

  ** Plists for remember templates
 
  Ah, this will be a big relieve when it is implemented, should have been
  like this from the start.
 
  I want to change the format of remember templates to use plists. This is
  to allow introducing a number of optional parameters to control the new
  features I want to add. Org uses plists elsewhere, for example in the
  #+OPTIONS: configuration header, and #+PLOT: lines, so the syntax should
  already be familiar to org users.
 
  I also think it would make sense to to move some options which are
  currently set using escapes outside of the template, specifically %!
  (store template immediately) and % (jump to entry after storing).
 
  Yes, this wil be much better.
 
  I was thinking that maybe some other expansions should be moved into the
  template, specifically those which don't insert their values where the %
  expansion is.
 
  For example instead of
  ,
  | (Video ?v * TOWATCH %^{Title} %^g%^{Type}p%^{Length}p%^{Year}
  | ~/Personal/Video.org top)
  `
  we could have
  ,
  | (?v :name Video * TOWATCH %^{Title} :tags file :properties  
  |  (Type Length Year) :target ~/Personal/Video.org :prepend t)
  `
 
  I think the latter is much better for adding properties, particularly if you
  want to have a template with a lot of them.
 
 This is an interesting idea. The TODO state could also be done in this way,
 maybe offering the fast selection interface for TODO states.

Yes. An expansion for TODO states might be useful as well. 

  While one could have a property for explicitly selecting a type like table
  row or plain-list item or checkbox, it would also be possible to derive
  this from the Remember buffer content automatically. Which method is
  better?
 
  I think using the property would be easier to implement, but automatically
  figuring out what kind of entry to insert will be needed to handle entries
  without templates.
 
 Will we have entries without templates?

Yes, for two reasons: freeform entry with the possibility of applying a template
later (see my reply to Samuel Wales' suggestions), and so remember can be used
to add non-org items (possibly with other remember handlers).

  I'd like two-key access for templates anyway; I have a number of similar
  templates which are scattered over the available keys and could be grouped
  together more logically with two stage selection.
 
 Hmm. I am not sure if the two-key selection code from the agenda can be easily
 refactored for this case, so maybe we need to duplicate this functionality, or
 re-write the selector for agenda custom commands.

Is `org-agenda-get-restriction-and-command' the method I should be looking at? 

  Another option I would like to see is, how many empty lines should be
  inserted before the entry. Because sometimes it is nice to have an empty
  line between entries, and sometimes not. Default should be no empty lines.
 
  That should be easy to add. What about entries added before the current
  contents of the target headline? The blank lines would need to go after the
  newly inserted item to maintain the proper gap between it and the headline
  below it.
 
 I think it is sufficient to only specify the empty lines before the heading.
 An entry that is inserted as the first child must then simply be inserted
 directly after the heading and possibly timestamps/properties, so that any
 empty lines *before* the already present sibling remain. Please do not change
 this - throughout Org, it is the empty space *before* a headline that counts.

OK.

  I think using a branch in the main repo makes sense as I can push to it when
  I have things which are ready for testing, and I keep using my own repo to
  sync work between my computers without worrying about breaking things for
  anyone testing the branch.
 
  I don't currently have an account on repo.or.cz, but I'll sign up and send
  you my details. I probably ought to sign up for Worg as well.
 
 Good. For Worg, you need to send mail to Bastien

Re: [Orgmode] RFC: Improvements to org-remember

2008-11-25 Thread James TD Smith
Hi Carsten,

On 2008-11-24 09:58:49(+0100), Carsten Dominik wrote:
 
 Hi James, I do like all this.  A few comments:
 
 On Nov 24, 2008, at 12:25 AM, James TD Smith wrote:
  I think it would make sense to move the code to get values for remember
  expansions out of `org-remember-apply-template' into separate functions.
  These could be added to an association list indexed by the expansion
  character. This would also make it easier to add new expansions.
 
 Yes. However, it is necessary to keep the sequence of handling the escapes, in
 particular first filling in all non-interactive ones, and only then doing the
 interactive ones.

I'll probably use two lists, one of interactive escapes and one of
non-interactive escapes.

  ** Plists for remember templates
 
 Ah, this will be a big relieve when it is implemented,
 should have been like this from the start.
 
  I want to change the format of remember templates to use plists. This is to
  allow introducing a number of optional parameters to control the new
  features I want to add. Org uses plists elsewhere, for example in the #
  +OPTIONS: configuration header, and #+PLOT: lines, so the syntax should
  already be familiar to org users.
 
  I also think it would make sense to to move some options which are currently
  set using escapes outside of the template, specifically %! (store template
  immediately) and % (jump to entry after storing).
 
 Yes, this wil be much better.

I was thinking that maybe some other expansions should be moved into the 
template,
specifically those which don't insert their values where the % expansion is.

For example instead of 
,
| (Video ?v * TOWATCH %^{Title} %^g%^{Type}p%^{Length}p%^{Year}
| ~/Personal/Video.org top)
`
we could have
,
| (?v :name Video * TOWATCH %^{Title} :tags file :properties (Type 
Length Year)
| :target ~/Personal/Video.org :prepend t)

`

I think the latter is much better for adding properties, particularly if you
want to have a template with a lot of them.

  For backwards compatibility, the current template format would still be
  supported, but the additional options would not be available. Defaults for
  the extra parameters would be set so if they are not present the templates
  would work as they do currently.
 
   The current options would be represented as below:
   - :template :: the template itself
   - :name :: the name of the template
   - :target :: The :target parameter takes the place of the current
file and headline target specification. The parameter
specifies only the default target; all the other options will
remain available via numeric prefixes to C-c C-c. The
available options are:
 - filename:heading :: a file target. If the heading is  
 omitted, a top-level heading will be created.
 
 
 That should be a double colon, for symmetry with org-archive-location,
 and to avoid problems with Windows paths.

Yes, it was supposed to be a double colon.
 
  * New features
  ** Adding non-headline items
 
   For some time I have wanted to be able to use remember to add checklist
   entries and table rows as well as org headlines. To configure this, a :type
   parameter will be added to the template, which can be either headline (the
   default), list, checklist or table.
 
   - Table rows.
 
 This is an awesome idea, as are plain list items and checkboxes.
 
 For plain list items, I guess the right thing would be to select the first
 plain list under the headline, there might be several. Also, the first table
 under a headline, in case there are more.
 
The plain list items would be added as direct children of the target headline.
I'm not sure having a plain list item under a headline as a target makes sense,
but it could be implemented by changing the :target specification to allow
specifying a path, so test.org::Target::list item would add the new entry as a
child of the first list item. This would also remove the requirement for
remember targets to have headlines which are unique in the file.

For tables it would have to be the first table under the headline, as I don't
think there is a way of identifying a particular table in an org entry. Maybe we
could use #+CAPTION, when it's been added?

 While one could have a property for explicitly selecting a type like table row
 or plain-list item or checkbox, it would also be possible to derive this from
 the Remember buffer content automatically. Which method is better?

I think using the property would be easier to implement, but automatically
figuring out what kind of entry to insert will be needed to handle entries
without templates.

  An extension to this would be to include a truncated copy of the table in
  the remember buffer, with just the headers (and possibly formulae) from the
  target table, so the user could add multiple lines in the remember buffer
  and then add

Re: [Orgmode] RFC: Improvements to org-remember

2008-11-24 Thread James TD Smith
Hi Samuel,

On 2008-11-23 17:23:15(-0700), Samuel Wales wrote:
 All of this looks great.  I especially like code integrity, plist
 syntax, and :prefix.
 
 Do you want more ideas for remember?

Yes. Any suggestions for new features or ways the behaviour of the remember
handler could be improved are most welcome. 
 
James

-- 
|-James TD Smith-email/[EMAIL PROTECTED]-|


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


[Orgmode] RFC: Improvements to org-remember

2008-11-23 Thread James TD Smith

 I use checklists a lot for breaking down tasks. Being able to add checklist
 entries using remember, with the clocked task as a target, would make it
 possible to do this without having to switch away from the buffer I was
 working in.

   - Plain list entries.

 It also be useful to be able to add plain list items. This would be like a
 more featureful version of `org-add-note', with the full range of remember
 expansions available.

** Updating completion statistics

   If the target for a remember template contains either of the completion
   status tracking cookies ([/}, [%]), these should be updated after the entry
   has been added. This should apply to both entries containing checklists, and
   entries containing other headlines.

   Also, target matching for templates should ignore the completion status
   cookies.

** Per-template insertion order

   It is currently possible to configure a remember template to add entries at
   the start or end of the target only if the target is a file, or set globally
   with `org-reverse-note-order'. It would be useful to be able to set this for
   individual templates.

   An optional :prepend parameter would control where the entry would be
   inserted. If set to t the new entry would be the first under the heading, and
   the last the if nil. The default would be whatever `org-reverse-note-order'
   is set to.

** Automatic sorting

   It would be useful to be able to automatically sort the target's entries
   after adding one using remember, for example if you want to keep entries
   sorted by TODO keyword or in alphabetical order.

   This would require two parameters:
   - :sort :: if non-nil, sort the contents of the headline the item was
   added under with the specified function. valid options are
 - todoorder :: sort by TODO state
 - alpha :: sort alphabetically
 - numeric :: sort numerically
 - priority :: sort by priority
 - time :: sort by time
 - property :: sort by property
 - function :: use function to determine sort order
 - Additionally, any of the previous items postfixed with '-rev' will sort
   in reverse
   - :sortkey :: for tables, and property searches, this specifies either the
 column or property to sort by.

* Development plan

  It will take me quite a while to implement all this so I plan on doing it in
  stages. After the preliminary work is done, each new feature will be
  implemented in a separate git branch which can be merged into the master
  branch when it's finished and properly tested. I'll post an update to the list
  when each feature is ready for testing.
  
James

--
|-James TD Smith-email/[EMAIL PROTECTED]-|


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


[Orgmode] [PATCH] Fix a bug in the remember properties escape

2008-11-17 Thread James TD Smith
Calling org-property-get-allowed-values with the point not on an item
resulted in an error.

This patch is available from my git repository, in the branch
remember-properties-fix.

 ---
 lisp/ChangeLog   |6 ++
 lisp/org-remember.el |5 -
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 53a21fd..3690659 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-17  James TD Smith  [EMAIL PROTECTED]
+
+   * org-remember.el (org-remember-apply-template): The call to
+   `org-property-get-allowed-values' failed if the point in the
+   target file was not on a headline.
+
 2008-11-17  Carsten Dominik  [EMAIL PROTECTED]
 
* org-colview.el (org-columns-display-here): New argument
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index 5d99ba3..9026489 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -504,7 +504,10 @@ to be run from that hook to function properly.
((prop (substring-no-properties prompt))
 (allowed (with-current-buffer
  (get-buffer (file-name-nondirectory file))
-   (org-property-get-allowed-values nil prop 'table)))
+   (save-excursion
+ (if (not (org-at-heading-p))
+ (re-search-forward 
org-complex-heading-regexp))
+ (org-property-get-allowed-values nil prop 
'table
 (existing (with-current-buffer
   (get-buffer (file-name-nondirectory file))
 (mapcar 'list (org-property-values prop
-- 
1.5.6.5



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


[Orgmode] [PATCH 2/3] Add clock resuming.

2008-10-23 Thread James TD Smith
If the option `org-clock-resume' is t, and the first clock line in an entry is 
is
open, clocking into that task resumes the clock from that time.
---
 lisp/ChangeLog|8 
 lisp/org-clock.el |   28 +---
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e4ffc88..438296d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,14 @@
* org.el (org-insert-todo-heading): Fix bug with force-heading
argument.
 
+2008-10-23  James TD Smith  [EMAIL PROTECTED]
+
+   * org-clock.el (org-clock-in-resume): Add a custom option to
+   toggle starting the clock from an open clock line.
+   (org-clock-in): When clocking in to an entry, if
+   `org-clock-in-resume' is set, check if the first clock line is
+   open and if so, start the clock from the time in the clock line.
+
 2008-10-22  Carsten Dominik  [EMAIL PROTECTED]
 
* org-exp.el (org-export-as-ascii): Handle the case that we are
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index da86b0d..40272d4 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -95,6 +95,12 @@ The function is called with point at the beginning of the 
headline.
   :group 'org-clock
   :type 'integer)
 
+(defcustom org-clock-in-resume nil
+  If non-nil, when clocking into a task with a clock entry which
+has not been closed, resume the clock from that point
+  :group 'org-clock
+  :type 'boolean)
+
 ;;; The clock for measuring work time.
 
 (defvar org-mode-line-string )
@@ -291,12 +297,21 @@ the clocking selection, associated with the letter `d'.
  (t ???)))
  (setq org-clock-heading (org-propertize org-clock-heading 'face nil))
  (org-clock-find-position)
-
- (insert \n) (backward-char 1)
- (org-indent-line-function)
- (insert org-clock-string  )
- (setq org-clock-start-time (current-time))
- (setq ts (org-insert-time-stamp (current-time) 'with-hm 'inactive))
+ (if (and org-clock-in-resume
+  (looking-at (concat ^[ \\t]*  org-clock-string
+   
\\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}
+   +\\sw+ 
+[012][0-9]:[0-5][0-9]\\)\\]$)))
+ (progn (message Matched %s (match-string 1))
+(setq ts (concat [ (match-string 1) ]))
+(goto-char (match-end 1))
+(setq org-clock-start-time
+  (apply 'encode-time (org-parse-time-string 
(match-string 1)
+   (progn
+ (insert \n) (backward-char 1)
+ (org-indent-line-function)
+ (insert org-clock-string  )
+ (setq org-clock-start-time (current-time))
+ (setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 
'inactive
  (move-marker org-clock-marker (point) (buffer-base-buffer))
  (or global-mode-string (setq global-mode-string '()))
  (or (memq 'org-mode-line-string global-mode-string)
@@ -962,7 +977,6 @@ the currently selected interval size.
   (re-search-forward #\\+END:)
   (end-of-line 0
 
-
 (defun org-clocktable-add-file (file table)
   (if table
   (let ((lines (org-split-string table \n))
-- 
1.5.6.5



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


[Orgmode] [PATCH 0/3] Split my clock resume/clock persistence patch

2008-10-23 Thread James TD Smith
I've split this patch out into three parts, as requested.

James TD Smith (3):
  Fix some typos and duplication in the ChangeLog
  Add clock resuming.
  Add clock persistence.

 lisp/ChangeLog|   46 -
 lisp/org-clock.el |  118 +---
 2 files changed, 146 insertions(+), 18 deletions(-)
 mode change 100755 = 100644 lisp/ChangeLog



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


[Orgmode] [PATCH 2/3] Add clock resuming.

2008-10-23 Thread James TD Smith
If the option `org-clock-resume' is t, and the first clock line in an entry is 
is
open, clocking into that task resumes the clock from that time.
---
 lisp/ChangeLog|8 
 lisp/org-clock.el |   28 +---
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e4ffc88..438296d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,14 @@
* org.el (org-insert-todo-heading): Fix bug with force-heading
argument.
 
+2008-10-23  James TD Smith  [EMAIL PROTECTED]
+
+   * org-clock.el (org-clock-in-resume): Add a custom option to
+   toggle starting the clock from an open clock line.
+   (org-clock-in): When clocking in to an entry, if
+   `org-clock-in-resume' is set, check if the first clock line is
+   open and if so, start the clock from the time in the clock line.
+
 2008-10-22  Carsten Dominik  [EMAIL PROTECTED]
 
* org-exp.el (org-export-as-ascii): Handle the case that we are
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index da86b0d..40272d4 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -95,6 +95,12 @@ The function is called with point at the beginning of the 
headline.
   :group 'org-clock
   :type 'integer)
 
+(defcustom org-clock-in-resume nil
+  If non-nil, when clocking into a task with a clock entry which
+has not been closed, resume the clock from that point
+  :group 'org-clock
+  :type 'boolean)
+
 ;;; The clock for measuring work time.
 
 (defvar org-mode-line-string )
@@ -291,12 +297,21 @@ the clocking selection, associated with the letter `d'.
  (t ???)))
  (setq org-clock-heading (org-propertize org-clock-heading 'face nil))
  (org-clock-find-position)
-
- (insert \n) (backward-char 1)
- (org-indent-line-function)
- (insert org-clock-string  )
- (setq org-clock-start-time (current-time))
- (setq ts (org-insert-time-stamp (current-time) 'with-hm 'inactive))
+ (if (and org-clock-in-resume
+  (looking-at (concat ^[ \\t]*  org-clock-string
+   
\\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}
+   +\\sw+ 
+[012][0-9]:[0-5][0-9]\\)\\]$)))
+ (progn (message Matched %s (match-string 1))
+(setq ts (concat [ (match-string 1) ]))
+(goto-char (match-end 1))
+(setq org-clock-start-time
+  (apply 'encode-time (org-parse-time-string 
(match-string 1)
+   (progn
+ (insert \n) (backward-char 1)
+ (org-indent-line-function)
+ (insert org-clock-string  )
+ (setq org-clock-start-time (current-time))
+ (setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 
'inactive
  (move-marker org-clock-marker (point) (buffer-base-buffer))
  (or global-mode-string (setq global-mode-string '()))
  (or (memq 'org-mode-line-string global-mode-string)
@@ -962,7 +977,6 @@ the currently selected interval size.
   (re-search-forward #\\+END:)
   (end-of-line 0
 
-
 (defun org-clocktable-add-file (file table)
   (if table
   (let ((lines (org-split-string table \n))
-- 
1.5.6.5



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


[Orgmode] [PATCH 1/3] Fix some typos and duplication in the ChangeLog

2008-10-23 Thread James TD Smith
---
 lisp/ChangeLog |   22 +++---
 1 files changed, 11 insertions(+), 11 deletions(-)
 mode change 100755 = 100644 lisp/ChangeLog

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
old mode 100755
new mode 100644
index 0a65adf..e4ffc88
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -74,7 +74,15 @@
* org.el (org-clock-update-time-maybe): Compute negative clock
intervals correctly.
 
-2008-10-15  James TD Smith  [EMAIL PROTECTED]
+2008-10-16  Carsten Dominik  [EMAIL PROTECTED]
+
+   * org.el (org-add-log-setup): Respect
+   `org-log-state-notes-insert-after-drawers'.
+   (org-log-state-notes-insert-after-drawers): New option.
+   (org-todo-trigger-tag-changes): New function.
+   (org-todo): Call `org-todo-trigger-tag-changes'.
+
+2008-10-16  James TD Smith  [EMAIL PROTECTED]
 
* org.el (org-add-log-setup): Only skip drawers if the are
immediately after the scheduling keywords.
@@ -87,14 +95,6 @@
(org-clock-in): Use org-indent-line-function to indent clock lines.
(org-clock-find-position): Fix indentation of empty clock drawers.
 
-2008-10-16  Carsten Dominik  [EMAIL PROTECTED]
-
-   * org.el (org-add-log-setup): Respect
-   `org-log-state-notes-insert-after-drawers'.
-   (org-log-state-notes-insert-after-drawers): New option.
-   (org-todo-trigger-tag-changes): New function.
-   (org-todo): Call `org-todo-trigger-tag-changes'.
-
 2008-10-15  Carsten Dominik  [EMAIL PROTECTED]
 
* org-publish.el (org-publish-org-to): Handle case when
@@ -178,7 +178,7 @@
* org-clock.el (org-clock-heading-for-remember): New variable.
(org-clock-in): Set `org-clock-heading-for-remember'.
 
-2008-10-01 James TD Smith  [EMAIL PROTECTED]
+2008-10-01  James TD Smith  [EMAIL PROTECTED]
 
* org-remember.el (org-remember-apply-template): Add new
expansions: %k, %K for currently clocked task and a link to the
@@ -287,7 +287,7 @@
 
* org-export-latex.el (org-export-latex-keywords-maybe): Bug fix.
 
-2008-09-22  James TA Smith  [EMAIL PROTECTED]
+2008-09-22  James TD Smith  [EMAIL PROTECTED]
 
* org-plot.el (org-plot/gnuplot): Make tables starting with a
hline work correctly.
-- 
1.5.6.5



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


[Orgmode] [PATCH 3/3] Add clock persistence.

2008-10-23 Thread James TD Smith
Clock-related data are saved when exiting emacs ands restored when emacs
is restarted. The data saved include the contents of `org-clock-history',
and the running clock, if there is one.

To use this, you will need to add

(require 'org-clock)
(org-clock-persistence-insinuate)

to your .emacs and either add

(setq org-clock-persist t)
(setq org-clock-in-resume t)

or set those options to t in custom.

This patch requires the clock resume patch.
---
 lisp/ChangeLog|   16 +
 lisp/org-clock.el |   90 +
 2 files changed, 106 insertions(+), 0 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 438296d..063ae15 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -10,6 +10,22 @@
(org-clock-in): When clocking in to an entry, if
`org-clock-in-resume' is set, check if the first clock line is
open and if so, start the clock from the time in the clock line.
+   (org-clock-persist): Add a custom option to toggle clock
+   persistence.
+   (org-clock-persist-query-save): Add a custom option to toggle
+   asking the user if they want to save the running clock when
+   exiting.
+   (org-clock-persist-query-resume): Add a custom option to toggle
+   asking the user if they want to resume the saved clock when Emacs
+   is restarted.
+   (org-clock-save): Add a function to save clock data.
+   This includes the contents of `org-clock-history' and the buffer
+   and position of the currently clocked task, if any.
+   (org-clock-load): Add a function to load clock data.
+   This populates `org-clock-history', and resumes the saved clocked
+   task if there is one.
+   (org-clock-persistence-insinuate): Add a method to set up the
+   hooks for clock persistence.
 
 2008-10-22  Carsten Dominik  [EMAIL PROTECTED]
 
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 40272d4..90b2992 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -101,6 +101,28 @@ has not been closed, resume the clock from that point
   :group 'org-clock
   :type 'boolean)
 
+(defcustom org-clock-persist nil
+  When non-nil, save the running clock when emacs is closed, and
+  resume it next time emacs is started.
+  :group 'org-clock
+  :type 'boolean)
+
+(defcustom org-clock-persist-file ~/.emacs.d/org-clock-save.el
+  File to save clock data to
+  :group 'org-clock
+  :type 'string)
+
+(defcustom org-clock-persist-query-save nil
+  When non-nil, ask before saving the current clock on exit
+  :group 'org-clock
+  :type 'boolean)
+
+(defcustom org-clock-persist-query-resume t
+  When non-nil, ask before resuming any stored clock during
+load.
+  :group 'org-clock
+  :type 'boolean)
+
 ;;; The clock for measuring work time.
 
 (defvar org-mode-line-string )
@@ -989,6 +1011,74 @@ the currently selected interval size.
   lines)
   \n
 
+(defun org-clock-save ()
+  Persist various clock-related data to disk
+  (with-current-buffer (find-file (expand-file-name org-clock-persist-file))
+(progn (delete-region (point-min) (point-max))
+  ;;Store clock
+  (insert (format ;; org-persist.el - %s at %s\n system-name 
(time-stamp-string)))
+  (if (and org-clock-persist (marker-buffer org-clock-marker)
+   (or (not org-clock-persist-query-save)
+   (y-or-n-p (concat Save current clock (
+ (substring-no-properties 
org-clock-heading)
+ )
+  (insert (setq resume-clock '(\
+  (buffer-file-name (marker-buffer org-clock-marker))
+  \ .  (int-to-string (marker-position 
org-clock-marker))
+  ))\n))
+  ;;Store clocked task history. Tasks are stored reversed to make
+  ;;reading simpler
+  (if org-clock-history
+  (insert (setq stored-clock-history '(
+  (mapconcat
+   (lambda (m)
+ (when (marker-buffer m)
+   (concat (\ (buffer-file-name (marker-buffer m))
+   \ .  (int-to-string (marker-position m))
+   
+   (reverse org-clock-history)  ) ))\n))
+  (save-buffer)
+  (kill-buffer (current-buffer)
+
+(defvar org-clock-loaded nil)
+
+(defun org-clock-load ()
+  Load various clock-related data from disk, optionally resuming
+a stored clock
+  (if (not org-clock-loaded)
+  (let ((filename (expand-file-name org-clock-persist-file))
+   (org-clock-in-resume t))
+   (if (file-readable-p filename)
+   (progn
+ (message %s Restoring clock data)
+ (setq org-clock-loaded t)
+ (load-file filename)
+ ;; load history
+ (if (boundp 'stored-clock-history)
+  

Re: [Orgmode] [PATCH] Allow storing clock status between emacs sessions.

2008-10-22 Thread James TD Smith
Hi Carsten, 

On 2008-10-22 11:18:59(+0200), Carsten Dominik wrote:
 this is a non-trivial patch, and  have not yet had the time to look at  
 it carefully.  And I am too close to the next release 6.10, which will  
 likely be the final version that will make it into Emacs 23, so I do  
 not feel comfortable to add it now.  After 6.10, good chances, yes.
 
 You can help by stress testing it, so that we can find bugs even  
 before we install it.

I've already noticed a few minor problems, and will be posting a revised version
of the patch soon, so keeping it out of 6.10 is probably best.

If you want, I will split out the patch into three smaller patches; the
changelog corrections, resuming clocking from an open clock line on clocking in,
and saving/restoring `org-clock-history' and the running clock. The changelog
corrections at least ought to make it into 6.10 :).

James

--
|-James TD Smith-email/[EMAIL PROTECTED]-|


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


[Orgmode] Timestamps and `org-table-copy-down'

2008-10-22 Thread James TD Smith
In a table column containing timestamps, pressing S-return with the cursor on
the brackets surrounding the timestamp results the insertion of a copy of the
timestamp with the active status toggled. Repeated a few times you end
up with this:

,
| | Date |
| |--|
| | [2008-10-15 Wed] |
| | 2008-10-15 Wed |
| | [2008-10-15 Wed] |
| | 2008-10-15 Wed |
| | [2008-10-15 Wed] |
| | 2008-10-15 Wed |
`

Is this supposed to happen? The documentation for `org-table-copy-down' mentions
incrementing the day/month/year but not changing the active/inactive state.

James

--
|-James TD Smith-email/[EMAIL PROTECTED]-|







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


[Orgmode] [PATCH] Allow storing clock status between emacs sessions.

2008-10-19 Thread James TD Smith
Clock-related data are saved when exiting emacs ands restored when emacs
is restarted. The data saved include the contents of `org-clock-history',
and the running clock, if there is one.

To use this, you will need to add

(require 'org-clock)
(org-clock-persistence-insinuate)

to your .emacs and either add

(setq org-clock-persist t)
(setq org-clock-in-resume t)

or set those options to t in custom.

The patch also optionally changes the behaviour of `org-clock-in'; if
`org-clock-in-resume' is set, and you clock into a task with an open
clock line, org will resume the clock from that time.

Also fix a couple of typos in the changelog
---
 lisp/ChangeLog|   31 +-
 lisp/org-clock.el |  117 +---
 2 files changed, 138 insertions(+), 10 deletions(-)
 mode change 100755 = 100644 lisp/ChangeLog

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
old mode 100755
new mode 100644
index ad7c9fe..8b836eb
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,27 @@
 2008-10-19  James TD Smith  [EMAIL PROTECTED]
 
+   * org-clock.el (org-clock-persist): Add a custom option to toggle
+   clock persistence.
+   (org-clock-persist-query-save): Add a custom option to toggle
+   asking the user if they want to save the running clock when
+   exiting.
+   (org-clock-persist-query-resume): Add a custom option to toggle
+   asking the user if they want to resume the saved clock when Emacs
+   is restarted.
+   (org-clock-save): Add a function to save clock data.
+   This includes the contents of `org-clock-history' and the buffer
+   and position of the currently clocked task, if any.
+   (org-clock-load): Add a function to load clock data.
+   This populates `org-clock-history', and resumes the saved clocked
+   task if there is one.
+   (org-clock-persistence-insinuate): Add a method to set up the
+   hooks for clock persistence.
+   (org-clock-in-resume): Add a custom option to toggle starting the
+   clock from an open clock line.
+   (org-clock-in): When clocking in to an entry, if
+   `org-clock-in-resume' is set, check if the first clock line is
+   open and if so, start the clock from the time in the clock line.
+
* org.el (org-add-log-setup): Bugfix; code to find insertion point
after drawers was skipping ahead one line too many, so notes were
inserted after the first note instead of before it.
@@ -21,7 +43,7 @@
* org.el (org-clock-update-time-maybe): Compute negative clock
intervals correctly.
 
-2008-10-15  James TD Smith  [EMAIL PROTECTED]
+2008-10-16  James TD Smith  [EMAIL PROTECTED]
 
* org.el (org-add-log-setup): Only skip drawers if the are
immediately after the scheduling keywords.
@@ -34,6 +56,9 @@
(org-clock-in): Use org-indent-line-function to indent clock lines.
(org-clock-find-position): Fix indentation of empty clock drawers.
 
+   * org.el (org-add-log-setup): Only skip drawers if the are
+   immediately after the scheduling keywords.
+
 2008-10-16  Carsten Dominik  [EMAIL PROTECTED]
 
* org.el (org-add-log-setup): Respect
@@ -125,7 +150,7 @@
* org-clock.el (org-clock-heading-for-remember): New variable.
(org-clock-in): Set `org-clock-heading-for-remember'.
 
-2008-10-01 James TD Smith  [EMAIL PROTECTED]
+2008-10-01  James TD Smith  [EMAIL PROTECTED]
 
* org-remember.el (org-remember-apply-template): Add new
expansions: %k, %K for currently clocked task and a link to the
@@ -234,7 +259,7 @@
 
* org-export-latex.el (org-export-latex-keywords-maybe): Bug fix.
 
-2008-09-22  James TA Smith  [EMAIL PROTECTED]
+2008-09-22  James TD Smith  [EMAIL PROTECTED]
 
* org-plot.el (org-plot/gnuplot): Make tables starting with a
hline work correctly.
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 56894cc..d932f02 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -95,6 +95,34 @@ The function is called with point at the beginning of the 
headline.
   :group 'org-clock
   :type 'integer)
 
+(defcustom org-clock-persist nil
+  When non-nil, save the running clock when emacs is closed, and
+  resume it next time emacs is started.
+  :group 'org-clock
+  :type 'boolean)
+
+(defcustom org-clock-persist-file ~/.emacs.d/org-clock-save.el
+  File to save clock data to
+  :group 'org-clock
+  :type 'string)
+
+(defcustom org-clock-persist-query-save nil
+  When non-nil, ask before saving the current clock on exit
+  :group 'org-clock
+  :type 'boolean)
+
+(defcustom org-clock-persist-query-resume t
+  When non-nil, ask before resuming any stored clock during
+load.
+  :group 'org-clock
+  :type 'boolean)
+
+(defcustom org-clock-in-resume nil
+  If non-nil, when clocking into a task with a clock entry which
+has not been closed, resume the clock from that point
+  :group 'org-clock
+  :type 'boolean)
+
 ;;; The clock for measuring

[Orgmode] [PATCH] Bugfix in org-add-log-setup.

2008-10-19 Thread James TD Smith
---
 lisp/ChangeLog |6 ++
 lisp/org.el|3 ++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 35ce9c3..ad7c9fe 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-19  James TD Smith  [EMAIL PROTECTED]
+
+   * org.el (org-add-log-setup): Bugfix; code to find insertion point
+   after drawers was skipping ahead one line too many, so notes were
+   inserted after the first note instead of before it.
+
 2008-10-18  Carsten Dominik  [EMAIL PROTECTED]
 
* org-table.el (orgtbl-to-html): Bind `html-table-tag' for the
diff --git a/lisp/org.el b/lisp/org.el
index 9c08ba4..85f138d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8407,7 +8407,8 @@ EXTRA is additional text that will be inserted into the 
notes buffer.
   (while (looking-at org-drawer-regexp)
 (goto-char (match-end 0))
 (re-search-forward org-property-end-re (point-max) t)
-(forward-line
+(forward-line))
+  (forward-line -1)))
(unless org-log-states-order-reversed
  (and (= (char-after) ?\n) (forward-char 1))
  (org-skip-over-state-notes)
-- 
1.5.6.5



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


Re: [Orgmode] Incompatible change in latest push

2008-10-16 Thread James TD Smith
Hi Carsten,

On 2008-10-16 06:55:02(+0200), Carsten Dominik wrote:
 Hi,

 after a request, I just added a new variable
 `org-log-state-notes-insert-after-drawers' with default nil.
 This means that state change notes are now by default
 inserted again *before* any drawers.  This was the
 original behaviour, which changed temporarily in version 6.08.

I'm trying to figure out why anyone would want this behaviour. I first noticed
it when the clock and properties drawers in some of my org entries seemed to
disappear. After working out what was going on I decided it was a bug and wrote
a patch to fix it.

It makes no sense to me for the drawers in an entry to be swallowed up by state
change notes. The drawers are not part of the entry, not the note, and should
remain outside of the note. While having the drawers in the notes does not stop
org from finding them, it does mean that you can't tell at a glance if an entry
has clocked times or properties set as the relevant drawers will be hidden in
one of the notes and not visible when the entry is first opened.

For example, say you have a task as below:

,
| * TODO Test
|   SCHEDULED: 2008-10-16 Wed +1d
|   :PROPERTIES:
|   :LOGGING:  lognoterepeat
|   :EFFORT:   2:00
|   :OtherProperty: fish
|   :END:
`

When the entry is initially opened it appear as below:

,
| * TODO Test
|   SCHEDULED: 2008-10-16 Wed +1d
|   :PROPERTIES:...
`

If filing notes before drawers is enabled, the first time this is marked done
the properties drawer will be included in the note, so the next time the user
looks at it they will see this:

,
| * TODO Test
|   SCHEDULED: 2008-10-17 Wed +1d
|   - State DONE   [2008-10-16 Thu 10:45]...
`
 
I imagine new org users will find it confusing when adding a note to an entry
makes their drawers appear to vanish. It confused me and I've been using org for
quite a while.

I have no problem with keeping this a configurable option so anyone who wants
the old behaviour can have it, but I think the default should be t.

James

--
|-James TD Smith-email/[EMAIL PROTECTED]-|






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


Re: [Orgmode] [PATCH 0/9] Update my last patchset

2008-09-21 Thread James TD Smith
On 2008-09-21 06:48:58(+0200), Carsten Dominik wrote:
 Hi James,
 
 bummer, I *did* forget about the previous patch series, thanks so much  
 for bringing it up again.

I had intended to remind you when you got back, but forgot about it. 
 
 I am frusrated with my git skills.  I did put all your patches into a  
 separate mailbox and then did git-am, which failed miserably.  Any  
 idea what I might be doing wrong?
 
 I can apply the patches all one by one, sort-off by hand, but I don't  
 like it.

I just tried applying the mailed patches to a fresh clone of the org repo, and
git-am worked fine, so the patches are OK.  

After some googling, it appears Apple Mail has used a proprietary format for
storing mail since version 2, which git-am cannot read.  

There are instructions to get it to export messages to an mbox file, which git
am will read, here: 
http://www.macosxhints.com/article.php?story=20060706201156481 

Hope this helps

James

--
|-James TD Smith-email/[EMAIL PROTECTED]-|


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


[Orgmode] [PATCH 0/9] Update my last patchset

2008-09-20 Thread James TD Smith
I've updated my last patchset so it applies to the current version, and added a
few more patches I have written since then.

The following series implements...

---

James TD Smith (9):
  Some bugfixes for org-plot.
  Add a % expansion for inserting properties in remember buffers.
  Add some new interaction between remember and clocked tasks
  Add some functions for handling checklists.
  Fix note insertion in entries with drawers.
  Fix link display in imenus and the refile interface
  Show durations of clocked times in timeline
  Fix X clipboard handling in emacs21
  Some improvements to the modeline clock display


 contrib/ChangeLog |5 ++
 contrib/lisp/org-checklist.el |  110 +
 lisp/ChangeLog|   55 ++---
 lisp/org-agenda.el|   14 +++--
 lisp/org-clock.el |   36 ++---
 lisp/org-compat.el|   13 -
 lisp/org-plot.el  |   13 +++--
 lisp/org-remember.el  |   67 +
 lisp/org.el   |   51 ---
 9 files changed, 292 insertions(+), 72 deletions(-)
 create mode 100644 contrib/lisp/org-checklist.el

-- 
|-James TD Smith-email/[EMAIL PROTECTED]-|


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


[Orgmode] [PATCH 1/9] Some improvements to the modeline clock display

2008-09-20 Thread James TD Smith
Allow users to specify a maximum length for the modeline clock. Add an option to
limit the length of the clock string in the modeline. When the limit is in
effect, the full item text is included in the tooltip on the clock string.

Make clicking on the clock string now goes to the currently clocked item.
---

 lisp/ChangeLog|   29 +++--
 lisp/org-clock.el |   36 ++--
 2 files changed, 37 insertions(+), 28 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3a57ca8..5eb535f 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
+2008-09-20  James TD Smith  [EMAIL PROTECTED]
+
+   * lisp/org-clock.el (org-update-mode-line): Support limiting the
+   modeline clock string, and display the full todo value in the
+   tooltip. Set a local keymap so mouse-3 on the clock string goes to
+   the currently clocked task.
+   (org-clock-string-limit): Add a custom value for the maximum
+   length of the clock string in the modeline.
+   (org-clock-mode-map): Add a keymap for the modeline string
+
 2008-09-20  Bastien Guerry  [EMAIL PROTECTED]
 
* org-export-latex.el (org-export-latex-tables): protect exported
@@ -215,16 +225,6 @@
 
* org.el (org-columns-modify-value-for-display-function): New option.
 
-
-
-
-
-
-
-
-
-
-
* org-publish.el (org-publish-file): Make sure the directory match
for the publishing directory works correctly.
 
@@ -238,13 +238,6 @@
 
* org.el (org-autoload): Add `org-dblock-write:columnview'.
 
-
-
-
-
-
-
-
 2008-07-23  Carsten Dominik  [EMAIL PROTECTED]
 
* org-exp.el (org-export-region-as-html, org-export-as-html): Make
@@ -255,7 +248,7 @@
 
* org-agenda.el (org-batch-store-agenda-views): Fix parsing bug.
 
-2008-07-20  Juri Linkov [EMAIL PROTECTED]
+2008-07-20  Juri Linkov  [EMAIL PROTECTED]
 
* org.el (narrow-map): Bind `org-narrow-to-subtree' to s on the
new keymap `narrow-map' instead of binding \C-xns.
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index f2f49a8..4d2069c 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -86,6 +86,10 @@ The function is called with point at the beginning of the 
headline.
   :group 'org-clock
   :type 'function)
 
+(defcustom org-clock-string-limit 0
+  Maximum length of clock strings in the modeline. 0 means no limit
+  :group 'org-clock
+  :type 'integer)
 
 ;;; The clock for measuring work time.
 
@@ -107,6 +111,9 @@ of a different task.)
 (defvar org-clock-interrupted-task (make-marker)
   Marker pointing to the task that has been interrupted by the current 
clock.)
 
+(defvar org-clock-mode-map (make-sparse-keymap))
+(define-key org-clock-mode-map [mode-line mouse-2] 'org-clock-goto)
+
 (defun org-clock-history-push (optional pos buffer)
   Push a marker to the clock history.
   (setq org-clock-history-length (max 1 (min 35 org-clock-history-length)))
@@ -190,15 +197,23 @@ of a different task.)
   (when (and cat task)
(insert (format [%c] %-15s %s\n i cat task))
(cons i marker)
-  
+
 (defun org-update-mode-line ()
   (let* ((delta (- (time-to-seconds (current-time))
-   (time-to-seconds org-clock-start-time)))
+  (time-to-seconds org-clock-start-time)))
 (h (floor delta 3600))
 (m (floor (- delta (* 3600 h)) 60)))
 (setq org-mode-line-string
- (propertize (format (concat -[ org-time-clocksum-format  (%s)]) h 
m org-clock-heading)
- 'help-echo Org-mode clock is running))
+ (propertize (let ((clock-string (format (concat -[ 
org-time-clocksum-format  (%s)])
+ h m org-clock-heading))
+   (help-text Org-mode clock is running))
+   (if (and ( org-clock-string-limit 0)
+( (length clock-string) 
org-clock-string-limit))
+   (propertize (substring clock-string 0 
org-clock-string-limit)
+   'help-echo (concat help-text :  
org-clock-heading))
+ (propertize clock-string 'help-echo help-text)))
+ 'local-map org-clock-mode-map
+ 'mouse-face '(face mode-line-highlight)))
 (force-mode-line-update)))
 
 (defvar org-clock-mode-line-entry nil
@@ -253,12 +268,13 @@ the clocking selection, associated with the letter `d'.
  org-clock-in-switch-to-state
  \\
(org-todo org-clock-in-switch-to-state))
- (if (and org-clock-heading-function
-  (functionp org-clock-heading-function))
- (setq org-clock-heading (funcall org-clock-heading-function))
-   (if (looking-at org-complex-heading-regexp)
-   (setq org-clock-heading (match-string 4))
- (setq org-clock-heading

[Orgmode] [PATCH 2/9] Fix X clipboard handling in emacs21

2008-09-20 Thread James TD Smith
Add a new function to org-compat to fetch clipboard values in emacs21 and
xemacs.

Use this function to fetch the clipboard when x-selection-value is unavailable.
---

 lisp/ChangeLog   |9 +
 lisp/org-compat.el   |   13 -
 lisp/org-remember.el |   12 ++--
 lisp/org.el  |2 +-
 4 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5eb535f..bcefdab 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,14 @@
 2008-09-20  James TD Smith  [EMAIL PROTECTED]
 
+   * org-compat.el (org-get-x-clipboard-compat): Add a compat
+   function for fetching the X clipboard on XEmacs and GNU Emacs 21.
+
+   * org-remember.el (org-get-x-clipboard): Use the compat
+   function to get clipboard values when x-selection-value is
+   unavailable. Use substring-no-properties instead of
+   set-text-properties to remove text properties from the clipboard
+   value.
+
* lisp/org-clock.el (org-update-mode-line): Support limiting the
modeline clock string, and display the full todo value in the
tooltip. Set a local keymap so mouse-3 on the clock string goes to
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 1f38b52..24693c8 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -245,7 +245,18 @@ that can be added.
  (set-extent-property (car ext-inv-spec) 'invisible
  (cadr ext-inv-spec
(move-to-column column force)))
- 
+
+(defun org-get-x-clipboard-compat (value)
+  Get the clipboard value on XEmacs or Emacs 21
+  (cond (org-xemacs-p (org-no-warnings (get-selection-no-error value)))
+   ((fboundp 'x-get-selection)
+(condition-case nil
+(or (x-get-selection value 'UTF8_STRING)
+(x-get-selection value 'COMPOUND_TEXT)
+(x-get-selection value 'STRING)
+(x-get-selection value 'TEXT))
+  (error nil)
+
 (provide 'org-compat)
 
 ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index e056123..c1828e6 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -301,13 +301,13 @@ RET at beg-of-buf - Append to file as level 2 headline
   (cddr (assoc char templates)
 
 (defun org-get-x-clipboard (value)
-  Get the value of the x clibboard, in a way that also works with XEmacs.
+  Get the value of the x clibboard, in a way that works on XEmacs, and GNU
+Emacs 21
   (if (eq window-system 'x)
-  (let ((x (if org-xemacs-p
-  (org-no-warnings (get-selection-no-error value))
-(and (fboundp 'x-selection-value)
- (x-selection-value value)
-   (and ( (length x) 0) (set-text-properties 0 (length x) nil x) x
+  (let ((x ;;(if (fboundp 'x-selection-value)
+   ;;   (x-selection-value value)
+(org-get-x-clipboard-compat value)));)
+   (if x (substring-no-properties x)
 
 ;;;###autoload
 (defun org-remember-apply-template (optional use-char skip-interactive)
diff --git a/lisp/org.el b/lisp/org.el
index 297a410..cdbe7bb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7016,7 +7016,7 @@ If `org-make-link-description-function' is non-nil, this 
function will be
 called with the link target, and the result will be the default
 link description.
 
-If the LINK-LOCATION parameter is non-nil, this value will be
+If the `LINK-LOCATION' parameter is non-nil, this value will be
 used as the link location instead of reading one interactively.
   (interactive P)
   (let* ((wcf (current-window-configuration))



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


[Orgmode] [PATCH 4/9] Fix link display in imenus and the refile interface

2008-09-20 Thread James TD Smith
Replace links with their descriptions in when generating the items for imenus
and the refile interface.
---

 lisp/ChangeLog |4 
 lisp/org.el|8 +++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3896ddf..b52700d 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
 2008-09-20  James TD Smith  [EMAIL PROTECTED]
 
+   * org.el (org-get-refile-targets): Replace links with their
+   descriptions
+   (org-imenu-get-tree): Replace links with their descriptions
+
* org-agenda.el (org-agenda-get-closed): show durations of clocked
items as well as the start and end times.
 
diff --git a/lisp/org.el b/lisp/org.el
index cdbe7bb..99b62d0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7866,7 +7866,10 @@ on the system \/[EMAIL PROTECTED]:\.
(while (re-search-forward descre nil t)
  (goto-char (point-at-bol))
  (when (looking-at org-complex-heading-regexp)
-   (setq txt (match-string 4)
+   (setq txt (save-match-data
+   (replace-regexp-in-string
+org-bracket-link-analytic-regexp \\5
+(match-string 4)))
  re (concat ^ (regexp-quote
  (buffer-substring (match-beginning 1)
(match-end 4)
@@ -14673,6 +14676,9 @@ Show the heading too, if it is currently invisible.
(looking-at org-complex-heading-regexp)
(setq head (org-match-string-no-properties 4)
  m (org-imenu-new-marker))
+   (setq head (replace-regexp-in-string
+   org-bracket-link-analytic-regexp
+   \\5 head))
(org-add-props head nil 'org-imenu-marker m 'org-imenu t)
(if (= level last-level)
(push (cons head m) (aref subs level))



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


[Orgmode] [PATCH 6/9] Add some functions for handling checklists.

2008-09-20 Thread James TD Smith
Add a module to contrib for handling repeated tasks which require checking off a
list of items.
---

 contrib/ChangeLog |5 ++
 contrib/lisp/org-checklist.el |  110 +
 2 files changed, 115 insertions(+), 0 deletions(-)
 create mode 100644 contrib/lisp/org-checklist.el

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index c49e4b4..195f2b3 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-20  James TD Smith  [EMAIL PROTECTED]
+
+   * lisp/org-checklist.el: Add various checklist handling functions
+
 2008-09-02  Carsten Dominik  [EMAIL PROTECTED]
 
* lisp/org-mairix.el: Update to version 0.5.
@@ -12,6 +16,7 @@
* lisp/org-mtags.el (org-mtags-replace): Allow prefix and prefix1
as options in the include directive.
 
+
 2008-06-18  Christian Egli  [EMAIL PROTECTED]
 
* scripts/org2hpda (DIARY): Make the location of the diary file
diff --git a/contrib/lisp/org-checklist.el b/contrib/lisp/org-checklist.el
new file mode 100644
index 000..09ff911
--- /dev/null
+++ b/contrib/lisp/org-checklist.el
@@ -0,0 +1,110 @@
+;;; org-checklist.el --- org functions for checklist handling
+;;
+;; ©2008 James TD Smith
+;;
+;; Author: James TD Smith (@ ahktenzero (. mohorovi cc))
+;; Version: 1.0
+;; Keywords: org, checklists
+;;
+;; 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 this program; if not, write to the Free Software
+;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+;;
+;;; Commentary:
+;; This file provides some functions for handing repeated tasks which involve
+;; checking off a list of items. By setting the RESET_CHECK_BOXES property in 
an
+;; item, when the TODO state is set to done all checkboxes under that item are
+;; cleared. If the LIST_EXPORT_BASENAME property is set, a file will be created
+;; using the value of that property plus a timestamp, containing all the items
+;; in the list which are not checked. Additionally the user will be prompted to
+;; print the list.
+;;
+;; I use this for to keep track of stores of various things (food stores,
+;; components etc) which I check periodically and use the exported list of 
items
+;; which are not present as a shopping list.
+;;
+;;; Usage:
+;; (require 'org-checklist)
+;;
+;; Set the RESET_CHECK_BOXES and LIST_EXPORT_BASENAME properties in items as
+;; needed.
+;;
+;;; Code:
+(require 'org)
+
+(defvar export-time-format %Y%m%d%H%M
+  format of timestamp appended to export file)
+(defvar export-function 'org-export-as-ascii
+  function used to prepare the export file for printing)
+
+(defun org-reset-checkbox-state-maybe ()
+  Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set
+  (interactive *)
+  (if (org-entry-get (point) RESET_CHECK_BOXES)
+  (save-restriction
+   (save-excursion
+ (org-narrow-to-subtree)
+ (org-show-subtree)
+ (goto-char (point-min))
+ (let ((end (point-max)))
+   (while ( (point) end)
+ (when (org-at-item-checkbox-p)
+   (replace-match [ ] t t))
+ (beginning-of-line 2
+   (org-update-checkbox-count-maybe
+
+(defun org-make-checklist-export ()
+  Produce a checklist containing all unchecked items from a list
+of checkbox items
+  (interactive *)
+  (if (org-entry-get (point) LIST_EXPORT_BASENAME)
+  (let* ((export-file (concat (org-entry-get (point) 
LIST_EXPORT_BASENAME)
+ - (format-time-string export-time-format)
+ .org))
+exported-lines
+title)
+   (save-restriction
+ (save-excursion
+   (org-narrow-to-subtree)
+   (org-show-subtree)
+   (goto-char (point-min))
+   (if (looking-at org-complex-heading-regexp)
+   (setq title (match-string 4)))
+   (goto-char (point-min))
+   (let ((end (point-max)))
+ (while ( (point) end)
+   (when (and (org-at-item-checkbox-p)
+  (or (string= (match-string 0) [ ])
+  (string= (match-string 0) [-])))
+ (add-to-list 'exported-lines (thing-at-point 'line) t))
+   (beginning-of-line 2)))
+   (set-buffer (get-buffer-create export-file))
+   (org-insert-heading)
+   (insert (or title export-file) \n)
+   (dolist (entry exported-lines

[Orgmode] [PATCH 7/9] Add some new interaction between remember and clocked tasks

2008-09-20 Thread James TD Smith
Add % expansion. This tells org-remember to add the item to the currently
clocked task. Often while I'm working on something I find other related things
which need to be done and this makes it possible to use a remember template to
add a TODO item in the right place.

Add %l expansion for the current clock string.
Add %L expansion for a link to the currently clocked task.
---

 lisp/ChangeLog   |5 +
 lisp/org-remember.el |   38 ++
 2 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1753881..0b40a6e 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
 2008-09-20  James TD Smith  [EMAIL PROTECTED]
 
+   * org-remember.el (org-remember-apply-template): Add new
+   expansions: %k, %K for currently clocked task and a link to the
+   currently clocked task, and % to file notes in the currently
+   clocked task.
+
* org.el (org-get-refile-targets): Replace links with their
descriptions
(org-imenu-get-tree): Replace links with their descriptions
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index c1828e6..5a2c69b 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -135,11 +135,15 @@ Furthermore, the following %-escapes will be replaced 
with content:
   %^L Like %^C, but insert as link
   %^g prompt for tags, with completion on tags in target file
   %^G prompt for tags, with completion all tags in all agenda files
+  %k  currently clocked task
+  %K  link to currently clocked task
+
   %:keyword   specific information for certain link types, see below
   %[pathname] insert the contents of the file given by `pathname'
   %(sexp) evaluate elisp `(sexp)' and replace with the result
   %!  Store this note immediately after filling the template
   %  Visit note immediately after storing it
+  %  file note under currently clocked task
 
   %?  After completing the template, position cursor here.
 
@@ -354,6 +358,13 @@ to be run from that hook to function properly.
  (replace-match [\\1[%^{Link description}]] nil nil v-a)
v-a))
 (v-n user-full-name)
+(v-k (if (marker-buffer org-clock-marker)
+ (substring-no-properties org-clock-heading)))
+(v-K (if (marker-buffer org-clock-marker)
+ (org-make-link-string
+  (buffer-file-name (marker-buffer org-clock-marker))
+  org-clock-heading)))
+v-I
 (org-startup-folded nil)
 (org-inhibit-startup t)
 org-time-was-given org-end-time-was-given x
@@ -363,6 +374,21 @@ to be run from that hook to function properly.
  (setq file (funcall file)))
(when (and file (not (file-name-absolute-p file)))
  (setq file (expand-file-name file org-directory)))
+
+   ;;handle the %^K file to clocked task indicator
+   (if (and v-k (string-match % tpl))
+   (setq file (buffer-file-name (marker-buffer org-clock-marker))
+ headline (with-current-buffer
+  (get-buffer (marker-buffer org-clock-marker))
+(goto-char (marker-position org-clock-marker))
+(org-back-to-heading t)
+(if (looking-at org-complex-heading-regexp)
+(concat (match-string 2)
+(if (match-string 2)  )
+(match-string 3)
+(if (match-string 3)  )
+(match-string 4))
+
(setq org-store-link-plist
  (append (list :annotation v-a :initial v-i)
  org-store-link-plist))
@@ -382,9 +408,14 @@ to be run from that hook to function properly.
  (or headline )
  (or (car org-remember-previous-location) ???)
  (or (cdr org-remember-previous-location) ???
-   (insert tpl) (goto-char (point-min))
+   (insert tpl)
+   (goto-char (point-min))
+   ;;Get rid of % if present
+   (while (re-search-forward % nil t)
+ (replace-match ))
+   (goto-char (point-min))
;; Simple %-escapes
-   (while (re-search-forward %\\([tTuUaiAcx]\\) nil t)
+   (while (re-search-forward %\\([tTuUaiAcxkKI]\\) nil t)
  (when (and initial (equal (match-string 0) %i))
(save-match-data
  (let* ((lead (buffer-substring
@@ -393,8 +424,7 @@ to be run from that hook to function properly.
 (org-split-string initial \n)
 (concat \n lead))
  (replace-match
-  (or (eval (intern (concat v- (match-string 1 )
-  t t

[Orgmode] [PATCH 8/9] Add a % expansion for inserting properties in remember buffers.

2008-09-20 Thread James TD Smith

---

 lisp/ChangeLog   |3 +++
 lisp/org-remember.el |   19 +--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0b40a6e..07872eb 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
 2008-09-20  James TD Smith  [EMAIL PROTECTED]
 
+   * org-remember.el (org-remember-apply-template): Add a new
+   expansion for adding properties to remember items.
+
* org-remember.el (org-remember-apply-template): Add new
expansions: %k, %K for currently clocked task and a link to the
currently clocked task, and % to file notes in the currently
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index 5a2c69b..0b435e0 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -137,7 +137,7 @@ Furthermore, the following %-escapes will be replaced with 
content:
   %^G prompt for tags, with completion all tags in all agenda files
   %k  currently clocked task
   %K  link to currently clocked task
-
+  %^{prop}p   Prompt the user for a value for property `prop'
   %:keyword   specific information for certain link types, see below
   %[pathname] insert the contents of the file given by `pathname'
   %(sexp) evaluate elisp `(sexp)' and replace with the result
@@ -468,7 +468,7 @@ to be run from that hook to function properly.
(org-set-local 'org-remember-default-headline headline))
;; Interactive template entries
(goto-char (point-min))
-   (while (re-search-forward %^\\({\\([^}]*\\)}\\)?\\([gGtTuUCL]\\)? nil 
t)
+   (while (re-search-forward %^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)? 
nil t)
  (setq char (if (match-end 3) (match-string 3))
prompt (if (match-end 2) (match-string 2)))
  (goto-char (match-beginning 0))
@@ -513,6 +513,21 @@ to be run from that hook to function properly.
   (car clipboards)
   '(clipboards . 1)
   (car clipboards))
+  ((equal char p)
+   (let* ((prop (substring-no-properties prompt))
+  (allowed (with-current-buffer
+   (get-buffer (file-name-nondirectory file))
+ (org-property-get-allowed-values nil prop 
'table)))
+  (existing (with-current-buffer
+(get-buffer (file-name-nondirectory file))
+  (mapcar 'list (org-property-values prop
+  (propprompt (concat Value for  prop : ))
+  (val (if allowed
+   (org-completing-read propprompt allowed nil
+'req-match)
+ (org-completing-read propprompt existing nil nil
+   nil 
+  (org-set-property prop val)))
   (char
;; These are the date/time related ones
(setq org-time-was-given (equal (upcase char) char))



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


[Orgmode] [PATCH 9/9] Some bugfixes for org-plot.

2008-09-20 Thread James TD Smith
* Handle tables where the first line is an hline.
* Put commas at the end of the line in generated scripts
---

 lisp/org-plot.el |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 874790c..f8e268d 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -218,7 +218,7 @@ NUM-COLS controls the number of columns plotted in a 2-d 
plot.
  (format \%s\ %d (cdr pair) (car pair)))
y-labels , 
   (case type ;; plot command
-   ('2d (dotimes (col num-cols) 
+   ('2d (dotimes (col num-cols)
   (unless (and (equal type '2d)
(or (and ind (equal (+ 1 col) ind))
(and deps (not (member (+ 1 col) deps)
@@ -239,11 +239,11 @@ NUM-COLS controls the number of columns plotted in a 2-d 
plot.
 (setq plot-lines (list (format '%s' with %s title ''
data-file with)
   (add-to-script
-   (concat plot-cmd   (mapconcat 'identity (reverse plot-lines) \\\n
,)))
+   (concat plot-cmd   (mapconcat 'identity (reverse plot-lines) ,\\\n   
 )))
   script)))
 
 ;;-
-;; facad functions
+;; facade functions
 ;;;###autoload
 (defun org-plot/gnuplot (optional params)
   Plot table using gnuplot. Gnuplot options can be specified with PARAMS.
@@ -255,11 +255,11 @@ line directly before or after the table.
 (delete-other-windows)
 (when (get-buffer *gnuplot*) ;; reset *gnuplot* if it already running
   (save-excursion
-   (set-buffer *gnuplot*) (goto-char (point-max)) 
+   (set-buffer *gnuplot*) (goto-char (point-max))
(gnuplot-delchar-or-maybe-eof nil)))
 (org-plot/goto-nearest-table)
 ;; set default options
-(mapc 
+(mapc
  (lambda (pair)
(unless (plist-member params (car pair))
 (setf params (plist-put params (car pair) (cdr pair)
@@ -267,7 +267,8 @@ line directly before or after the table.
 ;; collect table and table information
 (let* ((data-file (make-temp-file org-plot))
   (table (org-table-to-lisp))
-  (num-cols (length (first table
+  (num-cols (length (if (eq (first table) 'hline) (second table)
+  (first table)
   (while (equal 'hline (first table)) (setf table (cdr table)))
   (when (equal (second table) 'hline)
(setf params (plist-put params :labels (first table))) ;; headers to 
labels



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


Re: [Orgmode] Displaying images inline

2008-08-24 Thread James TD Smith
On 2008-08-24 18:54:37(+0300), Taru Karttunen wrote:
 On 24.08 09:21, Lindsay Todd wrote:
  Thank you!  I get the underline running right through the image, but
  that is tolerable.  This helps me.
 
 That comes from the org link. It can be removed by customizing the
 link face used by org-mode.

This will get rid of the underline whilst using iimage:. 

(defun ahkt-toggle-iimage-in-org ()
  (interactive)
  (if (face-underline-p 'org-link)
  (set-face-underline-p 'org-link nil)
  (set-face-underline-p 'org-link t))
  (iimage-mode))

(define-key org-mode-map [(control c) ?i] 'ahkt-toggle-iimage-in-org)

--
|-James TD Smith-email/[EMAIL PROTECTED]-|



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


Re: [Orgmode] Displaying images inline

2008-08-22 Thread James TD Smith
On 2008-08-22 17:52:46(-0400), Lindsay Todd wrote:
 Is there a way to link to a file containing an image, and have the
 image display inline in org-mode?  I know that if the org file is
 exported to HTML, it can be done so that the HTML file displays the
 image inline -- but I'd kind of like to be able to see the linked
 images from the org file itself, much like I can do with a muse file.
 (Although if there were a file-wide property to control whether or not
 that happens, it would be nice -- I could see maybe wanting to never
 inline in some files.)

You can do this using iimage; add the following to your .emacs:

;;iimage
(require 'iimage)
(setq iimage-mode-image-search-path (expand-file-name ~/))
;;Match org file: links
(add-to-list 'iimage-mode-image-regex-alist
 (cons (concat \\[\\[file:\\(~? iimage-mode-image-filename-regex
   \\)\\])  1))
(define-key org-mode-map [(control c) ?i] 'iimage-mode)

You can then toggle inline display of images in an org buffer using C-c i.

--
|-James TD Smith-email/[EMAIL PROTECTED]-|


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


Re: [Orgmode] graphing from org-tables

2008-07-25 Thread James TD Smith
On 2008-07-25 08:53:31(-0700), Eric Schulte wrote:
 
 Any advice for quick graphing of a table in org-mode?
 

I have a setup for plotting data from tables. I'm not sure if it's exactly what
you want, but yoy may find it useful.

1. Add the following to your .emacs:

(defun ahkt-plot-table (script)
  util function to export and plot a table using the supplied
gnuplot `script'
  (org-table-export)
  (let ((cbuf (current-buffer))
(cwin (selected-window)))
(save-restriction
  (save-excursion
(find-file script)
(gnuplot-send-buffer-to-gnuplot)
(bury-buffer)
(bury-buffer (get-buffer *gnuplot*
(and (window-live-p cwin) (select-window cwin))
(switch-to-buffer cbuf)
(delete-other-windows)))

2. Create a gnuplot script which plots data from a file.

3. Add the following properties to the headline containing the table.
TABLE_EXPORT_FILE filename in the gnuploy script
TABLE_EXPORT_FORMAT orgtbl-to-generic :skip 4 :splice t :sep \t

4. Add an org link in the table (it must be in the table otherwise the export
doesn't work) as below:
[[elisp:(ahkt-plot-table gnuplot script)][plot table]] 

I suggest you put it at the top of the table.
You will then need to adjust the 'skip' parameter in the export format depending
on the number of lines at the top of the table which should not be exported
(hlines, more than one plotting link etc). 

5. You should then be able to open the link, and get a plot of the table
contents.


--
|-James TD Smith-email/[EMAIL PROTECTED]-|


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


[Orgmode] [PATCH 2/7] Fix X clipboard handling in emacs21

2008-07-24 Thread James TD Smith
Add a new function to org-compat to fetch clipboard values in emacs21 and
xemacs.

Use this function to fetch the clipboard when x-selection-value is unavailable.
---

 lisp/ChangeLog   |9 +
 lisp/org-compat.el   |   13 -
 lisp/org-remember.el |   12 ++--
 lisp/org.el  |2 +-
 4 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 903aa8c..c81a049 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,14 @@
 2008-07-25  James TD Smith  [EMAIL PROTECTED]
 
+   * org-compat.el (org-get-x-clipboard-compat): Add a compat
+   function for fetching the X clipboard on XEmacs and GNU Emacs 21.
+
+   * org-remember.el (org-get-x-clipboard): Use the compat
+   function to get clipboard values when x-selection-value is
+   unavailable. Use substring-no-properties instead of
+   set-text-properties to remove text properties from the clipboard
+   value.
+
* lisp/org-clock.el (org-update-mode-line): Support limiting the
modeline clock string, and display the full todo value in the
tooltip. Set a local keymap so mouse-3 on the clock string goes to
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 0ba1dcc..3447a06 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -245,7 +245,18 @@ that can be added.
  (set-extent-property (car ext-inv-spec) 'invisible
  (cadr ext-inv-spec
(move-to-column column force)))
- 
+
+(defun org-get-x-clipboard-compat (value)
+  Get the clipboard value on XEmacs or Emacs 21
+  (cond (org-xemacs-p (org-no-warnings (get-selection-no-error value)))
+   ((fboundp 'x-get-selection)
+(condition-case nil
+(or (x-get-selection value 'UTF8_STRING)
+(x-get-selection value 'COMPOUND_TEXT)
+(x-get-selection value 'STRING)
+(x-get-selection value 'TEXT))
+  (error nil)
+
 (provide 'org-compat)
 
 ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index 2bbb20e..8399f3d 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -300,13 +300,13 @@ RET at beg-of-buf - Append to file as level 2 headline
   (cddr (assoc char templates)
 
 (defun org-get-x-clipboard (value)
-  Get the value of the x clibboard, in a way that also works with XEmacs.
+  Get the value of the x clibboard, in a way that works on XEmacs, and GNU
+Emacs 21
   (if (eq window-system 'x)
-  (let ((x (if org-xemacs-p
-  (org-no-warnings (get-selection-no-error value))
-(and (fboundp 'x-selection-value)
- (x-selection-value value)
-   (and ( (length x) 0) (set-text-properties 0 (length x) nil x) x
+  (let ((x ;;(if (fboundp 'x-selection-value)
+   ;;   (x-selection-value value)
+(org-get-x-clipboard-compat value)));)
+   (if x (substring-no-properties x)
 
 ;;;###autoload
 (defun org-remember-apply-template (optional use-char skip-interactive)
diff --git a/lisp/org.el b/lisp/org.el
index 7a5be1f..77a859b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6890,7 +6890,7 @@ If `org-make-link-description-function' is non-nil, this 
function will be
 called with the link target, and the result will be the default
 link description.
 
-If the LINK-LOCATION parameter is non-nil, this value will be
+If the `LINK-LOCATION' parameter is non-nil, this value will be
 used as the link location instead of reading one interactively.
   (interactive P)
   (let* ((wcf (current-window-configuration))



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


[Orgmode] [PATCH 1/7] Some improvements to the modeline clock display

2008-07-24 Thread James TD Smith
Allow users to specify a maximum length for the modeline clock. Add an option to
limit the length of the clock string in the modeline. When the limit is in
effect, the full item text is included in the tooltip on the clock string.

Make clicking on the clock string now goes to the currently clocked item.
---

 lisp/ChangeLog|   17 ++---
 lisp/org-clock.el |   36 ++--
 2 files changed, 36 insertions(+), 17 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4571cb4..903aa8c 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
+2008-07-25  James TD Smith  [EMAIL PROTECTED]
+
+   * lisp/org-clock.el (org-update-mode-line): Support limiting the
+   modeline clock string, and display the full todo value in the
+   tooltip. Set a local keymap so mouse-3 on the clock string goes to
+   the currently clocked task.
+   (org-clock-string-limit): Add a custom value for the maximum
+   length of the clock string in the modeline.
+   (org-clock-mode-map): Add a keymap for the modeline string
+
 2008-07-24  Carsten Dominik  [EMAIL PROTECTED]
 
* org-exp.el (org-export-as-html): Add attributes also in mailto
@@ -5,13 +15,6 @@
 
* org.el (org-autoload): Add `org-dblock-write:columnview'.
 
-
-
-
-
-
-
-
 2008-07-23  Carsten Dominik  [EMAIL PROTECTED]
 
* org-exp.el (org-export-region-as-html, org-export-as-html): Make
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 6caf839..6d49906 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -86,6 +86,10 @@ The function is called with point at the beginning of the 
headline.
   :group 'org-clock
   :type 'function)
 
+(defcustom org-clock-string-limit 0
+  Maximum length of clock strings in the modeline. 0 means no limit
+  :group 'org-clock
+  :type 'integer)
 
 ;;; The clock for measuring work time.
 
@@ -107,6 +111,9 @@ of a different task.)
 (defvar org-clock-interrupted-task (make-marker)
   Marker pointing to the task that has been interrupted by the current 
clock.)
 
+(defvar org-clock-mode-map (make-sparse-keymap))
+(define-key org-clock-mode-map [mode-line mouse-2] 'org-clock-goto)
+
 (defun org-clock-history-push (optional pos buffer)
   Push a marker to the clock history.
   (setq org-clock-history-length (max 1 (min 35 org-clock-history-length)))
@@ -190,15 +197,23 @@ of a different task.)
   (when (and cat task)
(insert (format [%c] %-15s %s\n i cat task))
(cons i marker)
-  
+
 (defun org-update-mode-line ()
   (let* ((delta (- (time-to-seconds (current-time))
-   (time-to-seconds org-clock-start-time)))
+  (time-to-seconds org-clock-start-time)))
 (h (floor delta 3600))
 (m (floor (- delta (* 3600 h)) 60)))
 (setq org-mode-line-string
- (propertize (format (concat -[ org-time-clocksum-format  (%s)]) h 
m org-clock-heading)
- 'help-echo Org-mode clock is running))
+ (propertize (let ((clock-string (format (concat -[ 
org-time-clocksum-format  (%s)])
+ h m org-clock-heading))
+   (help-text Org-mode clock is running))
+   (if (and ( org-clock-string-limit 0)
+( (length clock-string) 
org-clock-string-limit))
+   (propertize (substring clock-string 0 
org-clock-string-limit)
+   'help-echo (concat help-text :  
org-clock-heading))
+ (propertize clock-string 'help-echo help-text)))
+ 'local-map org-clock-mode-map
+ 'mouse-face '(face mode-line-highlight)))
 (force-mode-line-update)))
 
 (defvar org-clock-mode-line-entry nil
@@ -253,12 +268,13 @@ the clocking selection, associated with the letter `d'.
  org-clock-in-switch-to-state
  \\
(org-todo org-clock-in-switch-to-state))
- (if (and org-clock-heading-function
-  (functionp org-clock-heading-function))
- (setq org-clock-heading (funcall org-clock-heading-function))
-   (if (looking-at org-complex-heading-regexp)
-   (setq org-clock-heading (match-string 4))
- (setq org-clock-heading ???)))
+ (setq org-clock-heading
+   (cond ((and org-clock-heading-function
+   (functionp org-clock-heading-function))
+  (funcall org-clock-heading-function))
+ ((looking-at org-complex-heading-regexp)
+  (match-string 4))
+ (t ???)))
  (setq org-clock-heading (propertize org-clock-heading 'face nil))
  (org-clock-find-position)
  



___
Emacs-orgmode mailing list
Remember: use `Reply All

[Orgmode] [PATCH 3/7] Show durations of clocked times in timeline

2008-07-24 Thread James TD Smith
In the timeline display in the agenda, show the length of time clocked as well
as the start and end times.
---

 lisp/ChangeLog |3 +++
 lisp/org-agenda.el |   14 --
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c81a049..e63503a 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
 2008-07-25  James TD Smith  [EMAIL PROTECTED]
 
+   * org-agenda.el (org-agenda-get-closed): show durations of clocked
+   items as well as the start and end times.
+
* org-compat.el (org-get-x-clipboard-compat): Add a compat
function for fetching the X clipboard on XEmacs and GNU Emacs 21.
 
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 23cda50..2f07535 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3325,7 +3325,7 @@ the documentation of `org-diary'.
(list 0 0 0 (nth 1 date) (car date) (nth 2 date
1 11
 marker hdmarker priority category tags closedp
-ee txt timestr rest)
+ee txt timestr rest clocked)
 (goto-char (point-min))
 (while (re-search-forward regexp nil t)
   (catch :skip
@@ -3341,10 +3341,11 @@ the documentation of `org-diary'.
  (setq rest (substring timestr (match-end 0))
timestr (substring timestr 0 (match-end 0)))
  (if (and (not closedp)
-  (string-match \\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\] rest))
- (setq timestr (concat (substring timestr 0 -1)
-   - (match-string 1 rest) ]
-   
+  (string-match 
\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\].*\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\) rest))
+ (progn (setq timestr (concat (substring timestr 0 -1)
+  - (match-string 1 rest) ]))
+(setq clocked (match-string 2 rest)))
+   (setq clocked -)))
(save-excursion
  (if (re-search-backward ^\\*+  nil t)
  (progn
@@ -3353,7 +3354,8 @@ the documentation of `org-diary'.
  tags (org-get-tags-at))
(looking-at \\*+[ \t]+\\([^\r\n]+\\))
(setq txt (org-format-agenda-item
-  (if closedp Closed: Clocked:   )
+  (if closedp Closed:
+(concat Clocked:   ( clocked  )))
   (match-string 1) category tags timestr)))
(setq txt org-agenda-no-heading-message))
  (setq priority 10)



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


[Orgmode] [PATCH 4/7] Fix link display in imenus and the refile interface

2008-07-24 Thread James TD Smith
Replace links with their descriptions in when generating the items for imenus
and the refile interface.
---

 lisp/ChangeLog |4 
 lisp/org.el|8 +++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e63503a..ea6e60e 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
 2008-07-25  James TD Smith  [EMAIL PROTECTED]
 
+   * org.el (org-get-refile-targets): Replace links with their
+   descriptions
+   (org-imenu-get-tree): Replace links with their descriptions
+
* org-agenda.el (org-agenda-get-closed): show durations of clocked
items as well as the start and end times.
 
diff --git a/lisp/org.el b/lisp/org.el
index 77a859b..cbce370 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7740,7 +7740,10 @@ on the system \/[EMAIL PROTECTED]:\.
(while (re-search-forward descre nil t)
  (goto-char (point-at-bol))
  (when (looking-at org-complex-heading-regexp)
-   (setq txt (match-string 4)
+   (setq txt (save-match-data
+   (replace-regexp-in-string
+org-bracket-link-analytic-regexp \\5
+(match-string 4)))
  re (concat ^ (regexp-quote
  (buffer-substring (match-beginning 1)
(match-end 4)
@@ -14470,6 +14473,9 @@ Show the heading too, if it is currently invisible.
(looking-at org-complex-heading-regexp)
(setq head (org-match-string-no-properties 4)
  m (org-imenu-new-marker))
+   (setq head (replace-regexp-in-string
+   org-bracket-link-analytic-regexp
+   \\5 head))
(org-add-props head nil 'org-imenu-marker m 'org-imenu t)
(if (= level last-level)
(push (cons head m) (aref subs level))



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


[Orgmode] [PATCH 5/7] Fix note insertion in entries with drawers.

2008-07-24 Thread James TD Smith
The code to find the insertion point after a heading for notes was not skipping
over drawers, resulting in notes being added inbetween the scheduling keywords
and the first drawer. Notes are now inserted after any drawers in an item.
---

 lisp/ChangeLog |2 ++
 lisp/org.el|   43 ---
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ea6e60e..d072d40 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,8 @@
* org.el (org-get-refile-targets): Replace links with their
descriptions
(org-imenu-get-tree): Replace links with their descriptions
+   (org-add-log-setup): Skip over drawers (properties, clocks etc)
+   when adding notes.
 
* org-agenda.el (org-agenda-get-closed): show durations of clocked
items as well as the start and end times.
diff --git a/lisp/org.el b/lisp/org.el
index cbce370..97e0d03 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8444,10 +8444,10 @@ For calling through lisp, arg is also interpreted in 
the following way:
;; It is now done, and it was not done before
(org-add-planning-info 'closed (org-current-time))
(if (and (not dolog) (eq 'note org-log-done))
-   (org-add-log-setup 'done state 'findpos 'note)))
+   (org-add-log-setup 'done state t 'note)))
  (when (and state dolog)
;; This is a non-nil state, and we need to log it
-   (org-add-log-setup 'state state 'findpos dolog)))
+   (org-add-log-setup 'state state t dolog)))
;; Fixup tag positioning
(and org-auto-align-tags (not org-setting-tags) (org-set-tags nil t))
(when org-provide-todo-statistics
@@ -8681,7 +8681,7 @@ This function is run automatically after each state 
change to a DONE state.
(setq org-log-note-how 'note))
  ;; Set up for taking a record
  (org-add-log-setup 'state (or done-word (car org-done-keywords))
-'findpos org-log-repeat)))
+t org-log-repeat)))
   (org-back-to-heading t)
   (org-add-planning-info nil nil 'closed)
   (setq re (concat \\( org-scheduled-time-regexp \\)\\|\\(
@@ -8908,22 +8908,27 @@ This is done in the same way as adding a state change 
note.
 If this is about to TODO state change, the new state is expected in STATE.
 When FINDPOS is non-nil, find the correct position for the note in
 the current entry.  If not, assume that it can be inserted at point.
-  (save-excursion
-(when findpos
-  (org-back-to-heading t)
-  (looking-at (concat outline-regexp \\( *\\)[^\r\n]*
- \\(\n[^\r\n]*? org-keyword-time-not-clock-regexp
- [^\r\n]*\\)?))
-  (goto-char (match-end 0))
-  (unless org-log-states-order-reversed
-   (and (= (char-after) ?\n) (forward-char 1))
-   (org-skip-over-state-notes)
-   (skip-chars-backward  \t\n\r)))
-(move-marker org-log-note-marker (point))
-(setq org-log-note-purpose purpose
- org-log-note-state state
- org-log-note-how how)
-(add-hook 'post-command-hook 'org-add-log-note 'append)))
+  (save-restriction
+(save-excursion
+  (when findpos
+   (org-back-to-heading t)
+   (org-narrow-to-subtree)
+   (looking-at (concat outline-regexp \\( *\\)[^\r\n]*
+   \\(\n[^\r\n]*? org-keyword-time-not-clock-regexp
+   [^\r\n]*\\)?))
+   (goto-char (match-end 0))
+   (while (re-search-forward
+   (concat \\( org-drawer-regexp \\| org-property-end-re \\))
+   (point-max) t))
+   (unless org-log-states-order-reversed
+ (and (= (char-after) ?\n) (forward-char 1))
+ (org-skip-over-state-notes)
+ (skip-chars-backward  \t\n\r)))
+  (move-marker org-log-note-marker (point))
+  (setq org-log-note-purpose purpose
+   org-log-note-state state
+   org-log-note-how how)
+  (add-hook 'post-command-hook 'org-add-log-note 'append
 
 (defun org-skip-over-state-notes ()
   Skip past the list of State notes in an entry.



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


[Orgmode] [PATCH 6/7] Add some functions for handling checklists.

2008-07-24 Thread James TD Smith
Add a module to contrib for handling repeated tasks which require checking off a
list of items.
---

 contrib/ChangeLog |5 ++
 contrib/lisp/org-checklist.el |  110 +
 2 files changed, 115 insertions(+), 0 deletions(-)
 create mode 100644 contrib/lisp/org-checklist.el

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 66d379c..1d94fa0 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2008-07-05  James TD Smith  [EMAIL PROTECTED]
+
+   * lisp/org-checklist.el: Add various checklist handling functions
+
 2008-07-04  Christian Egli  [EMAIL PROTECTED]
 
* scripts/org2hpda: the default location of the diary file should
@@ -8,6 +12,7 @@
* lisp/org-mtags.el (org-mtags-replace): Allow prefix and prefix1
as options in the include directive.
 
+
 2008-06-18  Christian Egli  [EMAIL PROTECTED]
 
* scripts/org2hpda (DIARY): Make the location of the diary file
diff --git a/contrib/lisp/org-checklist.el b/contrib/lisp/org-checklist.el
new file mode 100644
index 000..09ff911
--- /dev/null
+++ b/contrib/lisp/org-checklist.el
@@ -0,0 +1,110 @@
+;;; org-checklist.el --- org functions for checklist handling
+;;
+;; ©2008 James TD Smith
+;;
+;; Author: James TD Smith (@ ahktenzero (. mohorovi cc))
+;; Version: 1.0
+;; Keywords: org, checklists
+;;
+;; 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 this program; if not, write to the Free Software
+;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+;;
+;;; Commentary:
+;; This file provides some functions for handing repeated tasks which involve
+;; checking off a list of items. By setting the RESET_CHECK_BOXES property in 
an
+;; item, when the TODO state is set to done all checkboxes under that item are
+;; cleared. If the LIST_EXPORT_BASENAME property is set, a file will be created
+;; using the value of that property plus a timestamp, containing all the items
+;; in the list which are not checked. Additionally the user will be prompted to
+;; print the list.
+;;
+;; I use this for to keep track of stores of various things (food stores,
+;; components etc) which I check periodically and use the exported list of 
items
+;; which are not present as a shopping list.
+;;
+;;; Usage:
+;; (require 'org-checklist)
+;;
+;; Set the RESET_CHECK_BOXES and LIST_EXPORT_BASENAME properties in items as
+;; needed.
+;;
+;;; Code:
+(require 'org)
+
+(defvar export-time-format %Y%m%d%H%M
+  format of timestamp appended to export file)
+(defvar export-function 'org-export-as-ascii
+  function used to prepare the export file for printing)
+
+(defun org-reset-checkbox-state-maybe ()
+  Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set
+  (interactive *)
+  (if (org-entry-get (point) RESET_CHECK_BOXES)
+  (save-restriction
+   (save-excursion
+ (org-narrow-to-subtree)
+ (org-show-subtree)
+ (goto-char (point-min))
+ (let ((end (point-max)))
+   (while ( (point) end)
+ (when (org-at-item-checkbox-p)
+   (replace-match [ ] t t))
+ (beginning-of-line 2
+   (org-update-checkbox-count-maybe
+
+(defun org-make-checklist-export ()
+  Produce a checklist containing all unchecked items from a list
+of checkbox items
+  (interactive *)
+  (if (org-entry-get (point) LIST_EXPORT_BASENAME)
+  (let* ((export-file (concat (org-entry-get (point) 
LIST_EXPORT_BASENAME)
+ - (format-time-string export-time-format)
+ .org))
+exported-lines
+title)
+   (save-restriction
+ (save-excursion
+   (org-narrow-to-subtree)
+   (org-show-subtree)
+   (goto-char (point-min))
+   (if (looking-at org-complex-heading-regexp)
+   (setq title (match-string 4)))
+   (goto-char (point-min))
+   (let ((end (point-max)))
+ (while ( (point) end)
+   (when (and (org-at-item-checkbox-p)
+  (or (string= (match-string 0) [ ])
+  (string= (match-string 0) [-])))
+ (add-to-list 'exported-lines (thing-at-point 'line) t))
+   (beginning-of-line 2)))
+   (set-buffer (get-buffer-create export-file))
+   (org-insert-heading)
+   (insert (or title export-file) \n)
+   (dolist

[Orgmode] [PATCH 7/7] Add some new interaction between remember and clocked tasks

2008-07-24 Thread James TD Smith
Add % expansion. This tells org-remember to add the item to the currently
clocked task. Often while I'm working on something I find other related things
which need to be done and this makes it possible to use a remember template to
add a TODO item in the right place.

Add %l expansion for the current clock string.
Add %L expansion for a link to the currently clocked task.
---

 lisp/ChangeLog   |7 ++-
 lisp/org-remember.el |   38 ++
 2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d072d40..b591f32 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
 2008-07-25  James TD Smith  [EMAIL PROTECTED]
 
+   * org-remember.el (org-remember-apply-template): Add new
+   expansions: %k, %K for currently clocked task and a link to the
+   currently clocked task, and % to file notes in the currently
+   clocked task.
+
* org.el (org-get-refile-targets): Replace links with their
descriptions
(org-imenu-get-tree): Replace links with their descriptions
@@ -18,7 +23,7 @@
set-text-properties to remove text properties from the clipboard
value.
 
-   * lisp/org-clock.el (org-update-mode-line): Support limiting the
+   * org-clock.el (org-update-mode-line): Support limiting the
modeline clock string, and display the full todo value in the
tooltip. Set a local keymap so mouse-3 on the clock string goes to
the currently clocked task.
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index 8399f3d..80b5896 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -135,11 +135,15 @@ Furthermore, the following %-escapes will be replaced 
with content:
   %^L Like %^C, but insert as link
   %^g prompt for tags, with completion on tags in target file
   %^G prompt for tags, with completion all tags in all agenda files
+  %k  currently clocked task
+  %K  link to currently clocked task
+
   %:keyword   specific information for certain link types, see below
   %[pathname] insert the contents of the file given by `pathname'
   %(sexp) evaluate elisp `(sexp)' and replace with the result
   %!  Store this note immediately after filling the template
   %  Visit note immediately after storing it
+  %  file note under currently clocked task
 
   %?  After completing the template, position cursor here.
 
@@ -346,11 +350,33 @@ to be run from that hook to function properly.
  (replace-match [\\1[%^{Link description}]] nil nil v-a)
v-a))
 (v-n user-full-name)
+(v-k (if (marker-buffer org-clock-marker)
+ (substring-no-properties org-clock-heading)))
+(v-K (if (marker-buffer org-clock-marker)
+ (org-make-link-string
+  (buffer-file-name (marker-buffer org-clock-marker))
+  org-clock-heading)))
+v-I
 (org-startup-folded nil)
 org-time-was-given org-end-time-was-given x
 prompt completions char time pos default histvar)
(when (and file (not (file-name-absolute-p file)))
  (setq file (expand-file-name file org-directory)))
+
+   ;;handle the %^K file to clocked task indicator
+   (if (and v-k (string-match % tpl))
+   (setq file (buffer-file-name (marker-buffer org-clock-marker))
+ headline (with-current-buffer
+  (get-buffer (marker-buffer org-clock-marker))
+(goto-char (marker-position org-clock-marker))
+(org-back-to-heading t)
+(if (looking-at org-complex-heading-regexp)
+(concat (match-string 2)
+(if (match-string 2)  )
+(match-string 3)
+(if (match-string 3)  )
+(match-string 4))
+
(setq org-store-link-plist
  (append (list :annotation v-a :initial v-i)
  org-store-link-plist))
@@ -369,9 +395,14 @@ to be run from that hook to function properly.
  (or headline )
  (or (car org-remember-previous-location) ???)
  (or (cdr org-remember-previous-location) ???
-   (insert tpl) (goto-char (point-min))
+   (insert tpl)
+   (goto-char (point-min))
+   ;;Get rid of % if present
+   (while (re-search-forward % nil t)
+ (replace-match ))
+   (goto-char (point-min))
;; Simple %-escapes
-   (while (re-search-forward %\\([tTuUaiAcx]\\) nil t)
+   (while (re-search-forward %\\([tTuUaiAcxkKI]\\) nil t)
  (when (and initial (equal (match-string 0) %i))
(save-match

Re: [Orgmode] Problem with remember and org-mode 6.01d

2008-04-23 Thread James TD Smith
On 2008-04-23 18:31:01(+0200), Jurgen Defurne wrote:
 On Tue, 22 Apr 2008 23:52:20 +0200
 Carsten Dominik [EMAIL PROTECTED] wrote:
 
  So does this problem hapen under xemacs, or emacs?  xemacs would be  
  very strange, because there this function should not be called.  Emacs  
  21 may not have this function.
  
  On Apr 22, 2008, at 8:33 PM, Jurgen Defurne wrote:
  
   On Mon, 21 Apr 2008 21:25:01 +0200
   Carsten Dominik [EMAIL PROTECTED] wrote:
  
   Apparently you have an Emacs version that has X-windows, but does not
   know the
   function x-selection-value (which is used by Org to extract the X
   selection).
  
   Which Emacs version is that?
  
   P.S.  The git repo has already a work-around, but the next release is
   only in a few days.
  
   On Apr 21, 2008, at 8:57 PM, Jurgen Defurne wrote:
  
   I am trying to upgrade to the newest org-mode, but I really need the
   remember functionality.
  
   I have two systems, one that acts as 'production' and one that acts
   as 'test'. On production I am still on the org-mode 5.23 + remember
   1.9. I am now trying remember 2.0 (although I have tested after
   failure with 1.9) with org-mode 6.01d. I have setup the test system
   that it has the same emacs startup commands as the production  
   system.
  
   When I try to enter a remember template, C-c r works, but upon
   selection of the template I get
  
 symbol's function definition is void : x-selection-value
  
   Does any one have a clue about this problem ?
  
   I only use (x)emacs versions 21.
  
 At home here, I only use emacs. I use xemacs at my job because it has better
 cross-platform compatibility (emacs 21 requires an X-server under Windows,
 while xemacs runs fine using Cygwin, so I have POSIX compatibility, but can
 still run on Windows without X-server). And I am not planning to upgrade org
 and remember at my job until it runs satisfactorily here ate home (where I can
 tolerate some missing features).

Hi Jurgen,

I didn't test the remember clipboard patch on GNU Emacs 21, only on XEmacs 21
and GNU Emacs 22. I'll get a patch out ASAP; in the meantime you can use
Carsten's workaround in Git.

James



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


Re: [Orgmode] [PATCH 5/5] clipboard handling in remember templats

2008-04-09 Thread James TD Smith
On 2008-04-09 17:32:22(+0200), Carsten Dominik wrote:
 Hi James,
 
 I am going to accept this patch, but I do have a question about it:
 
 On Mar 16, 2008, at 5:31 PM, James TD Smith wrote:
 
 From: James TD Smith [EMAIL PROTECTED]
 
 org.el |   56 +---
 1 files changed, 41 insertions(+), 15 deletions(-)
 
 [...]
 
 (cond
  ((org-in-regexp org-bracket-link-regexp 1)
   ;; We do have a link at point, and we are going to edit it.
 @@ -12579,7 +12583,7 @@ link description.
(setq link  (org-make-link
 file: (match-string 1 (expand-file-name file)
   (t (setq link (org-make-link file: file))
 - (t
 + ((not link)
   ;; Read link, with completion for stored links.
 
 If you set it up like this, `link' will be overwritten be any link found at 
 point.
 Is you intention not to make the new argument link-location *overrule* 
 anything
 that might be at point?
No, it should override any links at point. 
 So maybe the first alternative in the cond should be just (link), to bypass 
 any parsing
Yes.

James


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


[Orgmode] [PATCH 1/5] Hide drawers after displaying an entry using org-clock-goto.

2008-03-16 Thread James TD Smith
From: James TD Smith [EMAIL PROTECTED]

---

 org.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/org.el b/org.el
index 4fe79d7..8fe8edd 100644
--- a/org.el
+++ b/org.el
@@ -18715,6 +18715,7 @@ If there is no running clock, throw an error, unless 
FAIL-QUIETLY is set.
   (goto-char org-clock-marker)
   (org-show-entry)
   (org-back-to-heading)
+  (org-cycle-hide-drawers 'children)
   (recenter))
 
 (defvar org-clock-file-total-minutes nil



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


[Orgmode] [PATCH 0/5] Various patches

2008-03-16 Thread James TD Smith
The following series implements...

---

James TD Smith (5):
  Fix the X clipboard handling so it works properly, and so it works in
  XEmacs. Add some new % expansions for remember templates for inserting
  clipboard values, and for inserting links using the clipboard contents.

  Add a new sort option, which sorts items by todo keyword in the order of
  the keyword sequence.

  Make org-table-export use the orgtbl export functions. Add support for
  reading the export format and file to export to from properties.

  Add a way to set a user-defined function to generate descriptions for 
links.

  Hide drawers after displaying an entry using org-clock-goto.


 org.el |  186 ++--
 1 files changed, 135 insertions(+), 51 deletions(-)

-- 
James


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


[Orgmode] [PATCH 2/5] Add a way to set a user-defined function to generate descriptions for links.

2008-03-16 Thread James TD Smith
From: James TD Smith [EMAIL PROTECTED]

Below is an example which uses w3m to retrieve the titles of web pages to use as
link descriptions.

(require 'w3m)

(defun make-link-description (link desc)
  Link description generator for orgmode
  (cond ((string-match https?: link)
 (with-temp-buffer
   (w3m-retrieve link)
   (goto-char (point-min))
   (if (search-forward-regexp title\\([^]*\\)/title (point-max) 
t)
   (url-unhex-string (match-string 1)
(t (or desc link

(setq org-make-link-description 'make-link-description)

---

 org.el |   37 +++--
 1 files changed, 27 insertions(+), 10 deletions(-)


diff --git a/org.el b/org.el
index 8fe8edd..021bd59 100644
--- a/org.el
+++ b/org.el
@@ -1209,6 +1209,15 @@ Changing this variable requires a restart of Emacs to 
become effective.
  (const :tag Tags tag)
  (const :tag Timestamps date)))
 
+(defcustom org-make-link-description nil
+  Function to use to generate link descriptions from links. If
+nil the link location will be used. This function must take two
+parameters; the first is the link and the second the description
+org-insert-link has generated, and should return the description
+to use.
+  :group 'org-link
+  :type 'function)
+
 (defgroup org-link-store nil
   Options concerning storing links in Org-mode
   :tag Org Store Link
@@ -12475,16 +12484,21 @@ be displayed in the buffer instead of the link.
 If there is already a link at point, this command will allow you to edit link
 and description parts.
 
-With a \\[universal-argument] prefix, prompts for a file to link to.  The file 
name can be
-selected using completion.  The path to the file will be relative to
-the current directory if the file is in the current directory or a
-subdirectory.  Otherwise, the link will be the absolute path as
-completed in the minibuffer (i.e. normally ~/path/to/file).
-
-With two \\[universal-argument] prefixes, enforce an absolute path even if the 
file
-is in the current directory or below.
-With three \\[universal-argument] prefixes, negate the meaning of
-`org-keep-stored-link-after-insertion'.
+With a \\[universal-argument] prefix, prompts for a file to link
+to. The file name can be selected using completion. The path to
+the file will be relative to the current directory if the file is
+in the current directory or a subdirectory. Otherwise, the link
+will be the absolute path as completed in the minibuffer (i.e.
+normally ~/path/to/file).
+
+With two \\[universal-argument] prefixes, enforce an absolute
+path even if the file is in the current directory or below. With
+three \\[universal-argument] prefixes, negate the meaning of
+`org-keep-stored-link-after-insertion'.
+
+If `org-make-link-description' is non-nil, this function will be
+called with the link target, and the result will be the default
+link description.
   (interactive P)
   (let* ((wcf (current-window-configuration))
 (region (if (org-region-active-p)
@@ -12605,6 +12619,9 @@ With three \\[universal-argument] prefixes, negate the 
meaning of
(if (equal desc origpath)
(setq desc path
 
+(if org-make-link-description
+   (setq desc (funcall org-make-link-description link desc)))
+
 (setq desc (read-string Description:  desc))
 (unless (string-match \\S- desc) (setq desc nil))
 (if remove (apply 'delete-region remove))



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


[Orgmode] [PATCH 3/5] Some improvements to org-table-export

2008-03-16 Thread James TD Smith
From: James TD Smith [EMAIL PROTECTED]

Specify the file to export to as parameter or property
Use the export mechanisms from orgtbl instead of the simple export.
Specify the table output format in property.

---

 org.el |   91 +---
 1 files changed, 64 insertions(+), 27 deletions(-)


diff --git a/org.el b/org.el
index 021bd59..dee8471 100644
--- a/org.el
+++ b/org.el
@@ -965,6 +965,13 @@ table, obtained by prompting the user.
  (list (symbol :tag Major mode)
(string :tag Format
 
+(defcustom org-table-export-default orgtbl-to-generic :splice t :sep \\t\
+  Default export parameters for org-table-export. These can be
+  overridden on for a specific table by setting the
+  TABLE_EXPORT_FORMAT parameter. See orgtbl-export for the
+  different export transforms and available parameters.
+  :group 'org-table)
+
 (defgroup org-table-settings nil
   Settings for tables in Org-mode.
   :tag Org Table Settings
@@ -975,6 +982,7 @@ table, obtained by prompting the user.
   :group 'org-table-settings
:type 'string)
 
+
 (defcustom org-table-number-regexp
   
^\\([]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$
   Regular expression for recognizing numbers in table columns.
@@ -8568,41 +8576,70 @@ are found, lines will be split on whitespace into 
fields.
 (insert-file-contents file)
 (org-table-convert-region beg (+ (point) (- (point-max) pm)) arg)))
 
-(defun org-table-export ()
+(defun org-table-export (optional target)
   Export table as a tab-separated file.
-Such a file can be imported into a spreadsheet program like Excel.
+Such a file can be imported into a spreadsheet program like
+Excel. If TARGET is set, the table is exported to that file. If
+the property TABLE_EXPORT_FILE is set on the entry the table is
+in, the table will be exported to that file. Otherwise the user
+is prompted for a file to write the table to.
+
+If the TABLE_EXPORT_FORMAT property is set, the contents of this
+property will control export format in the same way as radio
+tables in OrgTbl mode.
+
   (interactive)
   (let* ((beg (org-table-begin))
 (end (org-table-end))
-(table (buffer-substring beg end))
-(file (read-file-name Export table to: ))
+(txt (buffer-substring-no-properties beg end))
+(file (or target (org-entry-get beg TABLE_EXPORT_FILE)
+  (read-file-name Export table to: )))
+(format (or (org-entry-get beg TABLE_EXPORT_FORMAT)
+org-table-export-default))
 buf)
 (unless (or (not (file-exists-p file))
(y-or-n-p (format Overwrite file %s?  file)))
   (error Abort))
-(with-current-buffer (find-file-noselect file)
-  (setq buf (current-buffer))
-  (erase-buffer)
-  (fundamental-mode)
-  (insert table)
-  (goto-char (point-min))
-  (while (re-search-forward ^[ \t]*|[ \t]* nil t)
-   (replace-match  t t)
-   (end-of-line 1))
-  (goto-char (point-min))
-  (while (re-search-forward [ \t]*|[ \t]*$ nil t)
-   (replace-match  t t)
-   (goto-char (min (1+ (point)) (point-max
-  (goto-char (point-min))
-  (while (re-search-forward ^-[-+]*$ nil t)
-   (replace-match )
-   (if (looking-at \n)
-   (delete-char 1)))
-  (goto-char (point-min))
-  (while (re-search-forward [ \t]*|[ \t]* nil t)
-   (replace-match \t t t))
-  (save-buffer))
-(kill-buffer buf)))
+(message format)
+
+(if (string-match \\([^ \t\r\n]+\\)\\( +.*\\)? format)
+   (let* ((transform (intern (match-string 1 format)))
+  (params (if (match-end 2)
+  (read (concat ( (match-string 2 format) )
+  (skip (plist-get params :skip))
+  (skipcols (plist-get params :skipcols))
+  (lines (nthcdr (or skip 0) (org-split-string txt [ \t]*\n[ 
\t]*)))
+  (lines (org-table-clean-before-export lines))
+  (i0 (if org-table-clean-did-remove-column 2 1))
+  (table (mapcar
+  (lambda (x)
+(if (string-match org-table-hline-regexp x)
+'hline
+  (org-remove-by-index
+   (org-split-string (org-trim x) \\s-*|\\s-*)
+   skipcols i0)))
+  lines))
+  (fun (if (= i0 2) 'cdr 'identity))
+  (org-table-last-alignment
+   (org-remove-by-index (funcall fun org-table-last-alignment)
+skipcols i0))
+  (org-table-last-column-widths
+   (org-remove-by-index (funcall fun org-table-last-column-widths)
+skipcols i0)))
+
+ (unless (fboundp transform)
+   (error No such transformation function %s transform))
+ (setq txt (funcall transform table

[Orgmode] [PATCH 5/5] clipboard handling in remember templats

2008-03-16 Thread James TD Smith
From: James TD Smith [EMAIL PROTECTED]

Fix the X clipboard handling so it works properly, and so it works in XEmacs,and
add a new % expansion for adding links.

This patch reverts the %c expansion to its original function (head of kill
ring), and adds three new % expansions as follows:

%x - Contents of the X clipboard. This is the first non-empty value from the
PRIMARY, SECONDARY and CLIPBOARD X clipboards.

%^C - This allows the user to choose between any of the clipboard values
available, the kill ring head, and the initial region if set.

%^L - Like %^C, but this inserts an org link using the selected value.
---

 org.el |   56 +---
 1 files changed, 41 insertions(+), 15 deletions(-)


diff --git a/org.el b/org.el
index d67024f..0e5fa6a 100644
--- a/org.el
+++ b/org.el
@@ -12509,7 +12509,7 @@ This command can be called in any mode to insert a link 
in Org-mode syntax.
   (org-load-modules-maybe)
   (org-run-like-in-org-mode 'org-insert-link))
 
-(defun org-insert-link (optional complete-file)
+(defun org-insert-link (optional complete-file link-location)
   Insert a link.  At the prompt, enter the link.
 
 Completion can be used to select a link previously stored with
@@ -12538,7 +12538,10 @@ three \\[universal-argument] prefixes, negate the 
meaning of
 
 If `org-make-link-description' is non-nil, this function will be
 called with the link target, and the result will be the default
-link description.
+link description.
+
+If the `link-location' parameter is non-nil, this value will be
+used as the link location instead of reading one interactively
   (interactive P)
   (let* ((wcf (current-window-configuration))
 (region (if (org-region-active-p)
@@ -12546,7 +12549,8 @@ link description.
 (remove (and region (list (region-beginning) (region-end
 (desc region)
 tmphist ; byte-compile incorrectly complains about this
-link entry file)
+(link link-location)
+entry file)
 (cond
  ((org-in-regexp org-bracket-link-regexp 1)
   ;; We do have a link at point, and we are going to edit it.
@@ -12579,7 +12583,7 @@ link description.
  (setq link  (org-make-link
   file: (match-string 1 (expand-file-name file)
 (t (setq link (org-make-link file: file))
- (t
+ ((not link)
   ;; Read link, with completion for stored links.
   (with-output-to-temp-buffer *Org Links*
(princ Insert a link.  Use TAB to complete valid link prefixes.\n)
@@ -13399,8 +13403,12 @@ RET at beg-of-buf - Append to file as level 2 headline
 char0))
   (cddr (assoc char templates)
 
-(defvar x-last-selected-text)
-(defvar x-last-selected-text-primary)
+(defun org-get-x-clipboard (value)
+  (if (eq window-system 'x)
+  (let ((x (if org-xemacs-p
+  (get-selection-no-error value)
+(x-selection-value value
+   (and ( (length x) 0) (set-text-properties 0 (length x) nil x) x
 
 ;;;###autoload
 (defun org-remember-apply-template (optional use-char skip-interactive)
@@ -13416,12 +13424,10 @@ to be run from that hook to function properly.
   (nth 1 entry)
 org-default-notes-file))
 (headline (nth 2 entry))
-(v-c (or (and (eq window-system 'x)
-  (fboundp 'x-cut-buffer-or-selection-value)
-  (x-cut-buffer-or-selection-value))
- (org-bound-and-true-p x-last-selected-text)
- (org-bound-and-true-p x-last-selected-text-primary)
- (and ( (length kill-ring) 0) (current-kill 0
+(v-c (and ( (length kill-ring) 0) (current-kill 0)))
+(v-x (or (org-get-x-clipboard 'PRIMARY)
+ (org-get-x-clipboard 'CLIPBOARD)
+ (org-get-x-clipboard 'SECONDARY)))
 (v-t (format-time-string (car org-time-stamp-formats) 
(org-current-time)))
 (v-T (format-time-string (cdr org-time-stamp-formats) 
(org-current-time)))
 (v-u (concat [ (substring v-t 1 -1) ]))
@@ -13431,6 +13437,11 @@ to be run from that hook to function properly.
 (v-a (if (and (boundp 'annotation) annotation)
  (if (equal annotation [[]])  annotation)
))
+(clipboards (remove nil (list v-i
+  (org-get-x-clipboard 'PRIMARY)
+  (org-get-x-clipboard 'CLIPBOARD)
+  (org-get-x-clipboard 'SECONDARY)
+  v-c)))
 (v-A (if (and v-a
   (string-match 
\\[\\(\\[.*?\\]\\)\\(\\[.*?\\]\\)?\\] v-a))
  (replace-match [\\1[%^{Link description}]] nil nil v-a)
@@ -13459,7 +13470,7 @@ to be run from that hook to function

Re: [Orgmode] [PATCH 4/5] Various patches

2008-03-16 Thread James TD Smith
One of my patches [4/5] appears to have gone missing.

I've attatched it to this email.

James
Add a new sort option, which sorts items by todo keyword in the order of the

From: James TD Smith [EMAIL PROTECTED]

todo sequence.

This is a somewhat simple implementation which just uses the position of the
keyword in org-todo-keywords-1, so if you have multiple sequences containing the
same todo keyword you may not get the ordering you expect.
---

 org.el |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/org.el b/org.el
index dee8471..d67024f 100644
--- a/org.el
+++ b/org.el
@@ -982,7 +982,6 @@ table, obtained by prompting the user.
   :group 'org-table-settings
:type 'string)
 
-
 (defcustom org-table-number-regexp
   
^\\([]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$
   Regular expression for recognizing numbers in table columns.
@@ -6993,7 +6992,7 @@ WITH-CASE, the sorting considers case as well.
   (message
(if plain-list-p
   Sort %s: [a]lpha [n]umeric [t]ime [f]unc  A/N/T/F means reversed:
-Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc  
A/N/T/P/F means reversed:)
+Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc 
keyword [o]rder  A/N/T/P/F/O means reversed:)
what)
   (setq sorting-type (read-char-exclusive))
 
@@ -7084,6 +7083,10 @@ WITH-CASE, the sorting considers case as well.
 org-default-priority))
  ((= dcst ?r)
   (or (org-entry-get nil property) ))
+ ((= dcst ?o)
+  (if (looking-at org-complex-heading-regexp)
+  (or (position (match-string 2) org-todo-keywords-1 :test 
'string=)
+   )))
  ((= dcst ?f)
   (if getkey-func
   (progn
___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [PATCH 4/5] Add a new sort option, which sorts items by todo keyword

2008-03-16 Thread James TD Smith
This is a somewhat simple implementation which just uses the position of the
keyword in org-todo-keywords-1, so if you have multiple sequences containing the
same todo keyword you may not get the ordering you expect.
---

 org.el |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/org.el b/org.el
index dee8471..d67024f 100644
--- a/org.el
+++ b/org.el
@@ -982,7 +982,6 @@ table, obtained by prompting the user.
   :group 'org-table-settings
:type 'string)
 
-
 (defcustom org-table-number-regexp
   
^\\([]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$
   Regular expression for recognizing numbers in table columns.
@@ -6993,7 +6992,7 @@ WITH-CASE, the sorting considers case as well.
   (message
(if plain-list-p
   Sort %s: [a]lpha [n]umeric [t]ime [f]unc  A/N/T/F means reversed:
-Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc  
A/N/T/P/F means reversed:)
+Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc 
keyword [o]rder  A/N/T/P/F/O means reversed:)
what)
   (setq sorting-type (read-char-exclusive))
 
@@ -7084,6 +7083,10 @@ WITH-CASE, the sorting considers case as well.
 org-default-priority))
  ((= dcst ?r)
   (or (org-entry-get nil property) ))
+ ((= dcst ?o)
+  (if (looking-at org-complex-heading-regexp)
+  (or (position (match-string 2) org-todo-keywords-1 :test 
'string=)
+   )))
  ((= dcst ?f)
   (if getkey-func
   (progn



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


Re: [Orgmode] Org-mode version 5.15

2007-11-28 Thread James TD Smith
Thanks to Carsten for another org-mode release.

I have found and fixed a few bugs in 5.15:

The code for the %c escape in org-remember-apply-templates caused remember to
stop working if the kill-ring was empty (current-kill raises an error if the 
kill
ring is empty). It also didn't check the X selection, so it wouldn't work
properly if x-select-enable-clipboard is nil (some of us like having two
clipboards :).

org-clock-cancel did not remove the clock information from the modeline.

org-clock-in was using the third matched group of the org-todo-line regex as the
clock string. This included the tags for the entry, so with the default
org-tags-column setting of -80 the clock string was far too long for any entry
with tags. The patch changes this to use org-complex-heading-regex, which can
extract just the title.

The patch attatched fixes all three of these.

Also, 'provide.el' appears to be missing from the tarball.

James
--- org-5.15/org.el 2007-11-28 15:15:16.0 +
+++ org-5.15.mine/org.el2007-11-29 02:27:15.0 +
@@ -12950,7 +12950,14 @@
   (nth 1 entry)
 org-default-notes-file))
 (headline (nth 2 entry))
-(v-c (current-kill 0)) ;; FIXME: protection needed?
+(v-c (if (or (and (eq window-system 'x)
+  (x-cut-buffer-or-selection-value))
+ (bound-and-true-p x-last-selected-text)
+ (bound-and-true-p x-last-selected-text-primary))
+ x-last-selected-text-primary
+   (if ( (length kill-ring) 0)
+   (current-kill 0)
+ nil)))
 (v-t (format-time-string (car org-time-stamp-formats) 
(org-current-time)))
 (v-T (format-time-string (cdr org-time-stamp-formats) 
(org-current-time)))
 (v-u (concat [ (substring v-t 1 -1) ]))
@@ -17673,8 +17680,8 @@
   (if (and org-clock-heading-function
   (functionp org-clock-heading-function))
  (setq org-clock-heading (funcall org-clock-heading-function))
-   (if (looking-at org-todo-line-regexp)
-   (setq org-clock-heading (match-string 3))
+   (if (looking-at org-complex-heading-regexp)
+   (setq org-clock-heading (match-string 4))
  (setq org-clock-heading ???)))
   (setq org-clock-heading (propertize org-clock-heading 'face nil))
   (org-clock-find-position)
@@ -17793,6 +17800,9 @@
 (set-buffer (marker-buffer org-clock-marker))
 (goto-char org-clock-marker)
 (delete-region (1- (point-at-bol)) (point-at-eol)))
+  (setq global-mode-string
+   (delq 'org-mode-line-string global-mode-string))
+  (force-mode-line-update)
   (message Clock canceled))
 
 (defun org-clock-goto (optional delete-windows)
___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode