emacs-diffs
[Top][All Lists]
Advanced

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

master 72d040ce7db: Prefer seq-filter in rcirc.el


From: Stefan Kangas
Subject: master 72d040ce7db: Prefer seq-filter in rcirc.el
Date: Sat, 28 Oct 2023 18:41:44 -0400 (EDT)

branch: master
commit 72d040ce7db94979dd2baa951919478faef928a0
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    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



reply via email to

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