Re: Feature request: Radio button option for lists of checkboxes

2020-02-12 Thread Matus Goljer
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,  wrote:

> Hi Phil,
>
> Phil Sainty  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
>


[O] [PATCH] Nuke org-find-if.

2015-09-07 Thread Matus Goljer
Message-ID: <874mj6xg25@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain
--text follows this line--
* org.el (org-find-if): Function removed in favour of `cl-find-if'.
* org-contacts.el (org-find-if): Function removed in favour of
  `cl-find-if'.

This function does exactly the same as `cl-find-if', there is no reason
to have it.  It is only used once in org itself and 6 times in one
contrib package.  Both files already require cl, so just use the cl
function.
---
 contrib/lisp/org-contacts.el | 12 ++--
 lisp/org.el  |  9 +
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index edc09fe..e42436f 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -232,7 +232,7 @@ A regexp matching strings of whitespace, `,' and `;'.")
 (defun org-contacts-db-need-update-p ()
   "Determine whether `org-contacts-db' needs to be refreshed."
   (or (null org-contacts-last-update)
-  (org-find-if (lambda (file)
+  (cl-find-if (lambda (file)
 (or (time-less-p org-contacts-last-update
  (elt (file-attributes file) 5
   (org-contacts-files))
@@ -322,12 +322,12 @@ cell corresponding to the contact properties.
   (org-string-match-p name-match
   (first contact)))
  (and prop-match
-  (org-find-if (lambda (prop)
+  (cl-find-if (lambda (prop)
  (and (string= (car prop-match) (car prop))
   (org-string-match-p (cdr prop-match) 
(cdr prop
(caddr contact)))
  (and tags-match
-  (org-find-if (lambda (tag)
+  (cl-find-if (lambda (tag)
  (org-string-match-p tags-match tag))
(org-split-string
 (or (cdr (assoc-string "ALLTAGS" (caddr 
contact))) "") ":"
@@ -489,10 +489,10 @@ prefixes rather than just the beginning of the string."
  completions))
 
 (defun org-contacts-test-completion-prefix (string collection predicate)
-  ;; Prevents `org-find-if' from redefining `predicate' and going into
+  ;; Prevents `cl-find-if' from redefining `predicate' and going into
   ;; an infinite loop.
   (lexical-let ((predicate predicate))
-(org-find-if (lambda (el)
+(cl-find-if (lambda (el)
   (and (or (null predicate) (funcall predicate el))
(string= string el)))
 collection)))
@@ -594,7 +594,7 @@ description."
   "Remove all ignore-list's elements from list and you can use
regular expressions in the ignore list."
 (org-remove-if (lambda (el)
-(org-find-if (lambda (x)
+(cl-find-if (lambda (x)
(string-match-p x el))
  ignore-list))
   list))
diff --git a/lisp/org.el b/lisp/org.el
index ef6836e..72f8fdd 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1102,7 +1102,7 @@ Or return the original if not disputed.
 Also apply the translations defined in `org-xemacs-key-equivalents'."
   (when org-replace-disputed-keys
 (let* ((nkey (key-description key))
-  (x (org-find-if (lambda (x)
+  (x (cl-find-if (lambda (x)
 (equal (key-description (car x)) nkey))
   org-disputed-keys)))
   (setq key (if x (cdr x) key
@@ -1110,13 +1110,6 @@ Also apply the translations defined in 
`org-xemacs-key-equivalents'."
 (setq key (or (cdr (assoc key org-xemacs-key-equivalents)) key)))
   key)
 
-(defun org-find-if (predicate seq)
-  (catch 'exit
-(while seq
-  (if (funcall predicate (car seq))
- (throw 'exit (car seq))
-   (pop seq)
-
 (defun org-defkey (keymap key def)
   "Define a key, possibly translated, as returned by `org-key'."
   (define-key keymap (org-key key) def))
-- 
2.4.6