Re: [O] inherit priority

2018-07-09 Thread Jesse Johnson

Hi Nicolas,

On 07/09/2018 01:22 AM, Nicolas Goaziou wrote:

It looks good. Could you send it on this ML as a patch so I can comment
it more conveniently?


Since you want to comment I guess you want the patch in the e-mail body 
rather than attached. Here goes nothing.


From bb02cd6c00b32155c0a25f409f1bfa4160b2ddcd Mon Sep 17 00:00:00 2001
From: Jesse Johnson 
Date: Sun, 22 Apr 2018 18:12:54 -0700
Subject: [PATCH] Add priority inheritance

* New org-use-priority-inheritance defcustom to toggle inheritance.
* org-get-priority now takes a pos and implements inheritance.
* org-get-priority-function can make use of inheritance by returning t.
* org-agenda-fix-displayed-priority ensures inherited priority is
  visible.
* Updates where priority is used so that inheritance is respected.  As
  a side effect, org-get-priority-function is now more widely
  respected.
---
 lisp/org-agenda.el | 117 
+

 lisp/org-habit.el  |  16 
 lisp/org.el    | 102 ++
 3 files changed, 157 insertions(+), 78 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index eaeddb6..e18e73d 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4581,6 +4581,7 @@ is active."
         (setq marker (org-agenda-new-marker (point))
           category (org-get-category)
           level (make-string (org-reduced-level 
(org-outline-level)) ? )

+  priority (org-get-priority)
           inherited-tags
           (or (eq org-agenda-show-inherited-tags 'always)
               (and (listp org-agenda-show-inherited-tags)
@@ -4593,13 +4594,13 @@ is active."
                ""
                (buffer-substring-no-properties
                 beg1 (point-at-eol))
-                   level category tags t))
+                   level category priority tags t))
         (org-add-props txt props
           'org-marker marker 'org-hd-marker marker
           'org-todo-regexp org-todo-regexp
           'level level
           'org-complex-heading-regexp org-complex-heading-regexp
-              'priority 1000
+              'priority priority
           'type "search")
         (push txt ee)
         (goto-char (1- end))
@@ -5078,7 +5079,7 @@ of what a project is and how to check if it stuck, 
customize the variable

   (setq entries
     (mapcar
  (lambda (x)
-       (setq x (org-agenda-format-item "" x nil "Diary" nil 'time))
+       (setq x (org-agenda-format-item "" x nil "Diary" nil nil 'time))
    ;; Extend the text properties to the beginning of the line
    (org-add-props x (text-properties-at (1- (length x)) x)
      'type "diary" 'date date 'face 'org-agenda-diary))
@@ -5361,6 +5362,7 @@ and the timestamp type relevant for the sorting 
strategy in

   ts-date (car ts-date-pair)
   ts-date-type (cdr ts-date-pair)
   txt (org-trim (buffer-substring (match-beginning 2) 
(match-end 0)))

+  priority (1+ (org-get-priority))
   inherited-tags
   (or (eq org-agenda-show-inherited-tags 'always)
       (and (listp org-agenda-show-inherited-tags)
@@ -5370,8 +5372,7 @@ and the timestamp type relevant for the sorting 
strategy in

            (memq 'todo org-agenda-use-tag-inheritance
   tags (org-get-tags nil (not inherited-tags))
   level (make-string (org-reduced-level (org-outline-level)) ? )
-      txt (org-agenda-format-item "" txt level category tags t)
-      priority (1+ (org-get-priority txt)))
+      txt (org-agenda-format-item "" txt level category priority 
tags t))

 (org-add-props txt props
   'org-marker marker 'org-hd-marker marker
   'priority priority
@@ -5570,6 +5571,9 @@ displayed in agenda view."
        (assq (point) deadline-position-alist))
   (throw :skip nil))
     (let* ((category (org-get-category pos))
+   (priority (if habit?
+ (org-habit-get-priority 
(org-habit-parse-todo))

+   (org-get-priority item)))
        (inherited-tags
         (or (eq org-agenda-show-inherited-tags 'always)
         (and (consp org-agenda-show-inherited-tags)
@@ -5588,11 +5592,10 @@ displayed in agenda view."
        (item
         (org-agenda-format-item
      (and inactive? org-agenda-inactive-leader)
-         head level category tags time-stamp org-ts-regexp habit?)))
+         head level category priority tags
+ time-stamp org-ts-regexp habit?)))
   (org-add-props item props
-        '

Re: [O] inherit priority

2018-07-07 Thread Jesse Johnson

Hi all,

Here is my branch adding priority inheritance.

remote: https://code.orgmode.org/holocronweaver/org-mode.git

branch: inherit-priority-squashed

I rebased upon the latest master, everything still seems to work. Sorry 
for the long delay in release.


Please test and critique.

Thanks!

Jesse




Re: [O] inherit priority

2018-04-26 Thread Jesse Johnson



On 04/26/2018 04:34 PM, Bastien wrote:

There have been several requests for priority inheritance over the
years. If it can't currently be done, I am willing to take a look at
implementing it.

Did you make progress on this?


Crazy timing! I've been testing my implementation for a few months, made 
some big adjustments a couple weeks ago and plan to submit a patch this 
weekend.



FWIW I'm not convinced it is worth implementing priority inheritance,
and like Nicolas, I don't remember any request for this (but my memory
can be wrong here).


Well, I asked for it, so there's at least one person asked for it! Very 
tedious busy-body work setting priority on dozens of subtasks when they 
all share the same priority as their parent task. Will save me hours of 
effort over the course of a year. I'm surprised it wasn't already 
implemented.


FWIW, I found a few requests for this feature while searching for a 
solution. However I implemented it because it's useful to me, not 
because anyone asked me to.


Jesse



Re: [O] inherit priority

2018-01-07 Thread Jesse Johnson

Hi,

I am trying to determine the functions I need to add / update to respect 
priority inheritance.


I see that org-show-priority would need to be updated, and likely a new 
function, say org-get-priority-with-inheritance, should supplement 
org-get-priority.


However, I can't figure out where org-colview is getting the priority 
from. It seems to be parsing and validating the priority prior to 
display since it regresses to org-default-priority if I input 
[#NONSENSE] priorities.


I also don't know where sorting is considering priority.

Help with pointing me in the right direction for either of those would 
be much appreciated! Also let me know if other things touching priority 
need updating for inheritance.


Jesse


On 01/04/2018 11:24 PM, Nicolas Goaziou wrote:

Hello,

Jesse Johnson  writes:


There have been several requests for priority inheritance over the
years.

That doesn't ring a bell.


If it can't currently be done,

I don't think it can, atm.


I am willing to take a look at implementing it.

OK!

IMO, there should be a global variable to allow priority inheritance
(default off).

Regards,






Re: [O] inherit priority

2018-01-04 Thread Jesse Johnson
There have been several requests for priority inheritance over the 
years. If it can't currently be done, I am willing to take a look at 
implementing it.



On 01/04/2018 12:15 AM, Nicolas Goaziou wrote:

Hello,

Jesse Johnson  writes:


1. Set |org-use-property-inheritance '("PRIORITY")|

2. Create a new org file with this content:

* [#A] parent
** child A
** child B

3. View org-columns (C-c C-x C-c in my setup)

4. Note that the children have priority B, while parent has priority
A.

Oh yes, I realize now. PRIORITY is a special property:

   (info "(org) Special properties")

They follow their own inheritance rules -- in this case, none.

Regards,






Re: [O] inherit priority

2018-01-03 Thread Jesse Johnson

Hi!

I don't know what an ECM is in this context, but I assume you mean a 
minimal reproducible case.


1. Set |org-use-property-inheritance '("PRIORITY")|

2. Create a new org file with this content:

* [#A] parent
** child A
** child B

3. View org-columns (C-c C-x C-c in my setup)

4. Note that the children have priority B, while parent has priority A.

For my use case I want org agenda to recognize that priority is being 
inherited for purpose of filtering and sorting.


On 01/03/2018 01:41 PM, Nicolas Goaziou wrote:

Hello,

Jesse Johnson  writes:


I want child org items to inherit priority from their parent.

I tried setting |org-use-property-inheritance '("PRIORITY")|, but it
did not have any apparent effect.

What did you try exactly, i.e., how could you show an ECM demonstrating
the issue?

Regards,






[O] inherit priority

2018-01-03 Thread Jesse Johnson

Hi all,

I want child org items to inherit priority from their parent.

I tried setting |org-use-property-inheritance '("PRIORITY")|, but it did 
not have any apparent effect.


Use case: I often have high priority projects whose tasks are mostly 
equally important. I don't want to waste time setting priorities for 
each individual child task unless it differs from the parent (e.g., an 
optional subtask may have lower priority).


I realize this has been brought up a few times over the years, but I 
couldn't find any recent info on how this is doable with stock org.


Gracias,

Jesse



[O] sort habits by priority

2017-04-27 Thread Jesse Johnson
I want to sort habits by priority, such that priority overrides all 
other criteria (schedule, deadline, consistency, etc.).


In attempting to implement this I discovered that org-habit-get-priority 
is an inline function and thus cannot be overridden by the user. There 
seems to be no straightforward way to accomplish my goal without editing 
the org source code directly.


I am not the only one to run into this problem: 
http://stackoverflow.com/questions/37200762/sort-todays-habits-by-priority-in-main-agenda-view


I think the best solution is either to make org-habit-get-priority a 
regular function (assuming this doesn't cause a serious performance 
degradation) or to add user-customizable variable(s) which can configure 
how habits are prioritized.


Thoughts?

Jesse



[O] Schedule org task for last day of every month

2017-03-27 Thread Jesse Johnson

Hi all,

How do I schedule a repeating org-mode task for the last day of every month?

As is, when I set a task deadlines like |DEADLINE: <2017-03-31 Fri 
+1m>|, marking it done shifts the date to |DEADLINE: <2017-05-01 Fri 
+1m>| which is a day too late if the deadline is the end of the month. 
Dates scheduled for the beginning of the month properly advance to the 
first of the following month, regardless of number of days in each 
month, so there is inconsistency in how the beginning and end of months 
are treated.


I previously posted this question on the Emacs StackExchange: 
http://emacs.stackexchange.com/questions/31683/schedule-org-task-for-last-day-of-every-month


I received solutions involving either manually duplicating date-shifted 
tasks or creating a custom diary function. Since scheduling repeating 
deadlines for the end of each month is a common use case, I feel this 
should be built into org mode if it is not already. If the same logic 
which shifts dates at the beginning of the month is applied to the end 
of the month, a nice symmetry would be created without adding any 
additional notation. Then |<2017-03-31 Fri +1m> |would shift to 
|<2017-04-30 Sun +1m> |as I originally expected it to.


Thoughts? I am willing to implement this feature and update the docs.

Jesse



[O] org agenda persistent mark

2016-05-22 Thread Jesse Johnson
Hello!

When I enable persistent marks while performing bulk actions in
org-agenda, the marks are always lost after the bulk action. Any idea
why? I am using org (elpa version 20160516) in upstream emacs (compiled
2015-12-22).

Thanks.

Jesse