emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: "Sławomir Grochowski" <slawomir.grochowski@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
Date: Fri, 05 Apr 2024 19:39:23 +0000	[thread overview]
Message-ID: <877chboaz8.fsf@localhost> (raw)
In-Reply-To: <87cyr5c7zg.fsf@gmail.com>

[-- 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>

  reply	other threads:[~2024-04-05 19:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 18:47 [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]' 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 [this message]
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
     [not found] <87cyrry16e.fsf@gmail.com>
     [not found] ` <874jd1t7c9.fsf@localhost>
2024-03-20 14:29   ` Sławomir Grochowski
2024-03-20 16:12     ` 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
2024-06-18 10:43         ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877chboaz8.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=slawomir.grochowski@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).