From: "Sławomir Grochowski" <slawomir.grochowski@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'
Date: Tue, 02 Apr 2024 14:23:24 +0200 [thread overview]
Message-ID: <87v850c5s3.fsf@gmail.com> (raw)
[-- 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
next reply other threads:[~2024-04-02 12:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 12:23 Sławomir Grochowski [this message]
2024-04-02 13:03 ` [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]' Ihor Radchenko
-- strict thread matches above, loose matches on Subject: below --
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
[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=87v850c5s3.fsf@gmail.com \
--to=slawomir.grochowski@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/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).