diff options
| author | Stefan Kangas | 2023-10-29 00:38:02 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2023-10-29 00:38:02 +0200 |
| commit | 72d040ce7db94979dd2baa951919478faef928a0 (patch) | |
| tree | 7b75bd26e42fac949bd4702f03c240bc355c128d | |
| parent | c79ea103efd6fa3004c14f373305a17c49d6462d (diff) | |
| download | emacs-72d040ce7db94979dd2baa951919478faef928a0.tar.gz emacs-72d040ce7db94979dd2baa951919478faef928a0.zip | |
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.
| -rw-r--r-- | lisp/net/rcirc.el | 11 |
1 files 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." | |||
| 2974 | browse-url-button-regexp) | 2974 | browse-url-button-regexp) |
| 2975 | "Regexp matching URLs. Set to nil to disable URL features in rcirc.") | 2975 | "Regexp matching URLs. Set to nil to disable URL features in rcirc.") |
| 2976 | 2976 | ||
| 2977 | ;; cf cl-remove-if-not | ||
| 2978 | (defun rcirc-condition-filter (condp lst) | ||
| 2979 | "Remove all items not satisfying condition CONDP in list LST. | ||
| 2980 | CONDP is a function that takes a list element as argument and returns | ||
| 2981 | non-nil if that element should be included. Returns a new list." | ||
| 2982 | (delq nil (mapcar (lambda (x) (and (funcall condp x) x)) lst))) | ||
| 2983 | |||
| 2984 | (defun rcirc-browse-url (&optional arg) | 2977 | (defun rcirc-browse-url (&optional arg) |
| 2985 | "Prompt for URL to browse based on URLs in buffer before point. | 2978 | "Prompt for URL to browse based on URLs in buffer before point. |
| 2986 | 2979 | ||
| 2987 | If ARG is given, opens the URL in a new browser window." | 2980 | If ARG is given, opens the URL in a new browser window." |
| 2988 | (interactive "P") | 2981 | (interactive "P") |
| 2989 | (let* ((point (point)) | 2982 | (let* ((point (point)) |
| 2990 | (filtered (rcirc-condition-filter | 2983 | (filtered (seq-filter |
| 2991 | (lambda (x) (>= point (cdr x))) | 2984 | (lambda (x) (>= point (cdr x))) |
| 2992 | rcirc-urls)) | 2985 | rcirc-urls)) |
| 2993 | (completions (mapcar (lambda (x) (car x)) filtered)) | 2986 | (completions (mapcar (lambda (x) (car x)) filtered)) |
| @@ -4008,6 +4001,8 @@ PROCESS is the process object for the current connection." | |||
| 4008 | (define-obsolete-function-alias 'rcirc-format-strike-trough | 4001 | (define-obsolete-function-alias 'rcirc-format-strike-trough |
| 4009 | 'rcirc-format-strike-through "30.1") | 4002 | 'rcirc-format-strike-through "30.1") |
| 4010 | 4003 | ||
| 4004 | (define-obsolete-function-alias 'rcirc-condition-filter #'seq-filter "30.1") | ||
| 4005 | |||
| 4011 | (provide 'rcirc) | 4006 | (provide 'rcirc) |
| 4012 | 4007 | ||
| 4013 | ;;; rcirc.el ends here | 4008 | ;;; rcirc.el ends here |