bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Stefan Monnier
Subject: bug#20472: 24.4; Cannot switch buffers in a dedicated window - report this error earlier
Date: Sun, 03 May 2015 21:31:42 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> At your service.

Looks OK, thanks (I'm not 100% sure prompting will turn out to be a good
idea, but we can give it a try)


        Stefan


> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -6887,10 +6887,11 @@ WARNING: This is NOT the way to work on another 
> buffer temporarily
>  within a Lisp program!  Use `set-buffer' instead.  That avoids
>  messing with the window-buffer correspondences.

> -If the selected window cannot display the specified
> -buffer (e.g. if it is a minibuffer window or strongly dedicated
> -to another buffer), call `pop-to-buffer' to select the buffer in
> -another window.
> +If the selected window cannot display the specified buffer
> +because it is a minibuffer window or strongly dedicated to
> +another buffer, call `pop-to-buffer' to select the buffer in
> +another window.  In interactive use offer to undedicate the
> +selected window before.

>  If called interactively, read the buffer name using the
>  minibuffer.  The variable `confirm-nonexistent-file-or-buffer'
> @@ -6916,7 +6917,15 @@ window.

>  Return the buffer switched to."
>    (interactive
> -   (list (read-buffer-to-switch "Switch to buffer: ") nil 
> 'force-same-window))
> +   (let ((force-same-window
> +          (and (not (window-minibuffer-p))
> +               (or (not (eq (window-dedicated-p) t))
> +                   (and (y-or-n-p
> +                         (format "Window is dedicated to %s; undedicate it"
> +                                 (window-buffer)))
> +                        (or (set-window-dedicated-p nil nil) t)))
> +               'force-same-window)))
> +     (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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]