41 lines
1.3 KiB
EmacsLisp
41 lines
1.3 KiB
EmacsLisp
;;; +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
|