emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Feature request: Radio button option for lists of checkboxes
@ 2019-11-03  8:52 Phil Sainty
  2020-02-11 23:10 ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Phil Sainty @ 2019-11-03  8:52 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: matus.goljer, John Kitchin

(Where "radio button" means that for a list of checkboxes, only
one may be selected at any given time -- selecting a different
checkbox automatically de-selects the previous one.)

Hello org-mode,

John Kitchin posted this blog a few years back:

http://kitchingroup.cheme.cmu.edu/blog/2015/10/05/A-checkbox-list-in-org-mode-with-one-value/

Subsequently Matúš Goljer adapted that code here:

https://github.com/Fuco1/org-radiobutton

I'm slow in following this up, but I contacted both John and Matúš
last year suggesting that this facility would make a nice addition
to the core org-mode features.  Both of them were happy for me to
submit the feature request, and both confirmed that they have
signed FSF copyright assignment, and so their code may be safely
adapted.  I have CC'd them both to this message.

Matúš's github project has subsequently merged a branch from one
other contributor, so I have pushed a fork which excludes that
particular change, as I am not aware of the copyright status for
that.  This FSF-safe fork is:

https://github.com/phil-s/org-radiobutton

(n.b. I've assigned FSF copyright for Emacs too, but none of the
code on this fork was written by me.)


John also independently made some later changes to his original
code, and the current version of that can be found here:

https://github.com/jkitchin/scimax/blob/740591268a868b4944193e0600bf71b6f2553f2b/scimax-org.el#L1426


Both implementations depend upon the dash library, so I expect
the relevant bits of code would need rewriting.  I suspect that a
standard implementation would be able to approach things a bit
differently in any case; but the existing code would surely
provide at minimum a valuable reference for a core implementation,
and I imagine at least some of the code could be used verbatim.

I'm not familiar with org-mode internals, so I've not attempted
to provide a patch for this, but I'm hoping there's enough here
that someone with existing knowledge could run with it, as it
seems like a nice feature to include.


-Phil

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

* Re: Feature request: Radio button option for lists of checkboxes
  2019-11-03  8:52 Feature request: Radio button option for lists of checkboxes Phil Sainty
@ 2020-02-11 23:10 ` Bastien
  2020-02-11 23:41   ` Phil Sainty
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2020-02-11 23:10 UTC (permalink / raw)
  To: Phil Sainty; +Cc: matus.goljer, emacs-orgmode, John Kitchin

Hi Phil,

Phil Sainty <psainty@orcon.net.nz> writes:

> (Where "radio button" means that for a list of checkboxes, only
> one may be selected at any given time -- selecting a different
> checkbox automatically de-selects the previous one.)

From latest master, please try C-c C-x C-r on a checkbox or turn
on M-x org-list-checkbox-radio-mode RET so that C-c C-c consider
all checkboxes as radio buttons.

Thanks for sharing this idea!

Best,

-- 
 Bastien

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

* Re: Feature request: Radio button option for lists of checkboxes
  2020-02-11 23:10 ` Bastien
@ 2020-02-11 23:41   ` Phil Sainty
  2020-02-12  7:43     ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Phil Sainty @ 2020-02-11 23:41 UTC (permalink / raw)
  To: Bastien; +Cc: matus.goljer, emacs-orgmode, John Kitchin

On 12/02/20 12:10 pm, Bastien wrote:
> From latest master, please try C-c C-x C-r on a checkbox or turn
> on M-x org-list-checkbox-radio-mode RET so that C-c C-c consider
> all checkboxes as radio buttons.

Brilliant, thanks Bastien!

A nice feature that may be missing from this implementation
is the ability to mark individual lists as radio-button lists,
and then have C-c C-c do the right thing contextually.

The syntax John and Matúš used was:

#+attr_org: :radio
- [ ] localhost
- [X] staging
- [ ] production

Then you can always just use C-c C-c to select a checkbox -- but
if the list is intended to be radio buttons then that behaviour
gets used automatically.

If that's practical to add to the new implementation, I would think
it would provide the best end-user experience for interacting with
such lists.


-Phil


p.s. Their code for detecting this was along similar lines:

(when (-contains? (org-element-property
                     :attr_org
                     (org-element-property :parent (org-element-context)))
                    ":radio")

vs

(let ((list (org-radiobutton--get-list-at-point)))
  (when (-contains? (org-element-property :attr_org list) ":radio")

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

* Re: Feature request: Radio button option for lists of checkboxes
  2020-02-11 23:41   ` Phil Sainty
@ 2020-02-12  7:43     ` Bastien
  2020-02-12  9:27       ` Matus Goljer
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2020-02-12  7:43 UTC (permalink / raw)
  To: Phil Sainty; +Cc: matus.goljer, emacs-orgmode, John Kitchin

Hi Phil,

Phil Sainty <psainty@orcon.net.nz> writes:

> A nice feature that may be missing from this implementation
> is the ability to mark individual lists as radio-button lists,
> and then have C-c C-c do the right thing contextually.

Good idea, this is now in.

> The syntax John and Matúš used was:
>
> #+attr_org: :radio

I think it should be "#+attr_org: :radio t".

Try "#+attr_org: :radio t" and let me know if it works for you.

> If that's practical to add to the new implementation, I would think
> it would provide the best end-user experience for interacting with
> such lists.

Yes, I find it nice too, thanks again for suggestion this!

Best,

-- 
 Bastien

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

* Re: Feature request: Radio button option for lists of checkboxes
  2020-02-12  7:43     ` Bastien
@ 2020-02-12  9:27       ` Matus Goljer
  2020-02-12  9:34         ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Matus Goljer @ 2020-02-12  9:27 UTC (permalink / raw)
  To: Bastien; +Cc: Phil Sainty, emacs-orgmode, John Kitchin

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

Thank you both for following up on this! I'm going to add a note to my
package that this feature is now built-in and deprecate it.

m.

On Wed, 12 Feb 2020, 08:43 Bastien, <bzg@gnu.org> wrote:

> Hi Phil,
>
> Phil Sainty <psainty@orcon.net.nz> writes:
>
> > A nice feature that may be missing from this implementation
> > is the ability to mark individual lists as radio-button lists,
> > and then have C-c C-c do the right thing contextually.
>
> Good idea, this is now in.
>
> > The syntax John and Matúš used was:
> >
> > #+attr_org: :radio
>
> I think it should be "#+attr_org: :radio t".
>
> Try "#+attr_org: :radio t" and let me know if it works for you.
>
> > If that's practical to add to the new implementation, I would think
> > it would provide the best end-user experience for interacting with
> > such lists.
>
> Yes, I find it nice too, thanks again for suggestion this!
>
> Best,
>
> --
>  Bastien
>

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

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

* Re: Feature request: Radio button option for lists of checkboxes
  2020-02-12  9:27       ` Matus Goljer
@ 2020-02-12  9:34         ` Bastien
  2020-02-12 22:01           ` Samuel Wales
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2020-02-12  9:34 UTC (permalink / raw)
  To: Matus Goljer; +Cc: Phil Sainty, emacs-orgmode, John Kitchin

Hi Matus,

Matus Goljer <matus.goljer@gmail.com> writes:

> Thank you both for following up on this! I'm going to add a note to
> my package that this feature is now built-in and deprecate it.

You might want to wait a little bit before deprecating your package,
there might be some differences with the built-in implementation that
make your package more useful to some users?

A link to the built-in implementation is always good, of course.

Thanks!

-- 
 Bastien

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

* Re: Feature request: Radio button option for lists of checkboxes
  2020-02-12  9:34         ` Bastien
@ 2020-02-12 22:01           ` Samuel Wales
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Wales @ 2020-02-12 22:01 UTC (permalink / raw)
  To: Bastien; +Cc: Matus Goljer, Phil Sainty, emacs-orgmode, John Kitchin

istr an org-choice package that did somthin siilar with entries.

On 2/12/20, Bastien <bzg@gnu.org> wrote:
> Hi Matus,
>
> Matus Goljer <matus.goljer@gmail.com> writes:
>
>> Thank you both for following up on this! I'm going to add a note to
>> my package that this feature is now built-in and deprecate it.
>
> You might want to wait a little bit before deprecating your package,
> there might be some differences with the built-in implementation that
> make your package more useful to some users?
>
> A link to the built-in implementation is always good, of course.
>
> Thanks!
>
> --
>  Bastien
>
>


-- 
The Kafka Pandemic

What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html

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

end of thread, other threads:[~2020-02-12 22:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-03  8:52 Feature request: Radio button option for lists of checkboxes Phil Sainty
2020-02-11 23:10 ` Bastien
2020-02-11 23:41   ` Phil Sainty
2020-02-12  7:43     ` Bastien
2020-02-12  9:27       ` Matus Goljer
2020-02-12  9:34         ` Bastien
2020-02-12 22:01           ` Samuel Wales

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