[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Matus Goljer
Subject: [O] [PATCH] Nuke org-find-if.
Date: Mon, 7 Sep 2015 19:44:56 +0200

Message-ID: <address@hidden>
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

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
 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))))
@@ -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))
                                 (or (cdr (assoc-string "ALLTAGS" (caddr 
contact))) "") ":"))))
@@ -489,10 +489,10 @@ prefixes rather than just the beginning of the string."
 (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)))
@@ -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))
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))
       (setq key (if x (cdr x) key))))
@@ -1110,13 +1110,6 @@ Also apply the translations defined in 
     (setq key (or (cdr (assoc key org-xemacs-key-equivalents)) 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))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]