emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matus Goljer <dota.keys@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Nuke org-find-if.
Date: Mon, 7 Sep 2015 19:44:56 +0200	[thread overview]
Message-ID: <8737yqxg23.fsf@gmail.com> (raw)

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

                 reply	other threads:[~2015-09-07 18:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8737yqxg23.fsf@gmail.com \
    --to=dota.keys@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).