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: Fri, 01 May 2015 12:41:42 +0200 Message-ID: <55435866.40006@gmx.at> References: <7E039918541B4C4183BFDB8F015C743032E18D99@WCL-EXCH02.wcl.local> <55425888.6080106@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020504030004070904070100" X-Trace: ger.gmane.org 1430477006 17226 80.91.229.3 (1 May 2015 10:43:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 May 2015 10:43:26 +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 Fri May 01 12:43:15 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 1Yo8PZ-0005P3-N8 for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 May 2015 12:43:13 +0200 Original-Received: from localhost ([::1]:53508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yo8PY-0008Bq-TF for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 May 2015 06:43:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yo8PT-0008Ba-Ky for bug-gnu-emacs@gnu.org; Fri, 01 May 2015 06:43:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yo8PP-00064Q-OE for bug-gnu-emacs@gnu.org; Fri, 01 May 2015 06:43:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yo8PP-000647-KL for bug-gnu-emacs@gnu.org; Fri, 01 May 2015 06:43:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Yo8PP-00061n-BG for bug-gnu-emacs@gnu.org; Fri, 01 May 2015 06:43:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 May 2015 10:43:03 +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.143047692323061 (code B ref 20472); Fri, 01 May 2015 10:43:03 +0000 Original-Received: (at 20472) by debbugs.gnu.org; 1 May 2015 10:42:03 +0000 Original-Received: from localhost ([127.0.0.1]:58122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yo8OQ-0005zg-Be for submit@debbugs.gnu.org; Fri, 01 May 2015 06:42:03 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:61756) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yo8ON-0005zH-7k for 20472@debbugs.gnu.org; Fri, 01 May 2015 06:42:00 -0400 Original-Received: from [88.117.112.225] ([88.117.112.225]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0MYx2x-1YirRW15IB-00VdAu; Fri, 01 May 2015 12:41:49 +0200 In-Reply-To: X-Provags-ID: V03:K0:SmKPudMW3oCRbjZxW+V1YCsfdIFvJ8+CUnKNBCBF+YZ3deHd8MT Dd+7GkNdUy2FjGoIP8Wu2S3n8AKdlvQoja9cXnMOjcmZZQURE3w3dbDwac5eiliPaIQAx8O d6OlxJdl35fO+f9LPWDY39XWBLUtc6Lv7EuDyG9ssRSIFbXVyUi/N+CArkRNqpfnQyvFFZ2 7Fz+pBtS0z8kvO0yU3rTg== 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:102319 Archived-At: This is a multi-part message in MIME format. --------------020504030004070904070100 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > An alternative would be to make C-x b use another window in such a case. > I.e. remove the `force-same-window' argument (I think that would make > sense at least for the window-minibuffer-p case). Agreed. > An other alternative > would be to un-dedicate the window (only after prompting the user, tho). Patch attached. In the *log-edit-files* case we could additionally make the window weakly dedicated in order to avoid this problem all together. martin --------------020504030004070904070100 Content-Type: text/plain; charset=windows-1252; name="switch-to-buffer.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="switch-to-buffer.patch" --- a/lisp/window.el +++ b/lisp/window.el @@ -6887,10 +6887,13 @@ 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. But if the optional argument FORCE-SAME-WINDOW +is non-nil and the selected window is strongly dedicated to its +buffer, prompt the user whether to undedicate the selected window +first. If called interactively, read the buffer name using the minibuffer. The variable `confirm-nonexistent-file-or-buffer' @@ -6906,10 +6909,6 @@ If optional argument NORECORD is non-nil, do not put the buffer at the front of the buffer list, and do not make the window displaying it the most recently selected one. -If optional argument FORCE-SAME-WINDOW is non-nil, the buffer -must be displayed in the selected window; if that is impossible, -signal an error rather than calling `pop-to-buffer'. - The option `switch-to-buffer-preserve-window-point' can be used to make the buffer appear at its last position in the selected window. @@ -6923,13 +6922,14 @@ Return the buffer switched to." ;; might signal an error (e.g. if the window is dedicated). ((eq buffer (window-buffer))) ((window-minibuffer-p) - (if force-same-window - (user-error "Cannot switch buffers in minibuffer window") - (pop-to-buffer buffer norecord))) - ((eq (window-dedicated-p) t) - (if force-same-window - (user-error "Cannot switch buffers in a dedicated window") - (pop-to-buffer buffer norecord))) + (pop-to-buffer buffer norecord)) + ((and (eq (window-dedicated-p) t) + (or (not force-same-window) + (not (y-or-n-p + (format "Window is dedicated to %s; undedicate it" + (window-buffer)))) + (set-window-dedicated-p nil nil))) + (pop-to-buffer buffer norecord)) (t (let* ((entry (assq buffer (window-prev-buffers))) (displayed (and (eq switch-to-buffer-preserve-window-point --------------020504030004070904070100--