From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs 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 Message-ID: <5544916C.3020200@gmx.at> References: <7E039918541B4C4183BFDB8F015C743032E18D99@WCL-EXCH02.wcl.local> <55425888.6080106@gmx.at> <55435866.40006@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080108020104020400010307" X-Trace: ger.gmane.org 1430557284 15376 80.91.229.3 (2 May 2015 09:01:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 May 2015 09:01:24 +0000 (UTC) Cc: 20472@debbugs.gnu.org, Ed Avis To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 02 11:01:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YoTIP-0006gc-4y for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 May 2015 11:01:13 +0200 Original-Received: from localhost ([::1]:56429 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoTIO-00048F-Bk for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 May 2015 05:01:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoTIK-000485-Ob for bug-gnu-emacs@gnu.org; Sat, 02 May 2015 05:01:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YoTII-0001nP-6S for bug-gnu-emacs@gnu.org; Sat, 02 May 2015 05:01:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoTII-0001nF-3U for bug-gnu-emacs@gnu.org; Sat, 02 May 2015 05:01:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YoTIH-0004s1-Sy for bug-gnu-emacs@gnu.org; Sat, 02 May 2015 05:01:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 May 2015 09:01:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20472 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20472-submit@debbugs.gnu.org id=B20472.143055724118639 (code B ref 20472); Sat, 02 May 2015 09:01:05 +0000 Original-Received: (at 20472) by debbugs.gnu.org; 2 May 2015 09:00:41 +0000 Original-Received: from localhost ([127.0.0.1]:59112 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YoTHr-0004qT-I8 for submit@debbugs.gnu.org; Sat, 02 May 2015 05:00:40 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:56343) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YoTHo-0004qC-Sa for 20472@debbugs.gnu.org; Sat, 02 May 2015 05:00:37 -0400 Original-Received: from [194.118.143.216] ([194.118.143.216]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0Lg6op-1ZdmSm0ziV-00pfT8; Sat, 02 May 2015 11:00:27 +0200 In-Reply-To: X-Provags-ID: V03:K0:WrHKO4mrKZYXChgp13aEPsP0dLAJKBE8mj2rBCVQdZQx5OvNV1k VfOTZcVNgfAQAvn63fqpfE4og/FHKREW0FRxK/Ajq8zRnDWPNpcBV6PG0qpj+qDlwGo1wkn 4oPiRUbBNjQrBssD24s561YYFhdFv3Ul9J0HzS4kjnzJmsA4Roj2ULifWakjCARuULb4dtW Vue6kDvNPcauNu8LG87xg== X-UI-Out-Filterresults: notjunk:1; X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:102360 Archived-At: This is a multi-part message in MIME format. --------------080108020104020400010307 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > 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 --------------080108020104020400010307 Content-Type: text/plain; charset=windows-1252; name="switch-to-buffer.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="switch-to-buffer.diff" --- 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 --------------080108020104020400010307--