Skip to content

Commit 9900b14

Browse files
committed
* lisp/window.el: Avoid called-interactively-p.
(other-window, delete-other-windows, next-buffer, previous-buffer): Use an `interactive` arg instead.
1 parent 317065c commit 9900b14

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

lisp/window.el

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3911,7 +3911,7 @@ TOP RIGHT BOTTOM) as returned by `window-edges'."
39113911
(setq frame (window-normalize-frame frame))
39123912
(window--subtree (frame-root-window frame) t))
39133913

3914-
(defun other-window (count &optional all-frames)
3914+
(defun other-window (count &optional all-frames interactive)
39153915
"Select another window in cyclic ordering of windows.
39163916
COUNT specifies the number of windows to skip, starting with the
39173917
selected window, before making the selection. If COUNT is
@@ -3931,7 +3931,7 @@ This function uses `next-window' for finding the window to
39313931
select. The argument ALL-FRAMES has the same meaning as in
39323932
`next-window', but the MINIBUF argument of `next-window' is
39333933
always effectively nil."
3934-
(interactive "p")
3934+
(interactive "p\ni\np")
39353935
(let* ((window (selected-window))
39363936
(original-window window)
39373937
(function (and (not ignore-window-parameters)
@@ -3977,7 +3977,8 @@ always effectively nil."
39773977
(setq count (1+ count)))))
39783978

39793979
(when (and (eq window original-window)
3980-
(called-interactively-p 'interactive))
3980+
interactive
3981+
(not (or executing-kbd-macro noninteractive)))
39813982
(message "No other window to select"))
39823983

39833984
(select-window window)
@@ -4192,7 +4193,7 @@ that is its frame's root window."
41924193
;; Always return nil.
41934194
nil))))
41944195

4195-
(defun delete-other-windows (&optional window)
4196+
(defun delete-other-windows (&optional window interactive)
41964197
"Make WINDOW fill its frame.
41974198
WINDOW must be a valid window and defaults to the selected one.
41984199
Return nil.
@@ -4209,7 +4210,7 @@ with the root of the atomic window as its argument. Signal an
42094210
error if that root window is the root window of WINDOW's frame.
42104211
Also signal an error if WINDOW is a side window. Do not delete
42114212
any window whose `no-delete-other-windows' parameter is non-nil."
4212-
(interactive)
4213+
(interactive "i\np")
42134214
(setq window (window-normalize-window window))
42144215
(let* ((frame (window-frame window))
42154216
(function (window-parameter window 'delete-other-windows))
@@ -4275,7 +4276,8 @@ any window whose `no-delete-other-windows' parameter is non-nil."
42754276
(if (eq window main)
42764277
;; Give a message to the user if this has been called as a
42774278
;; command.
4278-
(when (called-interactively-p 'interactive)
4279+
(when (and interactive
4280+
(not (or executing-kbd-macro noninteractive)))
42794281
(message "No other windows to delete"))
42804282
(delete-other-windows-internal window main)
42814283
(window--check frame))
@@ -4838,11 +4840,11 @@ displayed there."
48384840
(interactive)
48394841
(switch-to-buffer (last-buffer)))
48404842

4841-
(defun next-buffer (&optional arg)
4843+
(defun next-buffer (&optional arg interactive)
48424844
"In selected window switch to ARGth next buffer.
48434845
Call `switch-to-next-buffer' unless the selected window is the
48444846
minibuffer window or is dedicated to its buffer."
4845-
(interactive "p")
4847+
(interactive "p\np")
48464848
(cond
48474849
((window-minibuffer-p)
48484850
(user-error "Cannot switch buffers in minibuffer window"))
@@ -4851,14 +4853,15 @@ minibuffer window or is dedicated to its buffer."
48514853
(t
48524854
(dotimes (_ (or arg 1))
48534855
(when (and (not (switch-to-next-buffer))
4854-
(called-interactively-p 'interactive))
4856+
interactive
4857+
(not (or executing-kbd-macro noninteractive)))
48554858
(user-error "No next buffer"))))))
48564859

4857-
(defun previous-buffer (&optional arg)
4860+
(defun previous-buffer (&optional arg interactive)
48584861
"In selected window switch to ARGth previous buffer.
48594862
Call `switch-to-prev-buffer' unless the selected window is the
48604863
minibuffer window or is dedicated to its buffer."
4861-
(interactive "p")
4864+
(interactive "p\np")
48624865
(cond
48634866
((window-minibuffer-p)
48644867
(user-error "Cannot switch buffers in minibuffer window"))
@@ -4867,7 +4870,8 @@ minibuffer window or is dedicated to its buffer."
48674870
(t
48684871
(dotimes (_ (or arg 1))
48694872
(when (and (not (switch-to-prev-buffer))
4870-
(called-interactively-p 'interactive))
4873+
interactive
4874+
(not (or executing-kbd-macro noninteractive)))
48714875
(user-error "No previous buffer"))))))
48724876

48734877
(defun delete-windows-on (&optional buffer-or-name frame)

0 commit comments

Comments
 (0)