-
Notifications
You must be signed in to change notification settings - Fork 7
/
pophint-ow.el
46 lines (36 loc) · 1.23 KB
/
pophint-ow.el
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
41
42
43
44
45
46
(require 'pophint)
;;;###autoload
(defcustom pophint-ow:enable t
"Whether to enable feature."
:type 'boolean
:group 'pophint)
(make-obsolete 'pophint-config:set-do-when-other-window 'pophint-ow:enable "1.1.0")
;;;###autoload
(defun pophint:do-each-window () (interactive))
(with-no-warnings
(pophint:defsource
:name "each-window"
:description "Each window"
:source `((action . (lambda (hint)
(funcall pophint--default-action hint)
(goto-char (pophint:hint-endpt hint))))
,@pophint--next-window-source)))
(pophint:set-allwindow-command pophint:do-each-window)
(defadvice other-window (around do-pophint disable)
(if (and (called-interactively-p 'any)
(> (length (window-list)) 2))
(let ((pophint:use-pos-tip t))
(pophint:do-each-window))
ad-do-it))
;;;###autoload
(defun pophint-ow:provision (activate)
(interactive)
(if activate
(ad-enable-advice 'other-window 'around 'do-pophint)
(ad-disable-advice 'other-window 'around 'do-pophint))
(ad-activate 'other-window))
;;;###autoload
(with-eval-after-load 'pophint
(when pophint-ow:enable (pophint-ow:provision t)))
(provide 'pophint-ow)
;;; pophint-ow.el ends here