From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matus Goljer Subject: [PATCH] Nuke org-find-if. Date: Mon, 7 Sep 2015 19:44:56 +0200 Message-ID: <8737yqxg23.fsf@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZ0lX-00063l-SL for emacs-orgmode@gnu.org; Mon, 07 Sep 2015 14:03:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZ0lU-0000Ov-L3 for emacs-orgmode@gnu.org; Mon, 07 Sep 2015 14:03:39 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:37381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZ0lU-0000Na-7C for emacs-orgmode@gnu.org; Mon, 07 Sep 2015 14:03:36 -0400 Received: by wicfx3 with SMTP id fx3so91031994wic.0 for ; Mon, 07 Sep 2015 11:03:34 -0700 (PDT) Received: from herakleitos.herakleitos (ip-78-45-38-114.net.upcbroadband.cz. [78.45.38.114]) by smtp.gmail.com with ESMTPSA id n15sm598961wjr.14.2015.09.07.11.03.33 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 07 Sep 2015 11:03:33 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Message-ID: <874mj6xg25.fsf@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