Deprecate org-find-if' in favor of cl-find-if'

* lisp/org.el (org-find-if): Remove function.
(org-key):
* contrib/lisp/org-contacts.el (org-contacts-db-need-update-p):
(org-contacts-filter):
(org-contacts-test-completion-prefix):
(org-contacts-remove-ignored-property-values): Use `cl-find-if'
* lisp/org-compat.el (org-find-if): Mark function as an obsolete alias
  for `cl-find-if'.
This commit is contained in:
Nicolas Goaziou 2016-06-23 09:22:49 +02:00
parent 27bec00a60
commit 4170ea25f3

View file

@ -232,7 +232,7 @@ A regexp matching strings of whitespace, `,' and `;'.")
(defun org-contacts-db-need-update-p () (defun org-contacts-db-need-update-p ()
"Determine whether `org-contacts-db' needs to be refreshed." "Determine whether `org-contacts-db' needs to be refreshed."
(or (null org-contacts-last-update) (or (null org-contacts-last-update)
(org-find-if (lambda (file) (cl-find-if (lambda (file)
(or (time-less-p org-contacts-last-update (or (time-less-p org-contacts-last-update
(elt (file-attributes file) 5)))) (elt (file-attributes file) 5))))
(org-contacts-files)) (org-contacts-files))
@ -320,12 +320,12 @@ cell corresponding to the contact properties.
(org-string-match-p name-match (org-string-match-p name-match
(first contact))) (first contact)))
(and prop-match (and prop-match
(org-find-if (lambda (prop) (cl-find-if (lambda (prop)
(and (string= (car prop-match) (car prop)) (and (string= (car prop-match) (car prop))
(org-string-match-p (cdr prop-match) (cdr prop)))) (org-string-match-p (cdr prop-match) (cdr prop))))
(caddr contact))) (caddr contact)))
(and tags-match (and tags-match
(org-find-if (lambda (tag) (cl-find-if (lambda (tag)
(org-string-match-p tags-match tag)) (org-string-match-p tags-match tag))
(org-split-string (org-split-string
(or (cdr (assoc-string "ALLTAGS" (caddr contact))) "") ":")))) (or (cdr (assoc-string "ALLTAGS" (caddr contact))) "") ":"))))
@ -487,13 +487,10 @@ prefixes rather than just the beginning of the string."
completions)) completions))
(defun org-contacts-test-completion-prefix (string collection predicate) (defun org-contacts-test-completion-prefix (string collection predicate)
;; Prevents `org-find-if' from redefining `predicate' and going into (cl-find-if (lambda (el)
;; an infinite loop.
(lexical-let ((predicate predicate))
(org-find-if (lambda (el)
(and (or (null predicate) (funcall predicate el)) (and (or (null predicate) (funcall predicate el))
(string= string el))) (string= string el)))
collection))) collection))
(defun org-contacts-boundaries-prefix (string collection predicate suffix) (defun org-contacts-boundaries-prefix (string collection predicate suffix)
(list* 'boundaries (completion-boundaries string collection predicate suffix))) (list* 'boundaries (completion-boundaries string collection predicate suffix)))
@ -592,7 +589,7 @@ description."
"Remove all ignore-list's elements from list and you can use "Remove all ignore-list's elements from list and you can use
regular expressions in the ignore list." regular expressions in the ignore list."
(cl-remove-if (lambda (el) (cl-remove-if (lambda (el)
(org-find-if (lambda (x) (cl-find-if (lambda (x)
(string-match-p x el)) (string-match-p x el))
ignore-list)) ignore-list))
list)) list))