From 5abc8cfd33f7ad03ceb3fe7b35fbcdc732c0193a Mon Sep 17 00:00:00 2001 From: Justin Burkett Date: Sat, 29 Oct 2016 08:34:42 -0400 Subject: [PATCH] Add sort option -prefix-then-key-order-reverse Fixes #145 --- which-key.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/which-key.el b/which-key.el index c17a1c7a3eb..70372675ce9 100644 --- a/which-key.el +++ b/which-key.el @@ -1176,6 +1176,16 @@ coming before a prefix. Within these categories order using (and (not apref?) bpref?) (which-key-key-order acons bcons)))) +(defun which-key-prefix-then-key-order-reverse (acons bcons) + "Order first by whether A and/or B is a prefix with prefix +coming before a prefix. Within these categories order using +`which-key-key-order'." + (let ((apref? (which-key--group-p (cdr acons))) + (bpref? (which-key--group-p (cdr bcons)))) + (if (not (eq apref? bpref?)) + (and apref? (not bpref?)) + (which-key-key-order acons bcons)))) + (defun which-key-local-then-key-order (acons bcons) "Order first by whether A and/or B is a local binding with local bindings coming first. Within these categories order using