From 6a9ac850727f54980003dfa4a25aafad7976459c Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Fri, 10 Nov 2023 12:19:35 +0100 Subject: Avoid loading cl-lib at runtime Reduce the dependency footprint and load time. cl-lib is large and not used much at runtime in Orderless. In contrast, using cl-lib at compile time seems unavoidable given crucial features like cl-defun, cl-defstruct, cl-letf and cl-loop. Loading cl-lib at compile is a common pattern in many Emacs libs. See also this long thread on emacs-devel about the pros and cons of cl-lib: https://lists.gnu.org/archive/html/emacs-devel/2023-10/msg00731.html --- orderless.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/orderless.el b/orderless.el index 29fde9a..1bc7dbc 100644 --- a/orderless.el +++ b/orderless.el @@ -55,7 +55,7 @@ ;;; Code: -(require 'cl-lib) +(eval-when-compile (require 'cl-lib)) (defgroup orderless nil "Completion method that matches space-separated regexps in any order." @@ -431,8 +431,8 @@ The predicate PRED is used to constrain the entries in TABLE." (orderless--ignore-case-p completion-regexp-list))) ;; If there is a regexp of the form \(?:^quoted-regexp\) then ;; remove the first such and add the unquoted form to the prefix. - (pcase (cl-some #'orderless--anchored-quoted-regexp - completion-regexp-list) + (pcase (cl-loop for r in completion-regexp-list + thereis (orderless--anchored-quoted-regexp r)) (`(,regexp . ,literal) (setq prefix (concat prefix literal) completion-regexp-list (delete regexp completion-regexp-list)))) -- cgit v1.0