Function: windmove-constrain-loc-for-movement
windmove-constrain-loc-for-movement is a byte-compiled function
defined in windmove.el.gz.
This function is obsolete since 27.1; no longer used.
Signature
(windmove-constrain-loc-for-movement COORD WINDOW DIR)
Documentation
Constrain COORD so that it is reasonable for the given movement.
This involves two things: first, make sure that the "off" coordinate
-- the one not being moved on, e.g., y for horizontal movement -- is
within frame boundaries; second, if the movement is down and we're not
moving from the minibuffer, make sure that the y coordinate does not
exceed the frame max-y, so that we don't overshoot the minibuffer
accidentally. WINDOW is the window that movement is relative to; DIR
is the direction of the movement, one of left, up, right,
or down.
Returns the constrained coordinate.
Probably introduced at or before Emacs version 27.1.
Source Code
;; Defined in /usr/src/emacs/lisp/windmove.el.gz
(defun windmove-constrain-loc-for-movement (coord window dir)
"Constrain COORD so that it is reasonable for the given movement.
This involves two things: first, make sure that the \"off\" coordinate
-- the one not being moved on, e.g., y for horizontal movement -- is
within frame boundaries; second, if the movement is down and we're not
moving from the minibuffer, make sure that the y coordinate does not
exceed the frame max-y, so that we don't overshoot the minibuffer
accidentally. WINDOW is the window that movement is relative to; DIR
is the direction of the movement, one of `left', `up', `right',
or `down'.
Returns the constrained coordinate."
(declare (obsolete "no longer used." "27.1"))
(with-suppressed-warnings ((obsolete windmove-frame-edges
windmove-constrain-to-range))
(let ((frame-edges (windmove-frame-edges window))
(in-minibuffer (window-minibuffer-p window)))
(let ((min-x (nth 0 frame-edges))
(min-y (nth 1 frame-edges))
(max-x (nth 2 frame-edges))
(max-y (nth 3 frame-edges)))
(let ((new-x
(if (memq dir '(up down)) ; vertical movement
(windmove-constrain-to-range (car coord) min-x max-x)
(car coord)))
(new-y
(if (or (memq dir '(left right)) ; horizontal movement
(and (eq dir 'down)
(not in-minibuffer))) ; don't miss minibuffer
;; (technically, we shouldn't constrain on min-y in the
;; second case, but this shouldn't do any harm on a
;; down movement.)
(windmove-constrain-to-range (cdr coord) min-y max-y)
(cdr coord))))
(cons new-x new-y))))))