From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#26624: 26.0.50; Generalized variable `buffer-local-value' does't restore local flag Date: Sun, 18 Jun 2017 06:17:15 +0200 Message-ID: <87zid6udys.fsf@drachen> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1497759494 10942 195.159.176.226 (18 Jun 2017 04:18:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 18 Jun 2017 04:18:14 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 26624@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 18 06:18:10 2017 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 1dMRf8-0002Qm-3C for geb-bug-gnu-emacs@m.gmane.org; Sun, 18 Jun 2017 06:18:10 +0200 Original-Received: from localhost ([::1]:37048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMRfA-0005yH-4i for geb-bug-gnu-emacs@m.gmane.org; Sun, 18 Jun 2017 00:18:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMRf3-0005y0-Rw for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2017 00:18:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dMRf0-0000KX-M2 for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2017 00:18:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51213) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dMRf0-0000KF-IY for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2017 00:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dMRf0-00018d-4m for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2017 00:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Jun 2017 04:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26624 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26624-submit@debbugs.gnu.org id=B26624.14977594454326 (code B ref 26624); Sun, 18 Jun 2017 04:18:02 +0000 Original-Received: (at 26624) by debbugs.gnu.org; 18 Jun 2017 04:17:25 +0000 Original-Received: from localhost ([127.0.0.1]:53890 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMReP-00017h-Jq for submit@debbugs.gnu.org; Sun, 18 Jun 2017 00:17:25 -0400 Original-Received: from mout.web.de ([212.227.15.14]:65283) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMReO-00017R-3N for 26624@debbugs.gnu.org; Sun, 18 Jun 2017 00:17:24 -0400 Original-Received: from drachen.dragon ([94.217.115.1]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LjrYH-1dxQE137Mn-00boID; Sun, 18 Jun 2017 06:17:16 +0200 In-Reply-To: (Philipp Stephani's message of "Sat, 17 Jun 2017 13:10:20 +0000") X-Provags-ID: V03:K0:aF+2szGBEimTzgeYChOaEfxW3/gZkZZbgcuLk8fBYC6p8YRtAO9 XTuWv9k6Ebvyj8l7ItiGUbAL4ncKwr9QHe5AlX+2XAVPKK8591eGpvFDx4O2rhlRje6hpbb JraUn4BBArQ6hG21EO9tjUdqKBbIwiNx4uB8uoXDJV4Jy0bdn69/SAaYXPOoxa2M7x9F8DY z4XQbjqu8FV5b8Up2ZaaQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:lD1PgugGPlY=:tkUmIuUZx2aZxYDb5RbBe8 HgjLRmGnxWz2WSqK5qypzc7nZl/Z/7rOgB/VZxfmwvd8MSEd+ppl49oXHRjYO0JeKlu7X6heJ wKiGkshme1VVnYm2Z5I+ylis7FYlJ7ffuNY1i6BpAIIz5i7C5tyL4VLr+mBT1YU/h5HFZQc3K ihYDEf+mxbNGY/2q8NGnZAyHNr686ZrnvcbLXvNIP4H3Jt1BrBsS/wI/tCPxmMWhKObO074mn vBuJtn0nPhFvE6ojtusYw19KSBxI9aAVG6/3PSLl4oGvN+a5xn7g9x6oogC2XPNRl0rJ50clb y9YzS1a+LcZWMUYh3rTcJlc9BroN7EslHliNbPFCIEmOdfEohrGTdRoie+iyBnoHJypgqd2wl KJCPbIYUQVoY1KAJQClSR6Arb1go52GTpMufDkp7zTwmwkHU7dIA+OM+2ZTnlHrmTcpxK6o7S fkyEzxoxHI8et98wYykCZBvP52L/INP8Mmo9s6SF674jJphRi7zAGc0ux4TKM8N6yMtEWN/fa ptxy3O1DvVYifKI/6n8p7SkGS923Di8ZJ5YmB041wa//t1VVC4ta/pFMKhfwVmuNYJHY9Utws PjWrO0LmU+2TdaLOv0776yP5qql9EYCKZ9pAZVLpGwS9BCtIKexf/FTt2i310Z5bHxpdlGISH Dh/Qvfybj8Y1DHkqj071oGs+iHt1uusb2/5ncZHeTbcu4PUtJ2RnFQR0MKxnshtt7xIgUBjgJ 0OEPbBKd0pwX7XKD3S3OM9eQC36PmUbB84jT41Bbjt8WodVTWu46ELrwDCSKC4lJEp5wU2qq 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:133719 Archived-At: Philipp Stephani writes: > It's possible to fix this (see attached patch), but at the expense of > breaking other valid use cases such as (cl-incf (buffer-local-value > ...)). Not sure whether the bug can be fixed at all without breaking > other stuff. I have no solution, but some thoughts. The more I think about it, the more I come to the conclusion that `buffer-local-value' does not have a well defined according place. The function `buffer-local-value' is not injective: it maps different states to the same value because it can't express whether the VARIABLE's binding is buffer-local or not. But we need this information because we need to undo creating a buffer local binding in the setter when closing the `letf'. And the setter, accepting only a value for the binding, isn't surjective, because the argument doesn't hold any information of buffer-localness. Moreover, we want the setter to always create a buffer-local binding in one situation (setf), but this isn't true for the setter we need to use for `cl-letf'. We could widen the semantics of `cl-letf' to do what we want in this case, but I'm not sure if it's worth the trouble. Not if there are more cases like this. BTW, a completely different point of view would be to argument like this: the manual describes generalized variables as "one of the many places in Lisp memory where values can be stored". If variable X has no buffer local binding in some buffer B, that place in Lisp memory is the one that holds the global binding of X. That means that the place expression (buffer-local-binding X B) is equivalent to the place expression X. OTOH, If X has a buffer local binding in B, we can use X as getter expression and `setq' as setter, so the place expression (buffer-local-binding X B) is also equivalent to X. So it is always equivalent to just X and of no use. Michael.