[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20472: 24.4; Cannot switch buffers in a dedicated window - report th
From: |
martin rudalics |
Subject: |
bug#20472: 24.4; Cannot switch buffers in a dedicated window - report this error earlier |
Date: |
Thu, 30 Apr 2015 18:30:00 +0200 |
> Sometimes Emacs creates a small window such as *log-edit-files*.
> If you go to that window and do C-x b, you enter the name of the buffer
> to switch to as usual, but then see the error
>
> Cannot switch buffers in a dedicated window
>
> This error message should appear earlier, as soon as C-x b is given.
> Emacs should not ask you to type in the new buffer name before it tells
> you that switching buffers is not allowed.
Indeed. Unless someone has a better idea I'll install something like the below.
martin
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6916,7 +6916,13 @@ window.
Return the buffer switched to."
(interactive
- (list (read-buffer-to-switch "Switch to buffer: ") nil 'force-same-window))
+ (cond
+ ((eq (window-dedicated-p) t)
+ (user-error "Cannot switch buffers in a dedicated window"))
+ ((window-minibuffer-p)
+ (user-error "Cannot switch buffers in minibuffer window"))
+ (t
+ (list (read-buffer-to-switch "Switch to buffer: ") nil
'force-same-window))))
(let ((buffer (window-normalize-buffer-to-switch-to buffer-or-name)))
(cond
;; Don't call set-window-buffer if it's not needed since it