unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#38384: (next|previous)-buffer silent about not switching
@ 2019-11-26 12:08 Juanma Barranquero
  2019-11-26 13:42 ` martin rudalics
  2019-11-26 15:42 ` Eli Zaretskii
  0 siblings, 2 replies; 16+ messages in thread
From: Juanma Barranquero @ 2019-11-26 12:08 UTC (permalink / raw)
  To: 38384


[-- Attachment #1.1: Type: text/plain, Size: 385 bytes --]

Package: emacs
Severity: minor
Tags: patch
X-Debbugs-Cc: rudalics@gmx.at

In some circumstances, next-buffer and previous-buffer do not have any
buffer to switch to, and in that case they silently do nothing.  (Strictly
speaking, they call switch-to-(next|prev)-buffer, which do nothing and
return nil).

I think they should throw a user-error, to inform the user about the
situation.

[-- Attachment #1.2: Type: text/html, Size: 536 bytes --]

[-- Attachment #2: window.patch --]
[-- Type: application/octet-stream, Size: 841 bytes --]

diff --git i/lisp/window.el w/lisp/window.el
index 49fad75d3c..c8a5816b8c 100644
--- i/lisp/window.el
+++ w/lisp/window.el
@@ -4850,7 +4850,8 @@ next-buffer
     (user-error "Window is strongly dedicated to its buffer"))
    (t
     (dotimes (_ (or arg 1))
-      (switch-to-next-buffer)))))
+      (unless (switch-to-next-buffer)
+        (user-error "No next buffer"))))))
 
 (defun previous-buffer (&optional arg)
   "In selected window switch to ARGth previous buffer.
@@ -4864,7 +4865,8 @@ previous-buffer
     (user-error "Window is strongly dedicated to its buffer"))
    (t
     (dotimes (_ (or arg 1))
-      (switch-to-prev-buffer)))))
+      (unless (switch-to-prev-buffer)
+        (user-error "No previous buffer"))))))
 
 (defun delete-windows-on (&optional buffer-or-name frame)
   "Delete all windows showing BUFFER-OR-NAME.

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-11-26 20:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 12:08 bug#38384: (next|previous)-buffer silent about not switching Juanma Barranquero
2019-11-26 13:42 ` martin rudalics
2019-11-26 14:05   ` Juanma Barranquero
2019-11-26 15:42 ` Eli Zaretskii
2019-11-26 15:54   ` Juanma Barranquero
2019-11-26 16:00     ` Juanma Barranquero
2019-11-26 17:00       ` martin rudalics
2019-11-26 18:04       ` Eli Zaretskii
2019-11-26 18:23         ` Juanma Barranquero
2019-11-26 18:44           ` Eli Zaretskii
2019-11-26 18:51             ` Juanma Barranquero
2019-11-26 19:37               ` Eli Zaretskii
2019-11-26 19:56                 ` Juanma Barranquero
2019-11-26 20:07                   ` Eli Zaretskii
2019-11-26 17:00     ` martin rudalics
2019-11-26 18:03     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).