From: Martin Rudalics Date: Fri, 11 Oct 2019 07:26:41 +0000 (+0200) Subject: Minor fixes for switching to previous and next buffers (Bug#37514) X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~19^2~1544 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=64b80b42c6ac0779f4ce1152ab3e2546826eb017;p=emacs.git Minor fixes for switching to previous and next buffers (Bug#37514) * lisp/window.el (switch-to-prev-buffer) (switch-to-next-buffer): In doc-strings add links to 'prev-buffer' and 'next-buffer'. (next-buffer, previous-buffer): Signal 'user-error' instead of 'error'. In doc-strings link to 'switch-to-prev-buffer' and 'switch-to-next-buffer'. --- diff --git a/lisp/window.el b/lisp/window.el index fafb6f90ed5..d7955209cd4 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4422,7 +4422,9 @@ shall not be switched to in future invocations of this command. As a special case, if BURY-OR-KILL equals `append', this means to move the buffer to the end of WINDOW's previous buffers list so a future invocation of `switch-to-prev-buffer' less likely switches -to it." +to it. + +This function is called by `prev-buffer'." (interactive) (let* ((window (window-normalize-window window t)) (frame (window-frame window)) @@ -4545,7 +4547,7 @@ to it." "In WINDOW switch to next buffer. WINDOW must be a live window and defaults to the selected one. Return the buffer switched to, nil if no suitable buffer could be -found." +found. This function is called by `next-buffer'." (interactive) (let* ((window (window-normalize-window window t)) (frame (window-frame window)) @@ -4746,24 +4748,28 @@ displayed there." (switch-to-buffer (last-buffer))) (defun next-buffer () - "In selected window switch to next buffer." + "In selected window switch to next buffer. +Call `switch-to-next-buffer' unless the selected window is the +minibuffer window or is dedicated to its buffer." (interactive) (cond ((window-minibuffer-p) - (error "Cannot switch buffers in minibuffer window")) + (user-error "Cannot switch buffers in minibuffer window")) ((eq (window-dedicated-p) t) - (error "Window is strongly dedicated to its buffer")) + (user-error "Window is strongly dedicated to its buffer")) (t (switch-to-next-buffer)))) (defun previous-buffer () - "In selected window switch to previous buffer." + "In selected window switch to previous buffer. +Call `switch-to-prev-buffer' unless the selected window is the +minibuffer window or is dedicated to its buffer." (interactive) (cond ((window-minibuffer-p) - (error "Cannot switch buffers in minibuffer window")) + (user-error "Cannot switch buffers in minibuffer window")) ((eq (window-dedicated-p) t) - (error "Window is strongly dedicated to its buffer")) + (user-error "Window is strongly dedicated to its buffer")) (t (switch-to-prev-buffer))))