Re: [O] [PATCH] org: org-get-priority: reduce `not`, deduplicate magic `(* 1000 ..)` operation

2019-10-10 Thread Anton Latukha
Please.I tried to explain myself, but I see the more I explain myself, and write - the more people would assume the things that not correspond to reality.I not even started the work, or shown changes. And I already received a bunch of recommendations and people being concern, and people confusing things we talk about. Somehow mailing list emails do not arrive to me very well, they take huge time to arrive, and for whatever reason, not all of them arrive. I would wait & observe the behavior of the mail system more.I monitor the web archive, but I do not respond right away, I wait till messages arrive into my mail box. Please do not overly react for my silence. Pay no mind to this feature in the meantime, just treat it as any other patches, since it is an ordinary clean-up. I just take the idea of the customization and the code that Carsten already wrote in 2010, just somehow nobody tested or used it since then. I would clean-up the code a little, so the feature would work, and default priorities and code would work, and everything would work. I hope we would work gradually, merging small changes, doing stages on the process, that would allow us to do things. Regards,Anton Latukha  10.10.2019, 15:47, "Nicolas Goaziou" :Hello,Anton Latukha  writes:  Well, after re-reading my letter - it obviously probably comes off as being very strong and ambitious. I am pretty cool-headed about everything. I am aware of that I need to gradual do ideally clean and 100% compatible changes, I looked at the code - and the changes needed are at the pretty simple level, it can be done. I just need to be very aware and understand all hardcode about default priorities, maybe just simply create the custom checks, as in org-get-priority for org-get-priority-function and `else` cases are default code.[...]   I can not use the current default priority system.  I thought much about what system of priorities I feel great about using.  I had a major idea. I become very driven by this idea.  I want my priorities to be [00] -> [99] - which:  1) makes me mentally much more eager to set and work with them.  2) The main thing is with 00->99 it is impossible to stress about, currently every time it is a decision is it A or B, or maybe C. And then priority C - why do I do something mediocre.  3) 00 - 99 priorities have a natural scale, mentally you can feel their priority size, feeling easy setting and reviewing them, since setting them is intuitive and not a decision.  4) It is a priority as a percentage of a full priority.  5) It is a really scalable range, making all tasks be sorted much more granularly.  6) You can select to show diapasons, like show me 99-90 tasks, 89-60, or if you feel tired and playful, and just want to do something not critical, not current-work related - you can look at 60-40.  7) And you can move colliding priorities (like 80) to value +-1 -> which makes them automatically be sorted by your current planning more, and they would stay very close in the absolute picture, but  definitely one after the other.  8) It works perfectly for GTD system. The next task comes to you naturally by itself.  That's why I looked how to do it. And started working on this.These are interesting ideas, and probably worth developing. However,I don't think it would be a good default. As an user with simplepriority needs, I find A-B-C system very straightforward, and I don'tspend too much time thinking about the priority I should give to sometask. With your system, it would be very troublesome for me: "what isthe difference between a priority of 72 and 73?" or "yesterday, I gavethis task a 70, but maybe it should be 68 because I just tagged thistask at 69.". I.e., I would waste my time tweaking priorities.OTOH, the idea behind `org-get-priority-function' is to let anyone toplug-in a different priority system. Maybe the first improvement to thecurrent system would be to make shifting to any priority-system as easyas possible, which is, IIUC, what you are suggesting. Once everything isin place, your ideas could be integrated as an alternate priority systemwithin Org.In any case, I cannot help much you with this, as the time I can devoteto Org is virtually non-existent these days. Hopefully, someone else canguide you, if necessary. Do not worry much about breaking code: do writetests!Regards, --Nicolas Goaziou 

Re: [O] [PATCH] org: org-get-priority: reduce `not`, deduplicate magic `(* 1000 ..)` operation

2019-10-10 Thread Nicolas Goaziou
Hello,

Anton Latukha  writes:

> Well, after re-reading my letter - it obviously probably comes off as
> being very strong and ambitious. I am pretty cool-headed about
> everything. I am aware of that I need to gradual do ideally clean and
> 100% compatible changes, I looked at the code - and the changes needed
> are at the pretty simple level, it can be done. I just need to be very
> aware and understand all hardcode about default priorities, maybe just
> simply create the custom checks, as in org-get-priority for
> org-get-priority-function and `else` cases are default code.

[...]

>
>  I can not use the current default priority system.
>  I thought much about what system of priorities I feel great about using.
>
>  I had a major idea. I become very driven by this idea.
>
>  I want my priorities to be [00] -> [99] - which:
>
>  1) makes me mentally much more eager to set and work with them.
>  2) The main thing is with 00->99 it is impossible to stress about, currently 
> every time it is a decision is it A or B, or maybe C. And then priority C - 
> why do I do something mediocre.
>  3) 00 - 99 priorities have a natural scale, mentally you can feel their 
> priority size, feeling easy setting and reviewing them, since setting them is 
> intuitive and not a decision.
>  4) It is a priority as a percentage of a full priority.
>  5) It is a really scalable range, making all tasks be sorted much more 
> granularly.
>  6) You can select to show diapasons, like show me 99-90 tasks, 89-60, or if 
> you feel tired and playful, and just want to do something not critical, not 
> current-work related - you can look at 60-40.
>  7) And you can move colliding priorities (like 80) to value +-1 -> which 
> makes them automatically be sorted by your current planning more, and they 
> would stay very close in the absolute picture, but
>  definitely one after the other.
>  8) It works perfectly for GTD system. The next task comes to you naturally 
> by itself.
>
>  That's why I looked how to do it. And started working on this.

These are interesting ideas, and probably worth developing. However,
I don't think it would be a good default. As an user with simple
priority needs, I find A-B-C system very straightforward, and I don't
spend too much time thinking about the priority I should give to some
task. With your system, it would be very troublesome for me: "what is
the difference between a priority of 72 and 73?" or "yesterday, I gave
this task a 70, but maybe it should be 68 because I just tagged this
task at 69.". I.e., I would waste my time tweaking priorities.

OTOH, the idea behind `org-get-priority-function' is to let anyone to
plug-in a different priority system. Maybe the first improvement to the
current system would be to make shifting to any priority-system as easy
as possible, which is, IIUC, what you are suggesting. Once everything is
in place, your ideas could be integrated as an alternate priority system
within Org.

In any case, I cannot help much you with this, as the time I can devote
to Org is virtually non-existent these days. Hopefully, someone else can
guide you, if necessary. Do not worry much about breaking code: do write
tests!

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] org: org-get-priority: reduce `not`, deduplicate magic `(* 1000 ..)` operation

2019-10-09 Thread Samuel Wales
i don't use the priority stuff, but i think it could perhaps be useful
to use terminology to distinguish the priority stuff from
the priority stuff.

i.e.

1] the stuff i don't use that you are talking about
2] [#A] and all that

when i was a beginner i got confused by that.

:)


On 10/9/19, Adam Porter  wrote:
> Hi Anton, Nicolas, et al,
>
> I'm in favor of tidying up the priority-related code, as I also have
> found it hard to follow.
>
> But please do not change the API of these functions, i.e. the signatures
> and return values.  Their output is used in other packages, including
> some of mine like org-rifle, org-super-agenda, and org-ql.  If the API
> were to change, it would create significant headaches in writing
> compatibility code for different Org versions.
>
> I can't easily tell if that's something that's been proposed, but I'm
> making the request just in case.
>
> Thanks,
> Adam
>
>
>


-- 
The Kafka Pandemic

What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.



Re: [O] [PATCH] org: org-get-priority: reduce `not`, deduplicate magic `(* 1000 ..)` operation

2019-10-09 Thread Adam Porter
Hi Anton, Nicolas, et al,

I'm in favor of tidying up the priority-related code, as I also have
found it hard to follow.

But please do not change the API of these functions, i.e. the signatures
and return values.  Their output is used in other packages, including
some of mine like org-rifle, org-super-agenda, and org-ql.  If the API
were to change, it would create significant headaches in writing
compatibility code for different Org versions.

I can't easily tell if that's something that's been proposed, but I'm
making the request just in case.

Thanks,
Adam




Re: [O] [PATCH] org: org-get-priority: reduce `not`, deduplicate magic `(* 1000 ..)` operation

2019-10-08 Thread Anton Latukha
Well, after re-reading my letter - it obviously probably comes off as being very strong and ambitious. I am pretty cool-headed about everything. I am aware of that I need to gradual do ideally clean and 100% compatible changes, I looked at the code - and the changes needed are at the pretty simple level, it can be done. I just need to be very aware and understand all hardcode about default priorities, maybe just simply create the custom checks, as in org-get-priority for org-get-priority-function and `else` cases are default code.  Regards,Anton Latukha09.10.2019, 00:28, "Anton Latukha" :Ok.I would tend to it.This hardcode goes through several org.el functions. The main custom priority (priority retrieval) function should be already working and accepted in the whole Org system. But that hardcode expectation of (* 1000 ..) should be moved-out of the main priority functions and be supplied as default priority getters setters.1.a) If I decide to do a small change first - I would send a patch.1.b) If I would decide to do the main part - I would correspond to you with the branch.I am pretty new to Emacs Lisp, I know FP really well, to be honest as a new Elisp dev I am feeling little uncomfortably nervous by touching the main Org-mode code, but I kinda know and sure how it all works, and would do it.P.S.I can not use the current default priority system.I thought much about what system of priorities I feel great about using.I had a major idea. I become very driven by this idea.I want my priorities to be [00] -> [99] - which:1) makes me mentally much more eager to set and work with them.2) The main thing is with 00->99 it is impossible to stress about, currently every time it is a decision is it A or B, or maybe C. And then priority C - why do I do something mediocre.3) 00 - 99 priorities have a natural scale, mentally you can feel their priority size, feeling easy setting and reviewing them, since setting them is intuitive and not a decision.4) It is a priority as a percentage of a full priority.5) It is a really scalable range, making all tasks be sorted much more granularly.6) You can select to show diapasons, like show me 99-90 tasks, 89-60, or if you feel tired and playful, and just want to do something not critical, not current-work related - you can look at 60-40.7) And you can move colliding priorities (like 80) to value +-1 -> which makes them automatically be sorted by your current planning more, and they would stay very close in the absolute picture, but definitely one after the other.8) It works perfectly for GTD system. The next task comes to you naturally by itself.That's why I looked how to do it. And started working on this. Regards,Anton Latukha08.10.2019, 18:44, "Nicolas Goaziou" :Hello,Anton Latukha  writes:  Another two small patches.Please merge the two patches and factor out the (- org-lowest-priority...) while you're at it.Thank you.Regards, --Nicolas Goaziou   

Re: [O] [PATCH] org: org-get-priority: reduce `not`, deduplicate magic `(* 1000 ..)` operation

2019-10-08 Thread Anton Latukha
Ok.I would tend to it.This hardcode goes through several org.el functions. The main custom priority (priority retrieval) function should be already working and accepted in the whole Org system. But that hardcode expectation of (* 1000 ..) should be moved-out of the main priority functions and be supplied as default priority getters setters.1.a) If I decide to do a small change first - I would send a patch.1.b) If I would decide to do the main part - I would correspond to you with the branch.I am pretty new to Emacs Lisp, I know FP really well, to be honest as a new Elisp dev I am feeling little uncomfortably nervous by touching the main Org-mode code, but I kinda know and sure how it all works, and would do it.P.S.I can not use the current default priority system.I thought much about what system of priorities I feel great about using.I had a major idea. I become very driven by this idea.I want my priorities to be [00] -> [99] - which:1) makes me mentally much more eager to set and work with them.2) The main thing is with 00->99 it is impossible to stress about, currently every time it is a decision is it A or B, or maybe C. And then priority C - why do I do something mediocre.3) 00 - 99 priorities have a natural scale, mentally you can feel their priority size, feeling easy setting and reviewing them, since setting them is intuitive and not a decision.4) It is a priority as a percentage of a full priority.5) It is a really scalable range, making all tasks be sorted much more granularly.6) You can select to show diapasons, like show me 99-90 tasks, 89-60, or if you feel tired and playful, and just want to do something not critical, not current-work related - you can look at 60-40.7) And you can move colliding priorities (like 80) to value +-1 -> which makes them automatically be sorted by your current planning more, and they would stay very close in the absolute picture, but definitely one after the other.8) It works perfectly for GTD system. The next task comes to you naturally by itself.That's why I looked how to do it. And started working on this. Regards,Anton Latukha08.10.2019, 18:44, "Nicolas Goaziou" :Hello,Anton Latukha  writes:  Another two small patches.Please merge the two patches and factor out the (- org-lowest-priority...) while you're at it.Thank you.Regards, --Nicolas Goaziou  

Re: [O] [PATCH] org: org-get-priority: reduce `not`, deduplicate magic `(* 1000 ..)` operation

2019-10-08 Thread Nicolas Goaziou
Hello,

Anton Latukha  writes:

> Another two small patches.

Please merge the two patches and factor out the (- org-lowest-priority
...) while you're at it.

Thank you.

Regards,

-- 
Nicolas Goaziou



[O] [PATCH] org: org-get-priority: reduce `not`, deduplicate magic `(* 1000 ..)` operation

2019-09-28 Thread Anton Latukha
Another two small patches.(First I subscribed mail profile with a `name+tag@mail` format, after that understood that I can receive messages, but I can not write back from that tag address. Still do not see or know, if I reached the mailing list with the patches). $ make test---Ran 808 tests, 808 results as expected (2019-09-29 03:24:36+0300)13 expected failures Regards,Anton Latukha From afb204303a388f2644a535dccef6f603d3519ead Mon Sep 17 00:00:00 2001
From: Anton-Latukha 
Date: Sun, 29 Sep 2019 03:08:24 +0300
Subject: [PATCH 1/2] org: org-get-priority: rm: reduce negation operation

* org (org-get-priority): reducing bool negation operation by
switching if cases
---
 lisp/org.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 450d16083..72408f49f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11679,10 +11679,10 @@ and by additional input from the age of a schedules or deadline entry."
   (save-match-data
 (if (functionp org-get-priority-function)
 	(funcall org-get-priority-function)
-  (if (not (string-match org-priority-regexp s))
-	  (* 1000 (- org-lowest-priority org-default-priority))
+  (if (string-match org-priority-regexp s)
 	(* 1000 (- org-lowest-priority
-		   (string-to-char (match-string 2 s
+		   (string-to-char (match-string 2 s
+	(* 1000 (- org-lowest-priority org-default-priority))
 
  Tags
 
-- 
2.23.0

From c1e5afed098133103c0d7c44db4da4a939aa6431 Mon Sep 17 00:00:00 2001
From: Anton-Latukha 
Date: Sun, 29 Sep 2019 03:10:25 +0300
Subject: [PATCH 2/2] org: org-get-priority: push same magic (* 1000 .. ) op
 outside of if

* org (org-get-priority): Push the same magic (* 1000 ..) operation
outside applying it to if overall.
---
 lisp/org.el | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 72408f49f..8aabce5f4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11679,10 +11679,11 @@ and by additional input from the age of a schedules or deadline entry."
   (save-match-data
 (if (functionp org-get-priority-function)
 	(funcall org-get-priority-function)
-  (if (string-match org-priority-regexp s)
-	(* 1000 (- org-lowest-priority
-		   (string-to-char (match-string 2 s
-	(* 1000 (- org-lowest-priority org-default-priority))
+  (* 1000
+	 (if (string-match org-priority-regexp s)
+	 (- org-lowest-priority
+		(string-to-char (match-string 2 s)))
+	   (- org-lowest-priority org-default-priority))
 
  Tags
 
-- 
2.23.0