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

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

[elpa] externals/ace-window 26c0ad0 36/92: ace-window.el (aw-dispatch-de


From: Stefan Monnier
Subject: [elpa] externals/ace-window 26c0ad0 36/92: ace-window.el (aw-dispatch-default): Check action
Date: Wed, 17 Mar 2021 18:39:17 -0400 (EDT)

branch: externals/ace-window
commit 26c0ad05157e9c3bf9de5f3c26bdcc2213fc35e5
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    ace-window.el (aw-dispatch-default): Check action
    
    Instead of providing defaults to destructure.
    
    Fixes #119
---
 ace-window.el | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/ace-window.el b/ace-window.el
index 1e36d34..bdba85e 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -369,32 +369,30 @@ pixels."
 (defun aw-dispatch-default (char)
   "Perform an action depending on CHAR."
   (cond ((avy-mouse-event-window char))
-       ((= char (aref (kbd "C-g") 0))
-        (throw 'done 'exit))
+        ((= char (aref (kbd "C-g") 0))
+         (throw 'done 'exit))
         ((= char aw-make-frame-char)
          (aw-use-frame (selected-window))
          (throw 'done 'exit))
-       (t
+        (t
          (let ((action (aw--dispatch-action char)))
-            ;; Prevent cl-destructuring-bind from triggering an error when
-            ;; given too few arguments.
-            (cl-destructuring-bind (_key fn &optional description) (or action 
'(nil nil nil))
-               (if action
-                  (if (and fn description)
-                       (prog1 (setq aw-action fn)
-                        (aw-set-mode-line (format " Ace - %s" description)))
-                    (funcall fn)
-                    (throw 'done 'exit))
-                ;; Remove any possible ace-window command char that may
-                ;; precede the last specified window label, so
-                ;; functions can use `avy-current-path' as the chosen
-                ;; window label.
-                (when (and (> (length avy-current-path) 0)
-                           (assq (aref avy-current-path 0) aw-dispatch-alist))
-                  (setq avy-current-path (substring avy-current-path 1)))
-                ;; Prevent any char from triggering an avy dispatch command.
-                (let ((avy-dispatch-alist))
-                  (avy-handler-default char))))))))
+           (if action
+               (cl-destructuring-bind (_key fn &optional description) action
+                 (if (and fn description)
+                     (prog1 (setq aw-action fn)
+                       (aw-set-mode-line (format " Ace - %s" description)))
+                   (funcall fn)
+                   (throw 'done 'exit)))
+             ;; Remove any possible ace-window command char that may
+             ;; precede the last specified window label, so
+             ;; functions can use `avy-current-path' as the chosen
+             ;; window label.
+             (when (and (> (length avy-current-path) 0)
+                        (assq (aref avy-current-path 0) aw-dispatch-alist))
+               (setq avy-current-path (substring avy-current-path 1)))
+             ;; Prevent any char from triggering an avy dispatch command.
+             (let ((avy-dispatch-alist))
+               (avy-handler-default char)))))))
 
 (defun aw-select (mode-line &optional action)
   "Return a selected other window.



reply via email to

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