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

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

[elpa] externals/orderless 7545dc7c07 2/2: Merge pull request #166 from


From: ELPA Syncer
Subject: [elpa] externals/orderless 7545dc7c07 2/2: Merge pull request #166 from minad/fix-affix-dispatch
Date: Thu, 29 Feb 2024 21:58:24 -0500 (EST)

branch: externals/orderless
commit 7545dc7c07d1465e9661209ca5930ae3f1a870a3
Merge: 2e904412e4 c94c252ea8
Author: Omar AntolĂ­n Camarena <omar.antolin@gmail.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #166 from minad/fix-affix-dispatch
    
    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]