blob: 9e631a2627afb4f454e0c4560ec3c26390011f07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
;;; +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 ; Enable
(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))
(progn ; Disable
(remove-hook 'window-configuration-change-hook 'aw-update)
(remove-hook 'after-make-frame-functions 'aw--after-make-frame)
(advice-remove 'aw--lead-overlay 'ignore))))
;; (defun +ace-window--mode-line-hint (path leaf)
;; (let ((wnd (cdr leaf)))
;; (with-selected-window wnd
;; ())))
;;;###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)))
(provide '+ace-window)
;;; +ace-window.el ends here
|