emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
@ 2023-11-01 16:39 Sławomir Grochowski
  2023-11-01 18:14 ` Sławomir Grochowski
  2023-11-05 12:27 ` Ihor Radchenko
  0 siblings, 2 replies; 18+ messages in thread
From: Sławomir Grochowski @ 2023-11-01 16:39 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

Dear All,

I was wondering how many states a checkbox has.
Based on https://orgmode.org/manual/Checkboxes.html I conclude that there
are 3 states:
1. [   ] - not done
2. [ - ] - an intermediate state
3. [X] - done

So I think all 3 states should be available to choose from in the function
'org-columns-next-allowed-value''
for functions that use checkboxes.
In code this is a line
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org-colview.el#n754

So I would change it from this:
-      (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]")))
to that:
+     (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[-]" "[X]")))

What do you think?

Regards,
Sławomir Grochowski

[-- Attachment #2: Type: text/html, Size: 1337 bytes --]

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

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2023-11-01 16:39 Sławomir Grochowski
@ 2023-11-01 18:14 ` Sławomir Grochowski
  2023-11-05 12:27 ` Ihor Radchenko
  1 sibling, 0 replies; 18+ messages in thread
From: Sławomir Grochowski @ 2023-11-01 18:14 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2019 bytes --]

I have found good explanation of 'tristate checkbox':
https://dequeuniversity.com/library/aria/checkbox-tri#:~:text=A%20tri%2Dstate%20checkbox%20can,parent%20checkbox%20is%20partially%20checked
.

"A tristate checkbox can be checked, not checked, or partially
checked. The condition of being partially checked is based on the
selection of child elements. If all child elements are selected, the
parent checkbox is checked. If some child elements are selected, the
parent checkbox is partially checked."

So as I understand it this is the same approach in org-mode.
But I'm using 'an intermediate state' to mark a checkbox that can't be
'done'.

Like, I planned to go to gym:
- [  ]  go to gym on 01.11.2023

But the time has passed and I didn't go to the gym on this precise day.
So I can't mark the checkbox as done, I can only leave it as it is.
But after a couple of days I'm not sure if I was at the gym that day and
maybe I just forgot to mark it as done.
So for this purpose I'm marking it as [ - ] that explicitly I can't do this
checkbox.
Maybe others use it the same way?
What do you think?

Regards,
Sławomir Grochowski



On Wed, Nov 1, 2023 at 5:39 PM Sławomir Grochowski <
slawomir.grochowski@gmail.com> wrote:

> Dear All,
>
> I was wondering how many states a checkbox has.
> Based on https://orgmode.org/manual/Checkboxes.html I conclude that there
> are 3 states:
> 1. [   ] - not done
> 2. [ - ] - an intermediate state
> 3. [X] - done
>
> So I think all 3 states should be available to choose from in the function
> 'org-columns-next-allowed-value''
> for functions that use checkboxes.
> In code this is a line
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org-colview.el#n754
>
> So I would change it from this:
> -      (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]")))
> to that:
> +     (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[-]" "[X]")))
>
> What do you think?
>
> Regards,
> Sławomir Grochowski
>
>

[-- Attachment #2: Type: text/html, Size: 3377 bytes --]

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

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2023-11-01 16:39 Sławomir Grochowski
  2023-11-01 18:14 ` Sławomir Grochowski
@ 2023-11-05 12:27 ` Ihor Radchenko
  2023-11-05 16:11   ` Sławomir Grochowski
  2024-01-16 15:50   ` Ihor Radchenko
  1 sibling, 2 replies; 18+ messages in thread
From: Ihor Radchenko @ 2023-11-05 12:27 UTC (permalink / raw)
  To: Sławomir Grochowski; +Cc: emacs-orgmode

Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:

> I was wondering how many states a checkbox has.
> Based on https://orgmode.org/manual/Checkboxes.html I conclude that there
> are 3 states:
> 1. [   ] - not done
> 2. [ - ] - an intermediate state
> 3. [X] - done
>
> So I think all 3 states should be available to choose from in the function
> 'org-columns-next-allowed-value''
> for functions that use checkboxes.
> In code this is a line
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org-colview.el#n754
>
> So I would change it from this:
> -      (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]")))
> to that:
> +     (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[-]" "[X]")))
>
> What do you think?

I think that your use-case is not necessarily common enough to change
the defaults. But we can introduce a defcustom here. Patches welcome!

-- 
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] 18+ messages in thread

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2023-11-05 12:27 ` Ihor Radchenko
@ 2023-11-05 16:11   ` Sławomir Grochowski
  2023-11-05 16:48     ` Ihor Radchenko
  2024-01-16 15:50   ` Ihor Radchenko
  1 sibling, 1 reply; 18+ messages in thread
From: Sławomir Grochowski @ 2023-11-05 16:11 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1735 bytes --]

Yes. You are right.
After thinking about it I think the same.

But why is it allowed in '(org-toggle-checkbox &optional TOGGLE-PRESENCE)'.
To set a normal checkbox to 'partial state'?
Description from function: 'With a double prefix argument, set the checkbox
to "[-]".'

Probably it should not be allowed for normal checkbox only for parent
checkbox, which have children.

What do you think?

Regards,
Sławomir Grochowski






On Sun, Nov 5, 2023 at 1:25 PM Ihor Radchenko <yantar92@posteo.net> wrote:

> Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:
>
> > I was wondering how many states a checkbox has.
> > Based on https://orgmode.org/manual/Checkboxes.html I conclude that
> there
> > are 3 states:
> > 1. [   ] - not done
> > 2. [ - ] - an intermediate state
> > 3. [X] - done
> >
> > So I think all 3 states should be available to choose from in the
> function
> > 'org-columns-next-allowed-value''
> > for functions that use checkboxes.
> > In code this is a line
> >
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org-colview.el#n754
> >
> > So I would change it from this:
> > -      (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]")))
> > to that:
> > +     (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[-]" "[X]")))
> >
> > What do you think?
>
> I think that your use-case is not necessarily common enough to change
> the defaults. But we can introduce a defcustom here. Patches welcome!
>
> --
> 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>
>

[-- Attachment #2: Type: text/html, Size: 3043 bytes --]

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

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2023-11-05 16:11   ` Sławomir Grochowski
@ 2023-11-05 16:48     ` Ihor Radchenko
  0 siblings, 0 replies; 18+ messages in thread
From: Ihor Radchenko @ 2023-11-05 16:48 UTC (permalink / raw)
  To: Sławomir Grochowski; +Cc: emacs-orgmode

Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:

> But why is it allowed in '(org-toggle-checkbox &optional TOGGLE-PRESENCE)'.
> To set a normal checkbox to 'partial state'?
> Description from function: 'With a double prefix argument, set the checkbox
> to "[-]".'
>
> Probably it should not be allowed for normal checkbox only for parent
> checkbox, which have children.
>
> What do you think?

This requires explicit user action (passing C-u C-u prefix argument).
So, I do not see any problem. At the end, nothing stops users from
editing the checkbox manually as plain text.

-- 
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] 18+ messages in thread

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2023-11-05 12:27 ` Ihor Radchenko
  2023-11-05 16:11   ` Sławomir Grochowski
@ 2024-01-16 15:50   ` Ihor Radchenko
  2024-01-23 11:10     ` Sławomir Grochowski
  1 sibling, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2024-01-16 15:50 UTC (permalink / raw)
  To: Sławomir Grochowski; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

>> What do you think?
>
> I think that your use-case is not necessarily common enough to change
> the defaults. But we can introduce a defcustom here. Patches welcome!

Sławomir, would you be interested to submit a patch here?

-- 
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] 18+ messages in thread

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2024-01-16 15:50   ` Ihor Radchenko
@ 2024-01-23 11:10     ` Sławomir Grochowski
  2024-03-16  7:55       ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Sławomir Grochowski @ 2024-01-23 11:10 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

Thank you for asking.
Yes, I would be interested.
I will prepare a patch.

Regards,
Sławomir Grochowski

On Tue, Jan 16, 2024 at 4:47 PM Ihor Radchenko <yantar92@posteo.net> wrote:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
> >> What do you think?
> >
> > I think that your use-case is not necessarily common enough to change
> > the defaults. But we can introduce a defcustom here. Patches welcome!
>
> Sławomir, would you be interested to submit a patch here?
>
> --
> 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>
>

[-- Attachment #2: Type: text/html, Size: 1413 bytes --]

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

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2024-01-23 11:10     ` Sławomir Grochowski
@ 2024-03-16  7:55       ` Ihor Radchenko
  0 siblings, 0 replies; 18+ messages in thread
From: Ihor Radchenko @ 2024-03-16  7:55 UTC (permalink / raw)
  To: Sławomir Grochowski; +Cc: emacs-orgmode

Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:

> Thank you for asking.
> Yes, I would be interested.
> I will prepare a patch.

May I know if you had a chance to work on this?

-- 
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] 18+ messages in thread

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
       [not found] ` <874jd1t7c9.fsf@localhost>
@ 2024-03-20 14:29   ` Sławomir Grochowski
  2024-03-20 16:12     ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Sławomir Grochowski @ 2024-03-20 14:29 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:
> I think that we can do the following:
>
> (1) modify org-columns-next-allowed-value (S-<right>/<left>) to use the
>     three states.
>
> (2) modify org-columns-toggle-or-columns-quit and org-columns--toggle to
>     follow what C-c C-c does:
>
>     (5.6 Checkboxes section of the manual)
>     
>     ‘C-c C-c’ (‘org-toggle-checkbox’)
>      Toggle checkbox status or--with prefix argument--checkbox presence
>      at point.  With a single prefix argument, add an empty checkbox or
>      remove the current one(3).  With a double prefix argument, set it
>      to ‘[-]’, which is considered to be an intermediate state.
>

Thank you for advice. 
I'm surprised I didn't think of it myself.
It's a good idea to ensure consistency between 'org-checkbox' and 'org-columns-checkbox'.

>      Except that we should not allow removing checkboxes and instead
>      force empty checkbox with single prefix argument.

And why do you want to avoid this?
When using 'org-column' I sometimes remove an empty checkbox.
So I see use in it, and most importantly, it would provide same
compatible interface for 'org-checkbox' and 'org-columns-checkbox'


In my previously message I didn't reply to all.
So now I'm fixing it CCing emacs-orgmode@gnu.org now.   

Regards,
-- 
Slawomir Grochowski


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

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2024-03-20 14:29   ` [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]' Sławomir Grochowski
@ 2024-03-20 16:12     ` Ihor Radchenko
  0 siblings, 0 replies; 18+ messages in thread
From: Ihor Radchenko @ 2024-03-20 16:12 UTC (permalink / raw)
  To: Sławomir Grochowski; +Cc: emacs-orgmode

Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:

>>      Except that we should not allow removing checkboxes and instead
>>      force empty checkbox with single prefix argument.
>
> And why do you want to avoid this?
> When using 'org-column' I sometimes remove an empty checkbox.
> So I see use in it, and most importantly, it would provide same
> compatible interface for 'org-checkbox' and 'org-columns-checkbox'

I guess that it might be ok. I am just worried about empty properties
that will be produced if one removes checkbox value.

-- 
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] 18+ messages in thread

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
@ 2024-04-02 12:23 Sławomir Grochowski
  2024-04-02 13:03 ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Sławomir Grochowski @ 2024-04-02 12:23 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2920 bytes --]

After careful consideration, I believe it is most prudent to only
introduce a defcustom variable. This will allow for modification while
simultaneously preserving the current behavior.

Currently we can change the value of "org-columns-checkbox" with the
following keybindings:

(1)    C-c C-c (org-columns-toggle-or-columns-quit)

       Same behavior to toggle checkbox as 'C-c C-c (org-toggle-checkbox)' on
       "org-checkbox".

       It's a great idea that keybinding works in the same way as in the
       case of a regular checkbox. This provides a consistent interface
       for the "org-checkbox" and "org-columns-checkbox".
       
       So every user who starts using "org-columns" will try to use the same
       keybinding they used for "org-checkbox". That's how I used it too.

       But I would not implement other keybindings from "org-checkbox":
       C-u C-c C-c (org-toggle-checkbox) - add or remove checkboxes.
       C-u C-u C-c C-c (org-toggle-checkbox) - set the checkbox to "[-]".
       Because there are too complicated and uncomfortable.
       And this functionality can be easily replaced by adding defcustom
       variable and using keybinding describe in point (3) of this mail.  

(2)    n or S-RIGHT (org-columns-next-allowed-value)
       p or S-LEFT (org-columns-previous-allowed-value)

       Later on, I started using S-RIGHT & S-LEFT. It's simply more
       convenient than 'C-c C-c' because in "org-columns" we navigate
       with arrow keys. So, the right hand is always on the arrow keys, making
       it easier now to press just one SHIFT key with the left hand to
       change the value.

       When we have the default two states "[X]" and "[ ]", behavior is
       same as 'C-c C-c' - toggle within these two states. 

       But if we add the third state "[-]", it might not be
       well-received by users who use these keybindings, because now they
       would have to additionally cycle between those three states, not
       just two. And unfortunately, they wouldn't be able to change
       it. That's why I believe it's worth introducing a defcustom
       variable.

(3)    1..9,0 

       "Directly select the Nth allowed value, 0 selects the 10th
       value." 

       Now that's how I change the values in the "org-columns-checkbox".
       Because it's by far the fastest, simplest, and most convenient
       way. Only one key and I immediately have the state I want.

       Right now I'm using 4 states for "org-columns-checkbox":
       (setq org-columns-checkbox-states '("[X]" "[-]" "[ ]" "" ))

       So empty state "" at digit '4' I have option to remove checkbox.
       Digit '2' is "[-]".
       Super easy and convenient in comparison to:
       C-u C-c C-c (org-toggle-checkbox) - add or remove checkboxes.
       C-u C-u C-c C-c (org-toggle-checkbox) - set the checkbox to
       "[-]".

What do you think?
Patch in attachment.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org-colview.el-Add-defcustom-org-columns-checkb.patch --]
[-- Type: text/x-diff, Size: 2467 bytes --]

From 6f8e56cb3d20977e0f4c77c1be913dfb61480cfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= <slawomir.grochowski@gmail.com>
Date: Sat, 16 Mar 2024 13:29:53 +0100
Subject: [PATCH] lisp/org-colview.el: Add defcustom
 `org-columns-checkbox-states'

* lisp/org-colview.el Add defcustom `org-columns-checkbox-states'.
(org-columns-next-allowed-value): Introduce variable `org-columns-checkbox-states'.

This would allow to use more than two states ("[ ]", "[X]") in "org-columns-checkbox".
In e.g to add an intermediate state ("[-]") which is also present in "org-checkbox".

* etc/ORG-NEWS New option ~org-columns-checkbox-states~
---
 etc/ORG-NEWS        | 5 +++++
 lisp/org-colview.el | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index ca73f06e7..1cb4b0c8e 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1753,6 +1753,11 @@ following properties: ~:hook~, ~:prepare-finalize~,
 prior to their global counterparts for the selected template.
 
 ** New options
+*** New option ~org-columns-checkbox-states~
+
+This would allow to use more than two states ("[ ]", "[X]") in "org-columns-checkbox".
+In e.g to add an intermediate state ("[-]") which is also present in "org-checkbox".
+
 *** A new option for custom setting ~org-refile-use-outline-path~ to show document title in refile targets
 
 Setting ~org-refile-use-outline-path~ to ~'title~ will show title
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index d71c84a76..eac85d3d6 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -59,6 +59,11 @@
 \f
 ;;; Configuration
 
+(defcustom org-columns-checkbox-states '("[ ]" "[X]")
+  "Checkbox states to cycle between."
+  :group 'checkbox
+  :type '(repeat string))
+
 (defcustom org-columns-modify-value-for-display-function nil
   "Function that modifies values for display in column view.
 For example, it can be used to cut out a certain part from a time stamp.
@@ -737,7 +742,7 @@ an integer, select that value."
 	  (let ((all
 		 (or (org-property-get-allowed-values pom key)
 		     (pcase (nth column org-columns-current-fmt-compiled)
-		       (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]")))
+		       (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) org-columns-checkbox-states))
 		     (org-colview-construct-allowed-dates value))))
 	    (if previous (reverse all) all))))
     (when (equal key "ITEM") (error "Cannot edit item headline from here"))
-- 
2.30.2


[-- Attachment #3: Type: text/plain, Size: 35 bytes --]



Regards,
-- 
Slawomir Grochowski

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

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2024-04-02 12:23 Sławomir Grochowski
@ 2024-04-02 13:03 ` Ihor Radchenko
  0 siblings, 0 replies; 18+ messages in thread
From: Ihor Radchenko @ 2024-04-02 13:03 UTC (permalink / raw)
  To: Sławomir Grochowski; +Cc: emacs-orgmode

Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:

> After careful consideration, I believe it is most prudent to only
> introduce a defcustom variable. This will allow for modification while
> simultaneously preserving the current behavior.
> ...
> What do you think?
> Patch in attachment.

This patch will be an improvement.

> ...
> +*** New option ~org-columns-checkbox-states~
> +
> +This would allow to use more than two states ("[ ]", "[X]") in "org-columns-checkbox".
> +In e.g to add an intermediate state ("[-]") which is also present in "org-checkbox".

It is not very clear when this feature is useful. May you provide a
small example as a part of the news entry and also
`org-columns-checkbox-states' docstring?

-- 
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] 18+ messages in thread

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
@ 2024-04-03 18:47 Sławomir Grochowski
  2024-04-04 16:22 ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Sławomir Grochowski @ 2024-04-03 18:47 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> It is not very clear when this feature is useful. May you provide a
> small example as a part of the news entry and also
> `org-columns-checkbox-states' docstring?

Yes. You are right. Thank you.
After thinking about I have found a better name:

(defcustom org-columns-checkbox-allowed-values '("[ ]" "[X]")
  "Allowed values for column with SUMMARY-TYPE that use checkbox."
  :group 'checkbox
  :type '(repeat string))

NEWS:
This would allow to use more than two states ("[ ]", "[X]") in
column with SUMMARY-TYPE that use checkbox ("X", "X/", "X%"). 
For example you can add an intermediate state ("[-]").
Or empty state ("") to remove checkbox.

What do you think? 

-- 
Slawomir Grochowski


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

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2024-04-03 18:47 Sławomir Grochowski
@ 2024-04-04 16:22 ` Ihor Radchenko
  2024-04-04 18:12   ` Sławomir Grochowski
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2024-04-04 16:22 UTC (permalink / raw)
  To: Sławomir Grochowski; +Cc: emacs-orgmode

Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:

> After thinking about I have found a better name:
> ...
> What do you think? 

Looks reasonable.

> (defcustom org-columns-checkbox-allowed-values '("[ ]" "[X]")
>   "Allowed values for column with SUMMARY-TYPE that use checkbox."
>   :group 'checkbox
>   :type '(repeat string))

Do not forget to add :package-version.

-- 
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] 18+ messages in thread

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2024-04-04 16:22 ` Ihor Radchenko
@ 2024-04-04 18:12   ` Sławomir Grochowski
  2024-04-05 19:39     ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Sławomir Grochowski @ 2024-04-04 18:12 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]

Ihor Radchenko <yantar92@posteo.net> writes:

> Do not forget to add :package-version. 

Thank you for bringing it to my attention.

Patch in attachment.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org-colview.el-Add-defcustom-org-columns-checkb.patch --]
[-- Type: text/x-diff, Size: 2683 bytes --]

From eb71166693065534be9effdc28aea54bb24e64d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= <slawomir.grochowski@gmail.com>
Date: Sat, 16 Mar 2024 13:29:53 +0100
Subject: [PATCH] lisp/org-colview.el: Add defcustom
 `org-columns-checkbox-allowed-values'

* lisp/org-colview.el Add defcustom `org-columns-checkbox-allowed-values'.
(org-columns-next-allowed-value): Introduce variable `org-columns-checkbox-allowed-values'.

This would allow to use more than two states ("[ ]", "[X]") in
columns with SUMMARY-TYPE that use checkbox ("X", "X/", "X%").
For example you can add an intermediate state ("[-]").
Or empty state ("") to remove checkbox.

* etc/ORG-NEWS New option ~org-columns-checkbox-states~
---
 etc/ORG-NEWS        | 7 +++++++
 lisp/org-colview.el | 8 +++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index ca73f06e7..72caf073a 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1753,6 +1753,13 @@ following properties: ~:hook~, ~:prepare-finalize~,
 prior to their global counterparts for the selected template.
 
 ** New options
+*** New option ~org-columns-checkbox-allowed-values~
+
+This would allow to use more than two states ("[ ]", "[X]") in
+columns with SUMMARY-TYPE that use checkbox ("X", "X/", "X%").
+For example you can add an intermediate state ("[-]").
+Or empty state ("") to remove checkbox.
+
 *** A new option for custom setting ~org-refile-use-outline-path~ to show document title in refile targets
 
 Setting ~org-refile-use-outline-path~ to ~'title~ will show title
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index d71c84a76..5545c5691 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -59,6 +59,12 @@
 \f
 ;;; Configuration
 
+(defcustom org-columns-checkbox-allowed-values '("[ ]" "[X]")
+  "Allowed values for columns with SUMMARY-TYPE that use checkbox."
+  :group 'checkbox
+  :package-version '(Org . "9.6")
+  :type '(repeat string))
+
 (defcustom org-columns-modify-value-for-display-function nil
   "Function that modifies values for display in column view.
 For example, it can be used to cut out a certain part from a time stamp.
@@ -737,7 +743,7 @@ an integer, select that value."
 	  (let ((all
 		 (or (org-property-get-allowed-values pom key)
 		     (pcase (nth column org-columns-current-fmt-compiled)
-		       (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]")))
+		       (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) org-columns-checkbox-allowed-values))
 		     (org-colview-construct-allowed-dates value))))
 	    (if previous (reverse all) all))))
     (when (equal key "ITEM") (error "Cannot edit item headline from here"))
-- 
2.30.2


[-- Attachment #3: Type: text/plain, Size: 35 bytes --]



Regards,
-- 
Slawomir Grochowski

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

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2024-04-04 18:12   ` Sławomir Grochowski
@ 2024-04-05 19:39     ` Ihor Radchenko
  2024-04-06 10:50       ` Sławomir Grochowski
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2024-04-05 19:39 UTC (permalink / raw)
  To: Sławomir Grochowski; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]

Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:

>> Do not forget to add :package-version. 
>
> Thank you for bringing it to my attention.
>
> Patch in attachment.

Thanks!
I improved the patch a bit, with minor changes to the commit message and
adding more to the docstring and type spec of the defcustom. I also
changed the custom group (:group 'checkbox does not exist).

See the attached.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-lisp-org-colview.el-Add-defcustom-org-columns-che.patch --]
[-- Type: text/x-patch, Size: 3227 bytes --]

From b96aa5fdc710975f8cc1ac195783b1dce34b90b2 Mon Sep 17 00:00:00 2001
Message-ID: <b96aa5fdc710975f8cc1ac195783b1dce34b90b2.1712343535.git.yantar92@posteo.net>
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= <slawomir.grochowski@gmail.com>
Date: Sat, 16 Mar 2024 13:29:53 +0100
Subject: [PATCH v2] lisp/org-colview.el: Add defcustom
 `org-columns-checkbox-allowed-values'

* lisp/org-colview.el Add defcustom
`org-columns-checkbox-allowed-values'.
(org-columns-next-allowed-value): Introduce variable
`org-columns-checkbox-allowed-values'.

This would allow to use more than two states ("[ ]", "[X]") in columns
with SUMMARY-TYPE that use checkbox ("X", "X/", "X%").  For example
you can add an intermediate state ("[-]").  Or empty state ("") to
remove checkbox.

* etc/ORG-NEWS: New option ~org-columns-checkbox-states~.
---
 etc/ORG-NEWS        |  7 +++++++
 lisp/org-colview.el | 15 ++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 8c1f6a026..aeb7ffd4b 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1828,6 +1828,13 @@ following properties: ~:hook~, ~:prepare-finalize~,
 prior to their global counterparts for the selected template.
 
 ** New options
+*** New option ~org-columns-checkbox-allowed-values~
+
+This would allow to use more than two states ("[ ]", "[X]") in
+columns with SUMMARY-TYPE that use checkbox ("X", "X/", "X%").
+For example you can add an intermediate state ("[-]").
+Or empty state ("") to remove checkbox.
+
 *** A new option for custom setting ~org-refile-use-outline-path~ to show document title in refile targets
 
 Setting ~org-refile-use-outline-path~ to ~'title~ will show title
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 8a5c33236..b25cd0231 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -59,6 +59,19 @@ (defvar org-inlinetask-min-level)
 \f
 ;;; Configuration
 
+(defcustom org-columns-checkbox-allowed-values '("[ ]" "[X]")
+  "Allowed values for columns with SUMMARY-TYPE that uses checkbox.
+The affected summary types are \"X%\", \"X/\", and \"X\" (see info
+node `(org)Column attributes')."
+  :group 'org-properties
+  :package-version '(Org . "9.6")
+  :type '(repeat (choice
+                  (const :tag "Unchecked [ ]" "[ ]")
+                  (const :tag "Checked [X]" "[X]")
+                  (const :tag "No checkbox" "")
+                  (const :tag "In progress [-]" "[-]")
+                  (string :tag "Arbitrary string"))))
+
 (defcustom org-columns-modify-value-for-display-function nil
   "Function that modifies values for display in column view.
 For example, it can be used to cut out a certain part from a time stamp.
@@ -737,7 +750,7 @@ (defun org-columns-next-allowed-value (&optional previous nth)
 	  (let ((all
 		 (or (org-property-get-allowed-values pom key)
 		     (pcase (nth column org-columns-current-fmt-compiled)
-		       (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]")))
+		       (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) org-columns-checkbox-allowed-values))
 		     (org-colview-construct-allowed-dates value))))
 	    (if previous (reverse all) all))))
     (when (equal key "ITEM") (error "Cannot edit item headline from here"))
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
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 related	[flat|nested] 18+ messages in thread

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2024-04-05 19:39     ` Ihor Radchenko
@ 2024-04-06 10:50       ` Sławomir Grochowski
  2024-04-06 12:57         ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Sławomir Grochowski @ 2024-04-06 10:50 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Thanks!
> I improved the patch a bit, with minor changes to the commit message and
> adding more to the docstring and type spec of the defcustom. I also
> changed the custom group (:group 'checkbox does not exist).

Great. Thank you. It looks much better.

But I think it's better for "[-]" to be described as
'Intermediate state' not 'In progress'.

> (const :tag "Unchecked [ ]" "[ ]")  
> (const :tag "Checked [X]" "[X]")    
> (const :tag "No checkbox" "")       
> (const :tag "In progress [-]" "[-]")

Because it's described as 'Intermediate state' in org-mode manual.
In e.g https://orgmode.org/org.html#index-C_002dc-C_002dc-6

C-c C-c (org-toggle-checkbox) ¶ Toggle checkbox status or—with prefix
argument—checkbox presence at point. With a single prefix argument, add
an empty checkbox or remove the current one49. With a double prefix
argument, set it to ‘[-]’, which is considered to be an intermediate
state.

What do you think?

-- 
Slawomir Grochowski


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

* Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
  2024-04-06 10:50       ` Sławomir Grochowski
@ 2024-04-06 12:57         ` Ihor Radchenko
  0 siblings, 0 replies; 18+ messages in thread
From: Ihor Radchenko @ 2024-04-06 12:57 UTC (permalink / raw)
  To: Sławomir Grochowski; +Cc: emacs-orgmode

Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:

>> I improved the patch a bit, with minor changes to the commit message and
>> adding more to the docstring and type spec of the defcustom. I also
>> changed the custom group (:group 'checkbox does not exist).
>
> Great. Thank you. It looks much better.
>
> But I think it's better for "[-]" to be described as
> 'Intermediate state' not 'In progress'.

Applied, onto main, changing "In progress" to "Intermediate state", as
you suggested.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cc3a13c1f

-- 
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] 18+ messages in thread

end of thread, other threads:[~2024-04-06 12:58 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87cyrry16e.fsf@gmail.com>
     [not found] ` <874jd1t7c9.fsf@localhost>
2024-03-20 14:29   ` [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]' Sławomir Grochowski
2024-03-20 16:12     ` Ihor Radchenko
2024-04-03 18:47 Sławomir Grochowski
2024-04-04 16:22 ` Ihor Radchenko
2024-04-04 18:12   ` Sławomir Grochowski
2024-04-05 19:39     ` Ihor Radchenko
2024-04-06 10:50       ` Sławomir Grochowski
2024-04-06 12:57         ` Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2024-04-02 12:23 Sławomir Grochowski
2024-04-02 13:03 ` Ihor Radchenko
2023-11-01 16:39 Sławomir Grochowski
2023-11-01 18:14 ` Sławomir Grochowski
2023-11-05 12:27 ` Ihor Radchenko
2023-11-05 16:11   ` Sławomir Grochowski
2023-11-05 16:48     ` Ihor Radchenko
2024-01-16 15:50   ` Ihor Radchenko
2024-01-23 11:10     ` Sławomir Grochowski
2024-03-16  7:55       ` Ihor Radchenko

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