all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 26624@debbugs.gnu.org
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	[thread overview]
Message-ID: <87zid6udys.fsf@drachen> (raw)
In-Reply-To: <CAArVCkSFpW3Sc80XKHuxC7akHPUs14+GX0A3L+eJF7vhfw7zEA@mail.gmail.com> (Philipp Stephani's message of "Sat, 17 Jun 2017 13:10:20 +0000")

Philipp Stephani <p.stephani2@gmail.com> 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.





  parent reply	other threads:[~2017-06-18  4:17 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-23 17:13 bug#26624: 26.0.50; Generalized variable `buffer-local-value' does't restore local flag Philipp Stephani
2017-06-17 13:10 ` Philipp Stephani
2017-06-17 18:48   ` npostavs
2017-06-18  4:17   ` Michael Heerdegen [this message]
2017-07-02 16:53     ` Philipp Stephani
2017-09-24 15:19       ` Philipp Stephani
2017-09-24 15:36         ` Michael Heerdegen
2017-09-24 15:44         ` Noam Postavsky
2017-09-24 16:42           ` Philipp Stephani
2017-09-24 17:43             ` Noam Postavsky
2017-09-29  7:50               ` Eli Zaretskii
2017-09-29 20:55                 ` Philipp Stephani
2017-09-30  6:46                   ` Eli Zaretskii
2017-12-26 22:19                     ` Michael Heerdegen
2017-12-27 16:10                       ` Eli Zaretskii
2017-12-27 19:54                         ` Michael Heerdegen
2017-12-27 20:27                           ` Eli Zaretskii
2017-12-29 14:08                             ` Michael Heerdegen
2017-12-29 16:14                               ` Eli Zaretskii
2017-12-29 16:20                                 ` Philipp Stephani
2022-08-21 21:38           ` Lars Ingebrigtsen
2022-08-21 22:21             ` Lars Ingebrigtsen
2022-08-22  6:53               ` Michael Heerdegen
2022-08-22 10:10                 ` Lars Ingebrigtsen
2022-08-22 21:43                   ` Michael Heerdegen
2022-08-23 10:28                     ` Lars Ingebrigtsen
2018-01-24 14:33       ` Michael Heerdegen
2018-02-04 19:01         ` Philipp Stephani
2018-02-04 21:02           ` Michael Heerdegen
2018-02-11 17:54             ` Philipp Stephani
2018-02-11 20:56               ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zid6udys.fsf@drachen \
    --to=michael_heerdegen@web.de \
    --cc=26624@debbugs.gnu.org \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.