other-window-in-any-frame now accepts negative args (from phob on reddit)

This commit is contained in:
Sami Samhuri 2010-07-18 15:56:01 -06:00
parent 5acad3ea7f
commit 177b6c893d

11
emacs
View file

@ -401,14 +401,19 @@ switch to that frame first using `select-frame-set-input-focus'.
If N is non-nil switch to the nth next window."
(interactive "p")
(while (> arg 0)
(let ((window (next-window (selected-window) nil 'visible)))
(setq arg (or arg 1))
(let ((gt-or-lt (if (> arg 0) #'> #'<))
(sign (if (> arg 0) 1 -1)))
(while (apply gt-or-lt arg '(0))
(let ((window (if (= sign 1)
(next-window (selected-window) nil 'visible)
(previous-window (selected-window) nil 'visible))))
(when (not (member window (window-list)))
(dolist (frame (delq (selected-frame) (frame-list)))
(when (member window (window-list frame))
(select-frame-set-input-focus frame))))
(select-window window))
(decf arg)))
(setq arg (- arg sign)))))
;; Reload the .emacs file with a minimum of effort,
;; first saving histories with Persistent