branch: externals/jinx
commit 75e8e4805fe6f4ab256bd59bec71464edbc23887
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
Context menu: Use submenu for accept and save
---
jinx.el | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/jinx.el b/jinx.el
index 9da85d2bf2..791c7755a3 100644
--- a/jinx.el
+++ b/jinx.el
@@ -857,15 +857,16 @@ Optionally show prompt INFO and insert INITIAL input."
(push ["── Session ──" :active nil] menu)
(cl-loop for w in suggestions repeat jinx-menu-suggestions do
(push `[,w (jinx--correct-replace ,ov ,w)] menu)))
- (push ["── Accept and save ──" :active nil] menu)
- (cl-loop for (key . fun) in jinx--save-keys
- for actions = (funcall fun nil key word) do
- (unless (consp (car actions)) (setq actions (list actions)))
- (cl-loop for (k w a) in actions do
- (push `[,a (jinx-correct-word
- ,(overlay-start ov) ,(overlay-end ov)
- ,(concat (if (stringp k) k (char-to-string
k)) w))]
- menu)))
+ (let ((submenu (list "Accept and save")))
+ (cl-loop for (key . fun) in jinx--save-keys
+ for actions = (funcall fun nil key word) do
+ (unless (consp (car actions)) (setq actions (list actions)))
+ (cl-loop for (k w a) in actions do
+ (push `[,a (jinx-correct-word
+ ,(overlay-start ov) ,(overlay-end ov)
+ ,(concat (if (stringp k) k
(char-to-string k)) w))]
+ submenu)))
+ (push (nreverse submenu) menu))
(easy-menu-create-menu (format "Correct \"%s\"" word)
(delete-dups (nreverse menu))))))