From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Dima Kogan <dima@secretsauce.net>
Newsgroups: gmane.emacs.bugs
Subject: bug#20206: 25.0.50;
	[PATCH] keep diff-mode's window visible when we visit sources from
	diff-mode
Date: Fri, 27 Mar 2015 23:01:32 -0700
Message-ID: <871tk9y55v.fsf@secretsauce.net>
References: <87a8yzy5t4.fsf@secretsauce.net> <551456ED.8060101@gmx.at>
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: ger.gmane.org 1427526216 18670 80.91.229.3 (28 Mar 2015 07:03:36 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 28 Mar 2015 07:03:36 +0000 (UTC)
Cc: 20206@debbugs.gnu.org
To: martin rudalics <rudalics@gmx.at>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 28 08:03:20 2015
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1Ybkm0-0006il-UZ
	for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Mar 2015 08:03:13 +0100
Original-Received: from localhost ([::1]:52961 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1Ybklz-0003bw-P5
	for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Mar 2015 03:03:11 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50984)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Ybklw-0003bd-GE
	for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2015 03:03:09 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Ybklr-0005K4-CP
	for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2015 03:03:08 -0400
Original-Received: from debbugs.gnu.org ([140.186.70.43]:48747)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Ybklq-0005Jt-Tn
	for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2015 03:03:03 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Ybklq-0006Nv-8s
	for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2015 03:03:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Dima Kogan <dima@secretsauce.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sat, 28 Mar 2015 07:03:02 +0000
Resent-Message-ID: <handler.20206.B20206.142752616924525@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 20206
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
Original-Received: via spool by 20206-submit@debbugs.gnu.org id=B20206.142752616924525
	(code B ref 20206); Sat, 28 Mar 2015 07:03:02 +0000
Original-Received: (at 20206) by debbugs.gnu.org; 28 Mar 2015 07:02:49 +0000
Original-Received: from localhost ([127.0.0.1]:38523 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1Ybklc-0006NU-TH
	for submit@debbugs.gnu.org; Sat, 28 Mar 2015 03:02:49 -0400
Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:56263)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <dima@secretsauce.net>) id 1Ybkla-0006NK-QG
	for 20206@debbugs.gnu.org; Sat, 28 Mar 2015 03:02:47 -0400
Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
	by mailout.nyi.internal (Postfix) with ESMTP id 99B7520A40
	for <20206@debbugs.gnu.org>; Sat, 28 Mar 2015 03:02:43 -0400 (EDT)
Original-Received: from frontend1 ([10.202.2.160])
	by compute3.internal (MEProxy); Sat, 28 Mar 2015 03:02:46 -0400
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net;
	h=cc:content-type:date:from:in-reply-to:message-id:mime-version
	:references:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=rOYo3
	h2pg5Isi/yhmTRg7sX+HUQ=; b=EbrtuQWsd8WjnRFoKEUf23jQrqBO+F05j7yzB
	dqQT34Ex2YbzG7elqRz8abathWaY786NTJ0G+tJJFAs+uynI9Ih1fAB2vy70hXhW
	uN428Hll6AOxFs3Xd4ri2bMHHj1mffCFIll/slgINb8k3hmpQpRpX6eRPu51roOS
	BZ66Eo=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=
	messagingengine.com; h=cc:content-type:date:from:in-reply-to
	:message-id:mime-version:references:subject:to:x-sasl-enc
	:x-sasl-enc; s=smtpout; bh=rOYo3h2pg5Isi/yhmTRg7sX+HUQ=; b=OGpe0
	SfmeiW4oNMI3w3PO9JhLFomw0f3Z5XZ0ZgBv3S4A973qBT4P84lJyOBEwHF6ytEx
	xTzy/bX9VIS2e3pH2Kut3A89tYi9i33mVSGAGOSfHmZ30lZ038w452h+80bZh7GZ
	zKIK/bGz0l5JrdGvAUaS/skdJRvr7EwVzxJChM=
X-Sasl-enc: RNRm/55fpmUmWdFNR/0VJK37qvRCMr5MXp9eZcwS6yU+ 1427526166
Original-Received: from shorty.local (unknown [104.35.103.243])
	by mail.messagingengine.com (Postfix) with ESMTPA id 3B349C00015;
	Sat, 28 Mar 2015 03:02:46 -0400 (EDT)
Original-Received: from ip6-localhost ([::1] helo=shorty)
	by shorty.local with esmtp (Exim 4.84)
	(envelope-from <dima@secretsauce.net>)
	id 1Ybkmi-0003OB-Hf; Sat, 28 Mar 2015 00:03:56 -0700
In-reply-to: <551456ED.8060101@gmx.at>
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" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=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:100986
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/100986>


martin rudalics <rudalics@gmx.at> writes:

>  > -  (pop-to-buffer (current-buffer))
>
> Something must be wrong here.  According to its doc-string
> `pop-to-buffer' should
>
> "Select buffer BUFFER in some window, preferably a different one."
>
> But I nowhere see that it tries to enforce that.  Am I blind?

I don't see it either. (pop-to-buffer buf) simply does (display-buffer
buf).


> And `display-buffer' should not use the selected window either, after
> all it's likely the most recently used one. Could you please debug
> this in order to explain why the selected window gets used in all
> these cases?

I think it uses the most recent window a buffer was displayed in. If
this most-recenty-used window now shows a different buffer, then this
new buffer is covered up. Example:

emacs24 -Q --eval '(progn
  (split-window-horizontally)     # split into left,right; *scratch* in each
  (other-window 1)                # focus the right window (*scratch*)
  (switch-to-buffer "asdf")       # right window now has buffer "asdf"
  (other-window 1)                # focus the left window (*scratch*)
  (switch-to-buffer "*Messages*") # left window now has buffer *Messages*
  (switch-to-buffer "*scratch*")  # left window back to buffer *scratch*
  (display-buffer "*Messages*")   # display *Messages* somewhere
 )'

Running the above covers up the focused *scratch* buffer in the left
window. Running it in emacs23 instead does NOT cover it up, which is the
behavior that feels more right to me. The recent patches try to get back
to this state.

If we do not do the

 (switch-to-buffer "*Messages*") (switch-to-buffer "*scratch*")

dance then the *scratch* buffer isn't covered up even in emacs24.


>  > +  (pop-to-buffer (current-buffer) '(display-buffer-use-some-window (inhibit-same-window . t)))
>
> In any case `display-buffer-use-some-window' as sole action doesn't look
> right.  It should be preceded by `display-buffer-reuse-window' and
> `display-buffer-pop-up-window'.  And `pop-to-buffer' should do that
> already.

OK, but if the larger question is now on the table, (about what should
(pop-to-buffer) and (display-buffer) do by default), we should probably
answer that first.

dima