emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-habit does not respect STYLE property inheritance
@ 2023-05-03 13:03 Дмитрий Логвиненко
  2023-05-04  9:53 ` [POLL] Will it be ok to allow HABIT property inheritance? (optionally) (was: [BUG] org-habit does not respect STYLE property inheritance) Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Дмитрий Логвиненко @ 2023-05-03 13:03 UTC (permalink / raw)
  To: emacs-orgmode

Hi there,

I've noticed that org-habits does not take an inherited STYLE property
when it searches entries. Let me illustrate it:

    (setq org-use-property-inheritance t)

    (defun run-example ()
      (with-temp-buffer
        (insert "\
    * Habit group
    :PROPERTIES:
    :STYLE: habit
    :END:
    ** DONE Contribute to org
    SCHEDULED <2023-05-01 Mon +1w/2w>
    :PROPERTIES:
    :ID: deadbeef
    :END:")
        (delay-mode-hooks (org-mode))
        (let ((entry (org-find-entry-with-id 'deadbeef)))
          `(,(org-entry-get entry "ITEM")
            ,(org-entry-get entry "TODO")
            ,(org-is-habit-p entry)))))

    ;; Original
    (defun org-is-habit-p (&optional pom)
      "Is the task at POM or point a habit?"
      (string= "habit" (org-entry-get (or pom (point)) "STYLE")))

    (run-example)
    ;; => ("Contribute to org" "DONE" nil)

    ;; Proposed
    (defun org-is-habit-p (&optional pom)
      "Is the task at POM or point a habit?"
      (string= "habit" (org-entry-get (or pom (point)) "STYLE" 'selective)))

    (run-example)
    ;; => ("Contribute to org" "DONE" t)


A little patch:

    diff --git a/lisp/org-habit.el b/lisp/org-habit.el
    index ea935fe..b7ba6e3 100644
    --- a/lisp/org-habit.el
    +++ b/lisp/org-habit.el
    @@ -170,7 +170,7 @@ means of creating calendar-based reminders."

     (defun org-is-habit-p (&optional pom)
       "Is the task at POM or point a habit?"
    -  (string= "habit" (org-entry-get (or pom (point)) "STYLE")))
    +  (string= "habit" (org-entry-get (or pom (point)) "STYLE" 'selective)))

     (defun org-habit-parse-todo (&optional pom)
       "Parse the TODO surrounding point for its habit-related data.


Emacs  : GNU Emacs 28.2 (build 1, x86_64-apple-darwin22.1.0, Carbon
Version 169 AppKit 2299)
 of 2022-12-05
Package: Org mode version 9.7 (9.7-??-5ec364a @
/Users/d.logvinenko/.emacs.d/.local/straight/build-28.2/org/)


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

* [POLL] Will it be ok to allow HABIT property inheritance? (optionally) (was: [BUG] org-habit does not respect STYLE property inheritance)
  2023-05-03 13:03 [BUG] org-habit does not respect STYLE property inheritance Дмитрий Логвиненко
@ 2023-05-04  9:53 ` Ihor Radchenko
  2023-05-18 10:38   ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2023-05-04  9:53 UTC (permalink / raw)
  To: Дмитрий
	Логвиненко
  Cc: emacs-orgmode

Дмитрий Логвиненко <dmlogv@gmail.com> writes:

> I've noticed that org-habits does not take an inherited STYLE property
> when it searches entries.
> ....
>     ;; Proposed
>     (defun org-is-habit-p (&optional pom)
>       "Is the task at POM or point a habit?"
>       (string= "habit" (org-entry-get (or pom (point)) "STYLE" 'selective)))

I am not sure if it should be considered a bug.
Currently, sub-tasks under habits are not considered habits.

With your patch, they might be, if a user have customized
`org-use-property-inheritance' to t. (Of course, if user added "STYLE"
there, it is on purpose, and there is no problem).

I am generally in favour of allowing STYLE to be inherited, but it is
technically a breaking change, as I described.

Let's see if anyone voices against this change.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [POLL] Will it be ok to allow HABIT property inheritance? (optionally) (was: [BUG] org-habit does not respect STYLE property inheritance)
  2023-05-04  9:53 ` [POLL] Will it be ok to allow HABIT property inheritance? (optionally) (was: [BUG] org-habit does not respect STYLE property inheritance) Ihor Radchenko
@ 2023-05-18 10:38   ` Ihor Radchenko
  2023-05-18 16:10     ` [POLL] Will it be ok to allow HABIT property inheritance? (optionally) Colin Baxter
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2023-05-18 10:38 UTC (permalink / raw)
  To: Дмитрий
	Логвиненко
  Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> I am generally in favour of allowing STYLE to be inherited, but it is
> technically a breaking change, as I described.
>
> Let's see if anyone voices against this change.

No objections have been raised.

Dmitry, could you please create a proper patch, adding etc/ORG-NEWS
entry that describes the change (under " ... breaking changes" section),
and a proper commit message? See
https://orgmode.org/worg/org-contribute.html#first-patch

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [POLL] Will it be ok to allow HABIT property inheritance? (optionally)
  2023-05-18 10:38   ` Ihor Radchenko
@ 2023-05-18 16:10     ` Colin Baxter
  2023-05-18 16:25       ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Colin Baxter @ 2023-05-18 16:10 UTC (permalink / raw)
  To: Ihor Radchenko
  Cc: Дмитрий
	Логвиненко,
	emacs-orgmode

>>>>> Ihor Radchenko <yantar92@posteo.net> writes:

    > Ihor Radchenko <yantar92@posteo.net> writes:
    >> I am generally in favour of allowing STYLE to be inherited, but
    >> it is technically a breaking change, as I described.
    >> 
    >> Let's see if anyone voices against this change.

    > No objections have been raised.

Well, you have not really given much time to respond.

Does this mean that all sub-heading with their TODOs will now become
habits? I would like much more information on the effects of this
proposal.

We have had `habits' for zillions of years which have worked well. So
why the change?


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

* Re: [POLL] Will it be ok to allow HABIT property inheritance? (optionally)
  2023-05-18 16:10     ` [POLL] Will it be ok to allow HABIT property inheritance? (optionally) Colin Baxter
@ 2023-05-18 16:25       ` Ihor Radchenko
  2023-05-18 16:32         ` Colin Baxter
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2023-05-18 16:25 UTC (permalink / raw)
  To: m43cap
  Cc: Дмитрий
	Логвиненко,
	emacs-orgmode

Colin Baxter <m43cap@yandex.com> writes:

>     > No objections have been raised.
>
> Well, you have not really given much time to respond.

2 weeks. I could have waited one month, but this is relatively safe
breaking change.

> Does this mean that all sub-heading with their TODOs will now become
> habits? I would like much more information on the effects of this
> proposal.

Sorry if I was not clear in my original message.

1. STYLE will _not_ be inherited by default after the proposed change.
2. HABIT will be inherited if user customized
   `org-use-property-inheritance' to value of t (aka inherit all properties)
3. STYLE will be inherited if user explicitly added "STYLE" to
   `org-use-property-inheritance' when it is a list.

Only (2) can be breaking.

> We have had `habits' for zillions of years which have worked well. So
> why the change?

To be able to dedicate a separate subtree or file to habits,
automatically making all the sub-tasks habits without spamming property
drawers setting :STYLE: habit.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [POLL] Will it be ok to allow HABIT property inheritance? (optionally)
  2023-05-18 16:25       ` Ihor Radchenko
@ 2023-05-18 16:32         ` Colin Baxter
  0 siblings, 0 replies; 6+ messages in thread
From: Colin Baxter @ 2023-05-18 16:32 UTC (permalink / raw)
  To: Ihor Radchenko
  Cc: Дмитрий
	Логвиненко,
	emacs-orgmode

>>>>> Ihor Radchenko <yantar92@posteo.net> writes:

    > Colin Baxter <m43cap@yandex.com> writes:
    >> > No objections have been raised.
    >> 
    >> Well, you have not really given much time to respond.

    > 2 weeks. I could have waited one month, but this is relatively
    > safe breaking change.

    >> Does this mean that all sub-heading with their TODOs will now
    >> become habits? I would like much more information on the effects
    >> of this proposal.

    > Sorry if I was not clear in my original message.

    > 1. STYLE will _not_ be inherited by default after the proposed
    > change.  2. HABIT will be inherited if user customized
    > `org-use-property-inheritance' to value of t (aka inherit all
    > properties) 3. STYLE will be inherited if user explicitly added
    > "STYLE" to `org-use-property-inheritance' when it is a list.

    > Only (2) can be breaking.

Ok, that's good.

    >> We have had `habits' for zillions of years which have worked
    >> well. So why the change?

    > To be able to dedicate a separate subtree or file to habits,
    > automatically making all the sub-tasks habits without spamming
    > property drawers setting :STYLE: habit.

Thank you very much. I understand.


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

end of thread, other threads:[~2023-05-18 16:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-03 13:03 [BUG] org-habit does not respect STYLE property inheritance Дмитрий Логвиненко
2023-05-04  9:53 ` [POLL] Will it be ok to allow HABIT property inheritance? (optionally) (was: [BUG] org-habit does not respect STYLE property inheritance) Ihor Radchenko
2023-05-18 10:38   ` Ihor Radchenko
2023-05-18 16:10     ` [POLL] Will it be ok to allow HABIT property inheritance? (optionally) Colin Baxter
2023-05-18 16:25       ` Ihor Radchenko
2023-05-18 16:32         ` Colin Baxter

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).