diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-11-10 12:19:35 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-11-10 15:41:44 +0100 |
| commit | 6a9ac850727f54980003dfa4a25aafad7976459c (patch) | |
| tree | 7a325d79d905ccd1fc9891b5d85ea24254333c97 | |
| parent | b38a8e85d605c1018e4c8ba7beacb1ec6708a810 (diff) | |
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
| -rw-r--r-- | orderless.el | 6 |
1 files 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)))) |
