Skip to content

Commit

Permalink
improve(ace-window): simplify dispatch alist
Browse files Browse the repository at this point in the history
Overrides the dispatch alist that just contains deleting windows and
using `consult-buffer`.
  • Loading branch information
Walheimat committed Jun 11, 2024
1 parent fd67f40 commit f942f98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/wal-windows.org
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,18 @@ Everything that has to do with windows.
Super-charged =other-window=.

#+begin_src emacs-lisp
(defun wal-aw-consult-buffer (window)
"Switch to WINDOW and then `consult-buffer'."
(aw-switch-to-window window)
(call-interactively 'consult-buffer))

(use-package ace-window
:config
(setq aw-dispatch-alist
`((?0 aw-delete-window "Delete window")
(?, wal-aw-consult-buffer "Consult buffer")
(?? aw-show-dispatch-help)))

:custom
(aw-keys '(?j ?k ?l ?\; ?h ?a ?s ?d ?f ?g))
(aw-dispatch-always t)
Expand Down
11 changes: 11 additions & 0 deletions test/wal-windows-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@

(require 'wal-windows nil t)

(ert-deftest wal-aw-consult-buffer ()
:tags '(window)

(bydi (aw-switch-to-window
consult-buffer)

(wal-aw-consult-buffer 'window)

(bydi-was-called-with aw-switch-to-window 'window)
(bydi-was-called consult-buffer)))

;;; wal-windows-test.el ends here

;; Local Variables:
Expand Down

0 comments on commit f942f98

Please sign in to comment.