From 3665daffc129cd0d007c940d5b75c2c702a6e14c Mon Sep 17 00:00:00 2001 From: Oleh Krehel Date: Tue, 14 Nov 2017 19:10:42 +0100 Subject: [PATCH] ace-window.el (aw-dispatch-default): No error on "C-g" Fixes #108 --- ace-window.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/ace-window.el b/ace-window.el index e4c9f8a..1e3b40f 100644 --- a/ace-window.el +++ b/ace-window.el @@ -283,15 +283,17 @@ LEAF is (PT . WND)." (defun aw-dispatch-default (char) "Perform an action depending on CHAR." - (let ((action (aw--dispatch-action char))) - (cl-destructuring-bind (_key fn &optional description) (aw--dispatch-action char) - (if action - (if (and fn description) - (prog1 (setq aw-action fn) - (aw-set-mode-line (format " Ace - %s" description))) - (funcall fn) - (throw 'done 'exit)) - (avy-handler-default char))))) + (if (= char (aref (kbd "C-g") 0)) + (throw 'done 'exit) + (let ((action (aw--dispatch-action char))) + (cl-destructuring-bind (_key fn &optional description) (aw--dispatch-action char) + (if action + (if (and fn description) + (prog1 (setq aw-action fn) + (aw-set-mode-line (format " Ace - %s" description))) + (funcall fn) + (throw 'done 'exit)) + (avy-handler-default char)))))) (defun aw-select (mode-line &optional action) "Return a selected other window.