From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#32777: 27.0.50; window-buffer gets wrong point Date: Sun, 23 Dec 2018 10:40:13 +0100 Message-ID: <5C1F57FD.2090103@gmx.at> References: <83wor12fut.fsf@gnu.org> <83o9byurtg.fsf@gnu.org> <5BC1EE38.2060906@gmx.at> <5BC44818.6040006@gmx.at> <871s6bd95o.fsf@mail.linkov.net> <5C1CAF30.9090705@gmx.at> <83pntuc1g5.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060607010403050800010705" X-Trace: blaine.gmane.org 1545557951 25915 195.159.176.226 (23 Dec 2018 09:39:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Dec 2018 09:39:11 +0000 (UTC) Cc: juri@linkov.net, federicotedin@gmail.com, 32777@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 23 10:39:06 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gb0Dy-0006dT-Dy for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Dec 2018 10:39:06 +0100 Original-Received: from localhost ([::1]:49601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gb0G5-0000UP-18 for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Dec 2018 04:41:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gb0Ft-0000U0-Tk for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2018 04:41:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gb0Fp-0005o3-UC for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2018 04:41:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56277) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gb0Fp-0005nx-Qg for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2018 04:41:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gb0Fp-0000sv-NF for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2018 04:41:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Dec 2018 09:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32777 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32777-submit@debbugs.gnu.org id=B32777.15455580263333 (code B ref 32777); Sun, 23 Dec 2018 09:41:01 +0000 Original-Received: (at 32777) by debbugs.gnu.org; 23 Dec 2018 09:40:26 +0000 Original-Received: from localhost ([127.0.0.1]:60532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gb0FG-0000rg-Fp for submit@debbugs.gnu.org; Sun, 23 Dec 2018 04:40:26 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:38469) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gb0FE-0000rU-Cj for 32777@debbugs.gnu.org; Sun, 23 Dec 2018 04:40:24 -0500 Original-Received: from [192.168.1.101] ([46.125.250.117]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MFuWk-1gdlNo3x5i-00EqlM; Sun, 23 Dec 2018 10:40:15 +0100 In-Reply-To: <83pntuc1g5.fsf@gnu.org> X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dmsN8OGcx296oyxntYADiKPe1JvS2/ X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:153774 Archived-At: This is a multi-part message in MIME format. --------------060607010403050800010705 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit > As for how to proceed: I would love for us to have a way of selecting > a window temporarily, in way that doesn't involve saving/restoring its > window-point. It depends on what your semantics of "selecting a window temporarily" are. The only invariance frame/window management requires is that (frame-selected-window (selected-frame)) equals (selected-window). Otherwise you can freely set things like selected_window and selected_frame directly. Things get problematic when you want to, for example, show the line number of a buffer in the mode line since in that case you need the corresponding window's point which is stored in the window structure only if the window is not the selected one. So the most important prerequisite for what you want is that redisplay itself always has a very strong opinion of which window is the selected one and which buffer is current. One of the most unexpected things redisplay currently does is to run Fselect_frame from unwind_format_mode_line which if I'm not mistaken could wind up calling do_switch_frame with TRACK non-zero and thus cause a Fredirect_frame_focus from within redisplay. I think that redisplay should not call 'select-frame' or 'select-window' for such reasons. > But maybe this is a pipe dream, so I think we should > try your alternative #2 on master and see what it breaks. To elaborate further on what I stated there as >> But (1) does not handle the case where the >> buffer of W2 is not shown anywhere else when x_consider_frame_title is >> called. So IMHO (2) should be the correct approach but I have no idea >> what further consequences it could have. consider the following scenario with emacs -Q: C-x 5 2 C-x 5 o C-x b RET M-: (with-current-buffer "*scratch*" (goto-char (point-min))) M-: (with-current-buffer "*scratch*" (point)) The value of evaluating the second form depends on the position of point of the window displaying *scratch* and not on where the 'goto-char' went before. So this is a quite nasty bug IMHO. Unfortunately, curing it is non-trivial to avoid that some window point gets moved unexpectedly, see the attached patch. People using multiple frames pretty please try to run it and report any bad experiences here ASAP. Thanks, martin --------------060607010403050800010705 Content-Type: text/plain; charset=windows-1252; name="xdisp.c.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="xdisp.c.diff" ZGlmZiAtLWdpdCBhL3NyYy94ZGlzcC5jIGIvc3JjL3hkaXNwLmMKaW5kZXggOTQ3NDJjMi4u MzE1ZGNlMiAxMDA2NDQKLS0tIGEvc3JjL3hkaXNwLmMKKysrIGIvc3JjL3hkaXNwLmMKQEAg LTExODYwLDcgKzExODYwLDcgQEAgc3RhdGljIHZvaWQgQVRUUklCVVRFX0ZPUk1BVF9QUklO VEYgKDEsIDApCiAgIFZtb2RlX2xpbmVfdW53aW5kX3ZlY3RvciA9IFFuaWw7CiAKICAgaWYg KE5JTFAgKHZlY3RvcikpCi0gICAgdmVjdG9yID0gbWFrZV9uaWxfdmVjdG9yICgxMCk7Cisg ICAgdmVjdG9yID0gbWFrZV9uaWxfdmVjdG9yICgxMik7CiAKICAgQVNFVCAodmVjdG9yLCAw LCBtYWtlX2ZpeG51bSAobW9kZV9saW5lX3RhcmdldCkpOwogICBBU0VUICh2ZWN0b3IsIDEs IG1ha2VfZml4bnVtIChNT0RFX0xJTkVfTk9QUk9QX0xFTiAoMCkpKTsKQEAgLTExODc3LDEy ICsxMTg3NywyNCBAQCBzdGF0aWMgdm9pZCBBVFRSSUJVVEVfRk9STUFUX1BSSU5URiAoMSwg MCkKICAgQVNFVCAodmVjdG9yLCA3LCBvd2luKTsKICAgaWYgKHRhcmdldF9mcmFtZSkKICAg ICB7CisgICAgICBMaXNwX09iamVjdCBidWZmZXIgPSBYV0lORE9XICh0YXJnZXRfZnJhbWUt PnNlbGVjdGVkX3dpbmRvdyktPmNvbnRlbnRzOworICAgICAgc3RydWN0IGJ1ZmZlciAqYiA9 IFhCVUZGRVIgKGJ1ZmZlcik7CisgICA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kgIExpc3BfT2JqZWN0IGZyYW1lCiAJICAgID0gV0lORE9X X0ZSQU1FIChYV0lORE9XICh0YXJnZXRfZnJhbWVfd2luZG93KSk7CisJICBMaXNwX09iamVj dCBidWZmZXIgPSBBUkVGICh2ZWN0b3IsIDEwKTsKIAogCSAgaWYgKCFFUSAoZnJhbWUsIFdJ TkRPV19GUkFNRSAoWFdJTkRPVyAob2xkX3dpbmRvdykpKSkKIAkgICAgRnNlbGVjdF93aW5k b3cgKHRhcmdldF9mcmFtZV93aW5kb3csIFF0KTsKIAogCSAgaWYgKCFOSUxQIChvbGRfdG9w X2ZyYW1lKSAmJiAhRVEgKG9sZF90b3BfZnJhbWUsIGZyYW1lKSkKIAkgICAgRnNlbGVjdF9m cmFtZSAob2xkX3RvcF9mcmFtZSwgUXQpOworCisJICBpZiAoQlVGRkVSX0xJVkVfUCAoWEJV RkZFUiAoYnVmZmVyKSkKKwkgICAgICAmJiAhRVEgKFhXSU5ET1cgKG9sZF93aW5kb3cpLT5j b250ZW50cywgYnVmZmVyKSkKKwkgICAgeworCSAgICAgIC8qIFJlc3RvcmUgcG9pbnQgb2Yg dGFyZ2V0X2ZyYW1lX3dpbmRvdydzIGJ1ZmZlcgorCQkgKEJ1ZyMzMjc3NykuICAqLworCSAg ICAgIHN0cnVjdCBidWZmZXIgKmNiID0gY3VycmVudF9idWZmZXI7CisKKwkgICAgICBjdXJy ZW50X2J1ZmZlciA9IFhCVUZGRVIgKGJ1ZmZlcik7CisJICAgICAgc2V0X3BvaW50X2Zyb21f bWFya2VyIChBUkVGICh2ZWN0b3IsIDExKSk7CisJICAgICAgQVNFVCAodmVjdG9yLCAxMSwg UW5pbCk7CisJICAgICAgY3VycmVudF9idWZmZXIgPSBjYjsKKwkgICAgfQogCX0KIAogICAg ICAgRnNlbGVjdF93aW5kb3cgKG9sZF93aW5kb3csIFF0KTsKCg== --------------060607010403050800010705--