unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 20472@debbugs.gnu.org, Ed Avis <eda@waniasset.com>
Subject: bug#20472: 24.4; Cannot switch buffers in a dedicated window - report this error earlier
Date: Sat, 02 May 2015 10:57:16 +0200	[thread overview]
Message-ID: <5544916C.3020200@gmx.at> (raw)
In-Reply-To: <jwvvbgc18cv.fsf-monnier+emacsbugs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

 > AFAICT, the patch affects the switch-to-buffer function's behavior,
 > whereas I only want to affect the command bound to C-x b.
 >
 > IOW, I don't want to affect non-interactive calls.

At your service.

martin

[-- Attachment #2: switch-to-buffer.diff --]
[-- Type: text/plain, Size: 1628 bytes --]

--- 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	other threads:[~2015-05-02  8:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 15:33 bug#20472: 24.4; Cannot switch buffers in a dedicated window - report this error earlier Ed Avis
2015-04-30 16:30 ` martin rudalics
2015-05-01  1:46   ` Stefan Monnier
2015-05-01 10:41     ` martin rudalics
2015-05-01 18:06       ` Stefan Monnier
2015-05-02  8:57         ` martin rudalics [this message]
2015-05-04  1:31           ` Stefan Monnier
2015-05-05  9:18             ` martin rudalics
2015-05-20  9:47               ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5544916C.3020200@gmx.at \
    --to=rudalics@gmx.at \
    --cc=20472@debbugs.gnu.org \
    --cc=eda@waniasset.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).