Subject: bug#32850: 27.0.50; window-swap-states doesn't swap window prev/next-buffers

From: Juri Linkov <[email-masked]>
Date: Mon, 19 Nov 2018 00:47:34 +0200

>>> C-x <left> and C-x <right> do not yet support prefix args, right?
>>
>> Right, we need to support prefix args of C-x <left> and C-x <right>.
>
> Could you do that please?

Like this?

diff --git a/lisp/window.el b/lisp/window.el
index 172ee72997..1d3133c359 100644
*** a/lisp/window.el
--- b/lisp/window.el
***************
*** 4664,4690 ****
    (interactive)
    (switch-to-buffer (last-buffer)))
  
! (defun next-buffer ()
!   "In selected window switch to next buffer."
!   (interactive)
    (cond
     ((window-minibuffer-p)
      (error "Cannot switch buffers in minibuffer window"))
     ((eq (window-dedicated-p) t)
      (error "Window is strongly dedicated to its buffer"))
!    (t
!     (switch-to-next-buffer))))
! 
! (defun previous-buffer ()
!   "In selected window switch to previous buffer."
!   (interactive)
    (cond
     ((window-minibuffer-p)
      (error "Cannot switch buffers in minibuffer window"))
     ((eq (window-dedicated-p) t)
      (error "Window is strongly dedicated to its buffer"))
!    (t
!     (switch-to-prev-buffer))))
  
  (defun delete-windows-on (&optional buffer-or-name frame)
    "Delete all windows showing BUFFER-OR-NAME.
--- 4664,4698 ----
    (interactive)
    (switch-to-buffer (last-buffer)))
  
! (defun next-buffer (&optional arg)
!   "In selected window switch to next buffer.
! With a prefix argument, switch to ARGth next buffer."
!   (interactive "p")
    (cond
     ((window-minibuffer-p)
      (error "Cannot switch buffers in minibuffer window"))
     ((eq (window-dedicated-p) t)
      (error "Window is strongly dedicated to its buffer"))
!    (t (setq arg (or arg 1))
!       (if (< arg 0)
!           (previous-buffer (abs arg))
!         (while (<= 0 (setq arg (1- arg)))
!           (switch-to-next-buffer))))))
! 
! (defun previous-buffer (&optional arg)
!   "In selected window switch to previous buffer.
! With a prefix argument, switch to ARGth previous buffer."
!   (interactive "p")
    (cond
     ((window-minibuffer-p)
      (error "Cannot switch buffers in minibuffer window"))
     ((eq (window-dedicated-p) t)
      (error "Window is strongly dedicated to its buffer"))
!    (t (setq arg (or arg 1))
!       (if (< arg 0)
!           (next-buffer (abs arg))
!         (while (<= 0 (setq arg (1- arg)))
!           (switch-to-prev-buffer))))))
  
  (defun delete-windows-on (&optional buffer-or-name frame)
    "Delete all windows showing BUFFER-OR-NAME.