Have 'window-in-direction' handle 'up' and 'down' values (Bug#32790)

* lisp/window.el (window-in-direction): Handle values of 'up'
and 'down' for DIRECTION argument (Bug#32790).  Suggested by
Juri Linkov <juri@linkov.net>.
* lisp/windmove.el (windmove-find-other-window): Don't convert
first argument of 'window-in-direction'.
This commit is contained in:
Martin Rudalics 2018-10-18 09:11:30 +02:00
parent e511b9dd6a
commit 46106eec16
2 changed files with 8 additions and 8 deletions

View file

@ -464,12 +464,7 @@ movement is relative to."
(defun windmove-find-other-window (dir &optional arg window)
"Return the window object in direction DIR.
DIR, ARG, and WINDOW are handled as by `windmove-other-window-loc'."
(window-in-direction
(cond
((eq dir 'up) 'above)
((eq dir 'down) 'below)
(t dir))
window nil arg windmove-wrap-around t))
(window-in-direction dir window nil arg windmove-wrap-around t))
;; Selects the window that's hopefully at the location returned by
;; `windmove-other-window-loc', or screams if there's no window there.

View file

@ -2288,8 +2288,13 @@ if WRAP is non-nil, always act as if MINI were nil.
Return nil if no suitable window can be found."
(setq window (window-normalize-window window t))
(unless (memq direction '(above below left right))
(error "Wrong direction %s" direction))
(cond
((eq direction 'up)
(setq direction 'above))
((eq direction 'down)
(setq direction 'below))
((not (memq direction '(above below left right)))
(error "Wrong direction %s" direction)))
(let* ((frame (window-frame window))
(hor (memq direction '(left right)))
(first (if hor