From 506b6c66fee75b1c5d3a94527c0f3945805ce1b8 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 17 Dec 2021 18:29:58 -0600 Subject: Add ace-window --- lisp/+ace-window.el | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lisp/+ace-window.el (limited to 'lisp') diff --git a/lisp/+ace-window.el b/lisp/+ace-window.el new file mode 100644 index 0000000..fca27d9 --- /dev/null +++ b/lisp/+ace-window.el @@ -0,0 +1,37 @@ +;;; +ace-window.el -*- lexical-binding: t; -*- + +;;; Code: + +(require 'ace-window) + +;;;###autoload +(define-minor-mode +ace-window-display-mode + "Minor mode for updating data for `+modeline-ace-window-display'." + ;; This is stolen from ace-window.el but with the mode-line stuff ripped out. + :global t + (if +ace-window-display-mode + (progn + (aw-update) + (force-mode-line-update t) + (add-hook 'window-configuration-change-hook 'aw-update) + (add-hook 'after-make-frame-functions 'aw--after-make-frame t) + (advice-add 'aw--lead-overlay :override 'ignore)) + (remove-hook 'window-configuration-change-hook 'aw-update) + (remove-hook 'after-make-frame-functions 'aw--after-make-frame) + (advice-remove 'aw--lead-overlay 'ignore))) + +;;;###autoload +(defun +ace-window-or-switch-buffer (arg) + "Call `ace-window' with ARG if more than one window is visible. +Switch to most recent buffer otherwise." + ;; cribbed from `crux-other-window-or-switch-buffer' + (interactive "p") + (if (one-window-p) + (switch-to-buffer nil) + (ace-window arg))) + +(defun +ace-window@disable-overlay (_fn &rest _args) + "ADVICE for FN `aw--lead-overlay' (and ARGS) to not show overlays.") + +(provide '+ace-window) +;;; +ace-window.el ends here -- cgit 1.4.1-21-gabe81