aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2019-10-25 16:39:54 +0200
committerJuanma Barranquero2019-10-25 16:39:54 +0200
commitd56e84409d49641b9acd78346dfe0c271825407e (patch)
treeaa9a37ba6e60b5f01f641d4bafb9bcd59e237aaf
parent17db4a0a02157457cf0d2a6f6c3afa5184e118be (diff)
downloademacs-d56e84409d49641b9acd78346dfe0c271825407e.tar.gz
emacs-d56e84409d49641b9acd78346dfe0c271825407e.zip
windmove.el: Suppress warnings for obsolete functions
* lisp/windmove.el (windmove-constrain-loc-for-movement) (windmove-wrap-loc-for-movement, windmove-reference-loc) (windmove-other-window-loc): Wrap calls to obsolete functions in `with-suppressed-warnings'.
-rw-r--r--lisp/windmove.el93
1 files changed, 50 insertions, 43 deletions
diff --git a/lisp/windmove.el b/lisp/windmove.el
index d5c6e348bef..16a5ca81284 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -222,26 +222,28 @@ is the direction of the movement, one of `left', `up', `right',
222or `down'. 222or `down'.
223Returns the constrained coordinate." 223Returns the constrained coordinate."
224 (declare (obsolete "no longer used." "27.1")) 224 (declare (obsolete "no longer used." "27.1"))
225 (let ((frame-edges (windmove-frame-edges window)) 225 (with-suppressed-warnings ((obsolete windmove-frame-edges
226 (in-minibuffer (window-minibuffer-p window))) 226 windmove-constrain-to-range))
227 (let ((min-x (nth 0 frame-edges)) 227 (let ((frame-edges (windmove-frame-edges window))
228 (min-y (nth 1 frame-edges)) 228 (in-minibuffer (window-minibuffer-p window)))
229 (max-x (nth 2 frame-edges)) 229 (let ((min-x (nth 0 frame-edges))
230 (max-y (nth 3 frame-edges))) 230 (min-y (nth 1 frame-edges))
231 (let ((new-x 231 (max-x (nth 2 frame-edges))
232 (if (memq dir '(up down)) ; vertical movement 232 (max-y (nth 3 frame-edges)))
233 (windmove-constrain-to-range (car coord) min-x max-x) 233 (let ((new-x
234 (car coord))) 234 (if (memq dir '(up down)) ; vertical movement
235 (new-y 235 (windmove-constrain-to-range (car coord) min-x max-x)
236 (if (or (memq dir '(left right)) ; horizontal movement 236 (car coord)))
237 (and (eq dir 'down) 237 (new-y
238 (not in-minibuffer))) ; don't miss minibuffer 238 (if (or (memq dir '(left right)) ; horizontal movement
239 ;; (technically, we shouldn't constrain on min-y in the 239 (and (eq dir 'down)
240 ;; second case, but this shouldn't do any harm on a 240 (not in-minibuffer))) ; don't miss minibuffer
241 ;; down movement.) 241 ;; (technically, we shouldn't constrain on min-y in the
242 (windmove-constrain-to-range (cdr coord) min-y max-y) 242 ;; second case, but this shouldn't do any harm on a
243 (cdr coord)))) 243 ;; down movement.)
244 (cons new-x new-y))))) 244 (windmove-constrain-to-range (cdr coord) min-y max-y)
245 (cdr coord))))
246 (cons new-x new-y))))))
245 247
246(defun windmove-wrap-loc-for-movement (coord window) 248(defun windmove-wrap-loc-for-movement (coord window)
247 "Takes the constrained COORD and wraps it around for the movement. 249 "Takes the constrained COORD and wraps it around for the movement.
@@ -250,22 +252,24 @@ frame, giving a coordinate (hopefully) in the window on the other edge
250of the frame. WINDOW is the window that movement is relative to (nil 252of the frame. WINDOW is the window that movement is relative to (nil
251means the currently selected window). Returns the wrapped coordinate." 253means the currently selected window). Returns the wrapped coordinate."
252 (declare (obsolete "no longer used." "27.1")) 254 (declare (obsolete "no longer used." "27.1"))
253 (let* ((frame-edges (windmove-frame-edges window)) 255 (with-suppressed-warnings ((obsolete windmove-frame-edges
254 (frame-minibuffer (minibuffer-window (if window 256 windmove-constrain-around-range))
255 (window-frame window) 257 (let* ((frame-edges (windmove-frame-edges window))
256 (selected-frame)))) 258 (frame-minibuffer (minibuffer-window (if window
257 (minibuffer-active (minibuffer-window-active-p 259 (window-frame window)
260 (selected-frame))))
261 (minibuffer-active (minibuffer-window-active-p
258 frame-minibuffer))) 262 frame-minibuffer)))
259 (let ((min-x (nth 0 frame-edges)) 263 (let ((min-x (nth 0 frame-edges))
260 (min-y (nth 1 frame-edges)) 264 (min-y (nth 1 frame-edges))
261 (max-x (nth 2 frame-edges)) 265 (max-x (nth 2 frame-edges))
262 (max-y (if (not minibuffer-active) 266 (max-y (if (not minibuffer-active)
263 (- (nth 3 frame-edges) 267 (- (nth 3 frame-edges)
264 (window-height frame-minibuffer)) 268 (window-height frame-minibuffer))
265 (nth 3 frame-edges)))) 269 (nth 3 frame-edges))))
266 (cons 270 (cons
267 (windmove-constrain-around-range (car coord) min-x max-x) 271 (windmove-constrain-around-range (car coord) min-x max-x)
268 (windmove-constrain-around-range (cdr coord) min-y max-y))))) 272 (windmove-constrain-around-range (cdr coord) min-y max-y))))))
269 273
270(defun windmove-reference-loc (&optional arg window) 274(defun windmove-reference-loc (&optional arg window)
271 "Return the reference location for directional window selection. 275 "Return the reference location for directional window selection.
@@ -289,13 +293,14 @@ supplied, if ARG is greater or smaller than zero, respectively."
289 ((< effective-arg 0) 293 ((< effective-arg 0)
290 bottom-right) 294 bottom-right)
291 ((= effective-arg 0) 295 ((= effective-arg 0)
292 (windmove-coord-add 296 (with-suppressed-warnings ((obsolete windmove-coord-add))
293 top-left 297 (windmove-coord-add
294 ;; Don't care whether window is horizontally scrolled - 298 top-left
295 ;; `posn-at-point' handles that already. See also: 299 ;; Don't care whether window is horizontally scrolled -
296 ;; https://lists.gnu.org/r/emacs-devel/2012-01/msg00638.html 300 ;; `posn-at-point' handles that already. See also:
297 (posn-col-row 301 ;; https://lists.gnu.org/r/emacs-devel/2012-01/msg00638.html
298 (posn-at-point (window-point window) window)))))))) 302 (posn-col-row
303 (posn-at-point (window-point window) window)))))))))
299 304
300(defun windmove-other-window-loc (dir &optional arg window) 305(defun windmove-other-window-loc (dir &optional arg window)
301 "Return a location in the window to be moved to. 306 "Return a location in the window to be moved to.
@@ -305,7 +310,9 @@ is handled as by `windmove-reference-loc'; WINDOW is the window that
305movement is relative to." 310movement is relative to."
306 (declare (obsolete "no longer used." "27.1")) 311 (declare (obsolete "no longer used." "27.1"))
307 (let ((edges (window-edges window)) ; edges: (x0, y0, x1, y1) 312 (let ((edges (window-edges window)) ; edges: (x0, y0, x1, y1)
308 (refpoint (windmove-reference-loc arg window))) ; (x . y) 313 (refpoint (with-suppressed-warnings
314 ((obsolete windmove-reference-loc))
315 (windmove-reference-loc arg window)))) ; (x . y)
309 (cond 316 (cond
310 ((eq dir 'left) 317 ((eq dir 'left)
311 (cons (- (nth 0 edges) 318 (cons (- (nth 0 edges)