[O] [PATCH] Fix org-clock evaluation startup hang on Windows

2012-08-29 Thread Stuart Hickinbottom
* lisp/org-clock.el (org-x11idle-exists-p): Only shell out when running
on X.

The definition of this variable currently executes command via the
shell during evaluation, irrespective of the platform on which
Org-mode is running. Unfortunately, on Windows, this matches the
command.com NT Virtual DOS Machine executable and so this gets
launched, but this is a shell and therefore sits there waiting for
user input and never returns. The net result is that Emacs will hang
on Windows when evaluating org-clock.el with the ntdvm.exe process
spinning at 100%.

The simple fix is to check that the platform is X before trying to
deal with the x11idle external process.

TINYCHANGE
---
 lisp/org-clock.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 263f2cb..91f1c63 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1001,7 +1001,8 @@ If `only-dangling-p' is non-nil, only ask to
resolve dangling
 
 (defvar org-x11idle-exists-p
   ;; Check that x11idle exists
-  (and (eq (call-process-shell-command command nil nil nil -v
x11idle) 0)
+  (and (eq window-system 'x)
+   (eq (call-process-shell-command command nil nil nil -v
x11idle) 0)
;; Check that x11idle can retrieve the idle time
(eq (call-process-shell-command x11idle nil nil nil) 0)))
 
-- 
1.7.11.4


-- 
Stuart Hickinbottom




Re: [O] Collapsing tracked time?

2011-09-16 Thread Stuart Hickinbottom
Take a look at the org-clock-into-drawer and org-log-into-drawer 
variables:
http://orgmode.org/manual/Clocking-commands.html
http://orgmode.org/manual/Tracking-TODO-state-changes.html

Does this do what you want?

Stuart



On 09/16/2011 09:01 PM, Steinar Bang wrote:
 For one particular long running TODO, I have to scroll over several
 (well... more than one) screen pages of time stamps until I get to the
 payload. 

 Is it possible to let the time stamps be collapsed/hidden by default,
 and only toggle them visible if I need to adjust a time stamp or two?

 Thanks!


 - Steinar



-- 
Stuart Hickinbottom




[O] [PATCH] Support for more flexible effort specifications in TaskJuggler exporter

2011-06-02 Thread Stuart Hickinbottom
Firstly thanks to Carsten and the whole community for org-mode - it's
really made a positive impact on my project organisation, project
tracking and record keeping at work.

I've been experimenting with tracking medium-sized tasks in org as a
work-breakdown and exporting to TaskJuggler to see just how many
evenings and weekends I'll have to work to meet my promised deadlines! A
recent patch (patch 638, 6th Match 2011) added support for more flexible
effort estimate properties such as 4h, 3.5d etc.

Unfortunately, at the moment the TaskJuggler exporter is more fussy over
this property and only accepts HH:MM or an integer, both of which it
translates to a number of days when exporting.

The attached patch adds support for passing-through effort
specifications when they're in the form REAL UNIT as they are for TJ,
supporting the suffixes d, w, m and y in a consistent way to org.
Support for HH:MM or bare number of days should still work as before. It
also cleans up another couple of things about the export of effort:

- HH:MM produces a floating point days duration now (was previously
rounded to an integer)
- The bare REAL effort regex failed to escape the decimal point (and
would match any char)
- Regexes now anchor to the string start to avoid matching the end of
duff values
- Docstring updated for more flexible effort specification

Apologies for my pidgin Emacs and elisp/regexes - this is my first
org-mode patch. Hopefully I've done it right...

-- 
Stuart

diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
index d2e5c1f..8f9174e 100644
--- a/lisp/org-taskjuggler.el
+++ b/lisp/org-taskjuggler.el
@@ -615,17 +615,19 @@ is defined it will calculate a unique id for the resource 
using
   Translate effort strings into a format acceptable to taskjuggler,
 i.e. REAL UNIT. If the effort string is something like 5:30 it
 will be assumed to be hours and will be translated into 5.5h.
-Otherwise if it contains something like 3.0 it is assumed to be
-days and will be translated into 3.0d. Other formats that
-taskjuggler supports (like weeks, months and years) are currently
-not supported.
+TaskJuggler-compatible units are also supported for hours (h),
+days (d), weeks (w), months (m) and years (y) and so effort can
+be specified like 3h or 4.5d.  Otherwise if it contains a bare
+effort without a unit such as 3.0 it is assumed to be days and
+will be translated into 3.0d.
   (cond
((null effort) effort)
((string-match \\([0-9]+\\):\\([0-9]+\\) effort)
 (let ((hours (string-to-number (match-string 1 effort)))
  (minutes (string-to-number (match-string 2 effort
-  (format %dh (+ hours (/ minutes 60.0)
-   ((string-match \\([0-9]+\\).\\([0-9]+\\) effort) (concat effort d))
+  (format %.1fh (+ hours (/ minutes 60.0)
+   ((string-match ^\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?\\([hdwmy]\\)$ effort) 
effort)
+   ((string-match ^\\([0-9]+\\)\\.\\([0-9]+\\)$ effort) (concat effort d))
(t (error Not a valid effort (%s) effort
 
 (defun org-taskjuggler-get-priority (priority)