From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: Re: Reachable killed buffers Date: Fri, 14 Sep 2012 16:10:27 +0400 Message-ID: <50531EB3.5030604@yandex.ru> References: <504848D0.4020908@yandex.ru> <5048D826.3040103@yandex.ru> <5049C400.8070400@gmx.at> <504DB6DD.9030002@yandex.ru> <504E042E.5040100@yandex.ru> <504ECB49.4050509@yandex.ru> <50504349.7090603@gmx.at> <50509262.1070601@cs.ucla.edu> <50509533.9000502@yandex.ru> <50509698.5060108@cs.ucla.edu> <505098FB.1020801@gmx.at> <5050B151.2020304@yandex.ru> <5050CC93.3010506@cs.ucla.edu> <5051645B.9070308@cs.ucla.edu> <50520EA7.7060707@gmx.at> <505213DF.8050300@cs.ucla.edu> <50521839.9060605@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050300030901070109060702" X-Trace: ger.gmane.org 1347624689 28710 80.91.229.3 (14 Sep 2012 12:11:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Sep 2012 12:11:29 +0000 (UTC) Cc: martin rudalics , Paul Eggert , Stefan Monnier To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 14 14:11:27 2012 Return-path: Envelope-to: ged-emacs-devel@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 1TCUk0-0000qB-L0 for ged-emacs-devel@m.gmane.org; Fri, 14 Sep 2012 14:11:24 +0200 Original-Received: from localhost ([::1]:49987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCUju-0000ru-7O for ged-emacs-devel@m.gmane.org; Fri, 14 Sep 2012 08:11:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCUjl-0000oR-I8 for emacs-devel@gnu.org; Fri, 14 Sep 2012 08:11:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCUjc-00027g-66 for emacs-devel@gnu.org; Fri, 14 Sep 2012 08:11:09 -0400 Original-Received: from forward3.mail.yandex.net ([77.88.46.8]:37229) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCUjb-00027R-M8 for emacs-devel@gnu.org; Fri, 14 Sep 2012 08:11:00 -0400 Original-Received: from smtp4.mail.yandex.net (smtp4.mail.yandex.net [77.88.46.104]) by forward3.mail.yandex.net (Yandex) with ESMTP id ABA9FB40E71; Fri, 14 Sep 2012 16:10:27 +0400 (MSK) Original-Received: from smtp4.mail.yandex.net (localhost [127.0.0.1]) by smtp4.mail.yandex.net (Yandex) with ESMTP id 672FA5C02E5; Fri, 14 Sep 2012 16:10:27 +0400 (MSK) Original-Received: from unknown (unknown [37.139.80.10]) by smtp4.mail.yandex.net (nwsmtp/Yandex) with ESMTP id ARgaGoLb-ARgeYsYp; Fri, 14 Sep 2012 16:10:27 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1347624627; bh=R+R3PwiWV3/3Fb7kyvNrXGVOtaIkkkqqcabW3lgRQrw=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type; b=OP77dZoT/kM530G5JE6nbjjGCqMEvK3jTbGI6XcISJChg9SaTbnnOnOaQsJNXCmeV mHGtLMa4UcNuWJ+tFMZZilHHLtFDcu/wiT5f9I1aJAGvWrwwe2jq/0op/9MbjTnOhH PfYHRtcUxLEijWUZBll0rHkg5rsqgq8tsDzQejUc= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 In-Reply-To: <50521839.9060605@gmx.at> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 77.88.46.8 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:153295 Archived-At: This is a multi-part message in MIME format. --------------050300030901070109060702 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Since our discussion shows that there is no solid and bullet-proof solution for killed buffers problem (IMHO), I would like to propose an alternate (less effective, but safe) solution: when the window dies, it's prev_buffers and next_buffers are set to nil, but both buffer lists are saved in struct saved_window just for the sake of possible resurrection. Martin said that the most of window-configuration objects are created with 'save-window-excursion' and so they're short-lived objects which tends to not survive next GC. So, if deleted window isn't recorded in window-configuration object or such an object dies quickly, we're lucky; otherwise, the only thing we can do is to hope that recorded window will be resurrected and Lisp code from window.el will take care about the contents of it's buffer lists. Dmitry --------------050300030901070109060702 Content-Type: text/plain; charset=UTF-8; name="kill_window.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="kill_window.patch" PT09IG1vZGlmaWVkIGZpbGUgJ3NyYy9hbGxvYy5jJwotLS0gc3JjL2FsbG9jLmMJMjAxMi0w OS0xMyAwNToxODoyNiArMDAwMAorKysgc3JjL2FsbG9jLmMJMjAxMi0wOS0xNCAxMToxMTo1 NCArMDAwMApAQCAtNTg2NSwzMiArNTg2NSw2IEBACiAgICAgbWFya19idWZmZXIgKGJ1ZmZl ci0+YmFzZV9idWZmZXIpOwogfQogCi0vKiBSZW1vdmUga2lsbGVkIGJ1ZmZlcnMgb3IgaXRl bXMgd2hvc2UgY2FyIGlzIGEga2lsbGVkIGJ1ZmZlciBmcm9tCi0gICBMSVNULCBhbmQgbWFy ayBvdGhlciBpdGVtcy4gUmV0dXJuIGNoYW5nZWQgTElTV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TA5LTExIDE1OjQyOjUw ICswMDAwCisrKyBzcmMvd2luZG93LmMJMjAxMi0wOS0xNCAxMjowOTowNiArMDAwMApAQCAt Mzk4OCw2ICszOTg4LDMxIEBACiAgIHJldHVybiBuZXc7CiB9CiAKKy8qIFJlc2V0IFcncyBm aWVsZHMgc28gV0lORE9XX1ZBTElEX1AgaXMgbm9uLXplcm8gZm9yIFcuICAqLworCitzdGF0 aWMgdm9pZAora2lsbF93aW5kb3cgKHN0cnVjdCB3aW5kb3cgKncpCit7CisgIGlmICghTklM UCAody0+dmNoaWxkKSkKKyAgICB7CisgICAgICBkZWxldGVfYWxsX2NoaWxkX3dpbmRvd3Mg KHctPnZjaGlsZCk7CisgICAgICB3c2V0X3ZjaGlsZCAodywgUW5pbCk7CisgICAgfQorICBl bHNlIGlmICghTklMUCAody0+aGNoaWxkKSkKKyAgICB7CisgICAgICBkZWxldGVfYWxsX2No aWxkX3dpbmRvd3MgKHctPmhjaGlsZCk7CisgICAgICB3c2V0X2hjaGlsZCAodywgUW5pbCk7 CisgICAgfQorICBlbHNlIGlmICghTklMUCAody0+YnVmZmVyKSkKKyAgICB7CisgICAgICB1 bnNob3dfYnVmZmVyICh3KTsKKyAgICAgIHVuY2hhaW5fbWFya2VyIChYTUFSS0VSICh3LT5w b2ludG0pKTsKKyAgICAgIHVuY2hhaW5fbWFya2VyIChYTUFSS0VSICh3LT5zdGFydCkpOwor ICAgICAgd3NldF9idWZmZXIgKHcsIFFuaWwpOworICAgIH0KKyAgd3NldF9wcmV2X2J1ZmZl cnMgKHcsIFFuaWwpOworICB3c2V0X25leHRfYnVmZmVycyAodywgUW5pbCk7Cit9CiAKIERF RlVOICgiZGVsZXRlLXdpbmRvdy1pbnRlcm5hbCIsIEZkZWxldGVfd2luZG93X2ludGVybmFs LCBTZGVsZXRlX3dpbmRvd19pbnRlcm5hbCwgMSwgMSwgMCwKICAgICAgICBkb2M6IC8qIFJl bW92ZSBXSU5ET1cgZnJvbSBpdHMgZnJhbW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GggPSB3LT5sZWZ0X2ZyaW5nZV93aWR0aDsKCg== --------------050300030901070109060702--