emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH 7/8] ox-taskjuggler.el: allow 'priority' to be a directly-specified integer
@ 2015-11-08 10:20 Kosyrev Serge
  2015-11-10  0:12 ` Aaron Ecay
  0 siblings, 1 reply; 5+ messages in thread
From: Kosyrev Serge @ 2015-11-08 10:20 UTC (permalink / raw)
  To: emacs-orgmode


* ox-taskjuggler.el (org-taskjuggler--build-task):  fix priority specification
by allowing it to be directly passed down, in case it parses as an integer.
---
 contrib/lisp/ox-taskjuggler.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el
index 44ffeb6..d49db62 100644
--- a/contrib/lisp/ox-taskjuggler.el
+++ b/contrib/lisp/ox-taskjuggler.el
@@ -875,10 +875,16 @@ a unique id will be associated to it."
                            (org-taskjuggler-get-end task))
                       (org-element-property :PERIOD task)))))
          (priority
-          (let ((pri (org-element-property :priority task)))
+          (let ((pri (org-element-property :PRIORITY task)))
             (and pri
-                 (max 1 (/ (* 1000 (- org-lowest-priority pri))
-                           (- org-lowest-priority org-highest-priority)))))))
+                ;; The exported task priority can be either specified
+                ;; via the Org priority mechahism (which is currently broken),
+                ;; or it can be specified directly -- by providing it as an integer.
+                (let ((integer-pri (ignore-errors (parse-integer pri))))
+                  (or integer-pri
+                      (max 1
+                           (/ (* 1000 (- org-lowest-priority pri))
+                              (- org-lowest-priority org-highest-priority)))))))))
     (concat
      ;; Opening task.
      (format "task %s \"%s\" {\n"
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 7/8] ox-taskjuggler.el: allow 'priority' to be a directly-specified integer
@ 2015-11-08 10:20 Kosyrev Serge
  0 siblings, 0 replies; 5+ messages in thread
From: Kosyrev Serge @ 2015-11-08 10:20 UTC (permalink / raw)
  To: emacs-orgmode


* ox-taskjuggler.el (org-taskjuggler--build-task):  fix priority specification
by allowing it to be directly passed down, in case it parses as an integer.
---
 contrib/lisp/ox-taskjuggler.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el
index 44ffeb6..d49db62 100644
--- a/contrib/lisp/ox-taskjuggler.el
+++ b/contrib/lisp/ox-taskjuggler.el
@@ -875,10 +875,16 @@ a unique id will be associated to it."
                            (org-taskjuggler-get-end task))
                       (org-element-property :PERIOD task)))))
          (priority
-          (let ((pri (org-element-property :priority task)))
+          (let ((pri (org-element-property :PRIORITY task)))
             (and pri
-                 (max 1 (/ (* 1000 (- org-lowest-priority pri))
-                           (- org-lowest-priority org-highest-priority)))))))
+                ;; The exported task priority can be either specified
+                ;; via the Org priority mechahism (which is currently broken),
+                ;; or it can be specified directly -- by providing it as an integer.
+                (let ((integer-pri (ignore-errors (parse-integer pri))))
+                  (or integer-pri
+                      (max 1
+                           (/ (* 1000 (- org-lowest-priority pri))
+                              (- org-lowest-priority org-highest-priority)))))))))
     (concat
      ;; Opening task.
      (format "task %s \"%s\" {\n"
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 7/8] ox-taskjuggler.el: allow 'priority' to be a directly-specified integer
  2015-11-08 10:20 [PATCH 7/8] ox-taskjuggler.el: allow 'priority' to be a directly-specified integer Kosyrev Serge
@ 2015-11-10  0:12 ` Aaron Ecay
  2015-11-10  8:26   ` Kosyrev Serge
  0 siblings, 1 reply; 5+ messages in thread
From: Aaron Ecay @ 2015-11-10  0:12 UTC (permalink / raw)
  To: Kosyrev Serge, emacs-orgmode

Hi Kosyrev,

2015ko azaroak 8an, Kosyrev Serge-ek idatzi zuen:
> 
> * ox-taskjuggler.el (org-taskjuggler--build-task):  fix priority specification
> by allowing it to be directly passed down, in case it parses as an integer.
> ---
>  contrib/lisp/ox-taskjuggler.el | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el
> index 44ffeb6..d49db62 100644
> --- a/contrib/lisp/ox-taskjuggler.el
> +++ b/contrib/lisp/ox-taskjuggler.el
> @@ -875,10 +875,16 @@ a unique id will be associated to it."
>                             (org-taskjuggler-get-end task))
>                        (org-element-property :PERIOD task)))))
>           (priority
> -          (let ((pri (org-element-property :priority task)))
> +          (let ((pri (org-element-property :PRIORITY task)))
>              (and pri
> -                 (max 1 (/ (* 1000 (- org-lowest-priority pri))
> -                           (- org-lowest-priority org-highest-priority)))))))
> +                ;; The exported task priority can be either specified
> +                ;; via the Org priority mechahism (which is currently broken),

Can you say more about what breakage you mean?  Is it something that can
be easily fixed?

Thanks,

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 7/8] ox-taskjuggler.el: allow 'priority' to be a directly-specified integer
  2015-11-10  0:12 ` Aaron Ecay
@ 2015-11-10  8:26   ` Kosyrev Serge
  2015-11-11  2:31     ` Aaron Ecay
  0 siblings, 1 reply; 5+ messages in thread
From: Kosyrev Serge @ 2015-11-10  8:26 UTC (permalink / raw)
  To: emacs-orgmode

Aaron Ecay <aaronecay@gmail.com> writes:
> 2015ko azaroak 8an, Kosyrev Serge-ek idatzi zuen:
>> 
>> * ox-taskjuggler.el (org-taskjuggler--build-task):  fix priority specification
>> by allowing it to be directly passed down, in case it parses as an integer.
>> ---
>>  contrib/lisp/ox-taskjuggler.el | 12 +++++++++---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>> 
>> diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el
>> index 44ffeb6..d49db62 100644
>> --- a/contrib/lisp/ox-taskjuggler.el
>> +++ b/contrib/lisp/ox-taskjuggler.el
>> @@ -875,10 +875,16 @@ a unique id will be associated to it."
>>                             (org-taskjuggler-get-end task))
>>                        (org-element-property :PERIOD task)))))
>>           (priority
>> -          (let ((pri (org-element-property :priority task)))
>> +          (let ((pri (org-element-property :PRIORITY task)))
>>              (and pri
>> -                 (max 1 (/ (* 1000 (- org-lowest-priority pri))
>> -                           (- org-lowest-priority org-highest-priority)))))))
>> +                ;; The exported task priority can be either specified
>> +                ;; via the Org priority mechahism (which is currently broken),
>
> Can you say more about what breakage you mean?  Is it something that can
> be easily fixed?

Perhaps I was unclear in this message -- it's not the Org's priority
mechanism that is broken, it's the way ox-taskjuggler uses it that is.

Org specifies priorities via a list of enums, whereas TJ expects an
integer in the range 0-1000.

The quoted little piece of math in ox-taskjuggler tried to provide a
mapping, but failed and I couldn't figure out how to make it work --
mainly because I couldn't understand how it was /supposed/ to work.

Hence I made a shortcut.

-- 
с уважениeм / respectfully,
Косырев Сергей

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 7/8] ox-taskjuggler.el: allow 'priority' to be a directly-specified integer
  2015-11-10  8:26   ` Kosyrev Serge
@ 2015-11-11  2:31     ` Aaron Ecay
  0 siblings, 0 replies; 5+ messages in thread
From: Aaron Ecay @ 2015-11-11  2:31 UTC (permalink / raw)
  To: Kosyrev Serge, emacs-orgmode

Hi Kosyrev,

2015ko azaroak 10an, Kosyrev Serge-ek idatzi zuen:
> Perhaps I was unclear in this message -- it's not the Org's priority
> mechanism that is broken, it's the way ox-taskjuggler uses it that is.
> 
> Org specifies priorities via a list of enums, whereas TJ expects an
> integer in the range 0-1000.
> 
> The quoted little piece of math in ox-taskjuggler tried to provide a
> mapping, but failed and I couldn't figure out how to make it work --
> mainly because I couldn't understand how it was /supposed/ to work.

Org priorities are expressed as single characters (conventionally
uppercase Latin letters).  These map to ASCII/Unicode code points
(i.e. integers).  The code interpolates these values linearly between
0 and 1000.  By default org has three priorities A, B, and C; these
map to 1000, 500, and 0 respectively.  Five priorities A through E
would map to 1000, 750, 500, 250, and 0.  Etc.

The letter/integer substitution is a bit opaque.  So is the fact that
org-lowest-priority (by default the ASCII codepoint for ‘C’ = 67) is a
larger integer than org-highest-priority (ASCII ‘A’ = 65), despite what
the names suggest.

Does that help any?

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-11  2:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-08 10:20 [PATCH 7/8] ox-taskjuggler.el: allow 'priority' to be a directly-specified integer Kosyrev Serge
2015-11-10  0:12 ` Aaron Ecay
2015-11-10  8:26   ` Kosyrev Serge
2015-11-11  2:31     ` Aaron Ecay
  -- strict thread matches above, loose matches on Subject: below --
2015-11-08 10:20 Kosyrev Serge

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).