diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-06-23 09:22:49 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-06-23 09:22:49 +0200 |
commit | 705904552cb6c895c10f4489541fc07f0197656a (patch) | |
tree | d799f8c042a8c647c54744aa30572860d3242c18 | |
parent | c247993f671256085ff8ba41e04801ca29ff00cd (diff) | |
download | org-mode-705904552cb6c895c10f4489541fc07f0197656a.tar.gz |
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'.
-rw-r--r-- | contrib/lisp/org-contacts.el | 19 | ||||
-rw-r--r-- | lisp/org-compat.el | 5 | ||||
-rw-r--r-- | lisp/org.el | 12 |
3 files changed, 13 insertions, 23 deletions
diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 13fbf27..797aa29 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)) @@ -320,12 +320,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))) "") ":")))) @@ -487,13 +487,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 - ;; an infinite loop. - (lexical-let ((predicate predicate)) - (org-find-if (lambda (el) - (and (or (null predicate) (funcall predicate el)) - (string= string el))) - collection))) + (cl-find-if (lambda (el) + (and (or (null predicate) (funcall predicate el)) + (string= string el))) + collection)) (defun org-contacts-boundaries-prefix (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 regular expressions in the ignore list." (cl-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-compat.el b/lisp/org-compat.el index e4e65f1..9d075f3 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -382,10 +382,11 @@ Implements `define-error' for older emacsen." ;;; Functions from cl-lib that Org used to have its own implementation of (define-obsolete-function-alias 'org-count 'cl-count "Org 9.0") +(define-obsolete-function-alias 'org-every 'cl-every "Org 9.0") +(define-obsolete-function-alias 'org-find-if 'cl-find-if "Org 9.0") +(define-obsolete-function-alias 'org-reduce 'cl-reduce "Org 9.0") (define-obsolete-function-alias 'org-remove-if 'cl-remove-if "Org 9.0") (define-obsolete-function-alias 'org-remove-if-not 'cl-remove-if-not "Org 9.0") -(define-obsolete-function-alias 'org-reduce 'cl-reduce "Org 9.0") -(define-obsolete-function-alias 'org-every 'cl-every "Org 9.0") (define-obsolete-function-alias 'org-some 'cl-some "Org 9.0") (provide 'org-compat) diff --git a/lisp/org.el b/lisp/org.el index 8486bdf..c4b6ad8 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1093,19 +1093,11 @@ therefore you'll have to restart Emacs to apply it after changing." Or return the original if not disputed." (when org-replace-disputed-keys (let* ((nkey (key-description key)) - (x (org-find-if (lambda (x) - (equal (key-description (car x)) nkey)) - org-disputed-keys))) + (x (cl-find-if (lambda (x) (equal (key-description (car x)) nkey)) + org-disputed-keys))) (setq key (if x (cdr x) 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)) |