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.
This commit is contained in:
parent
c79ea103ef
commit
72d040ce7d
1 changed files with 3 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue