emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Nuke org-find-if.
@ 2015-09-07 17:44 Matus Goljer
  0 siblings, 0 replies; only message in thread
From: Matus Goljer @ 2015-09-07 17:44 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-07 18:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-07 17:44 [PATCH] Nuke org-find-if Matus Goljer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).