From 72d040ce7db94979dd2baa951919478faef928a0 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 29 Oct 2023 00:38:02 +0200 Subject: [PATCH] Prefer seq-filter in rcirc.el Benchmarking shows seq-filter to be ~30% faster on this machine. * lisp/net/rcirc.el (rcirc-condition-filter): Make into an obsolete alias for 'seq-filter'. Update single caller. --- lisp/net/rcirc.el | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 7cc7adc45c7..ecfeb9f8f84 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2974,20 +2974,13 @@ keywords when no KEYWORD is given." browse-url-button-regexp) "Regexp matching URLs. Set to nil to disable URL features in rcirc.") -;; cf cl-remove-if-not -(defun rcirc-condition-filter (condp lst) - "Remove all items not satisfying condition CONDP in list LST. -CONDP is a function that takes a list element as argument and returns -non-nil if that element should be included. Returns a new list." - (delq nil (mapcar (lambda (x) (and (funcall condp x) x)) lst))) - (defun rcirc-browse-url (&optional arg) "Prompt for URL to browse based on URLs in buffer before point. If ARG is given, opens the URL in a new browser window." (interactive "P") (let* ((point (point)) - (filtered (rcirc-condition-filter + (filtered (seq-filter (lambda (x) (>= point (cdr x))) rcirc-urls)) (completions (mapcar (lambda (x) (car x)) filtered)) @@ -4008,6 +4001,8 @@ PROCESS is the process object for the current connection." (define-obsolete-function-alias 'rcirc-format-strike-trough 'rcirc-format-strike-through "30.1") +(define-obsolete-function-alias 'rcirc-condition-filter #'seq-filter "30.1") + (provide 'rcirc) ;;; rcirc.el ends here -- 2.39.2