emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/orderless c94c252ea8 1/2: orderless-affix-dispatch: Do


From: ELPA Syncer
Subject: [elpa] externals/orderless c94c252ea8 1/2: orderless-affix-dispatch: Do not error on empty string
Date: Thu, 29 Feb 2024 21:58:23 -0500 (EST)

branch: externals/orderless
commit c94c252ea8e53082f6f3ef3f37b44b3872a0825c
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    orderless-affix-dispatch: Do not error on empty string
---
 orderless.el | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/orderless.el b/orderless.el
index e9d9f31ee9..01862412db 100644
--- a/orderless.el
+++ b/orderless.el
@@ -160,19 +160,18 @@ If the COMPONENT starts or ends with one of the 
characters used
 as a key in `orderless-affix-dispatch-alist', then that character
 is removed and the remainder of the COMPONENT is matched in the
 style associated to the character."
-  (cond
-   ;; Ignore single dispatcher character
-   ((and (= (length component) 1) (alist-get (aref component 0)
-                                             orderless-affix-dispatch-alist))
-    #'ignore)
-   ;; Prefix
-   ((when-let ((style (alist-get (aref component 0)
-                                 orderless-affix-dispatch-alist)))
-      (cons style (substring component 1))))
-   ;; Suffix
-   ((when-let ((style (alist-get (aref component (1- (length component)))
-                                 orderless-affix-dispatch-alist)))
-      (cons style (substring component 0 -1))))))
+  (let ((len (length component))
+        (alist orderless-affix-dispatch-alist))
+    (when (> len 0)
+      (cond
+       ;; Ignore single dispatcher character
+       ((and (= len 1) (alist-get (aref component 0) alist)) #'ignore)
+       ;; Prefix
+       ((when-let ((style (alist-get (aref component 0) alist)))
+          (cons style (substring component 1))))
+       ;; Suffix
+       ((when-let ((style (alist-get (aref component (1- len)) alist)))
+          (cons style (substring component 0 -1))))))))
 
 (defcustom orderless-style-dispatchers (list #'orderless-affix-dispatch)
   "List of style dispatchers.



reply via email to

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