unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kelly Dean <kelly@prtime.org>
To: David Kastrup <dak@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Rant - Elisp terminology is deceptive
Date: Sat, 24 Jan 2015 23:24:49 +0000	[thread overview]
Message-ID: <4FMMk0pLUrXu73HsWAPNrK3cw3LlAT0PayRH8aoS4es@local> (raw)
In-Reply-To: <87vbjw4f0z.fsf@fencepost.gnu.org>

David Kastrup wrote:
> A buffer does not have an "environment".

What do you call the thing that lists the bindings of buffer-local variables to values? The standard term for a list of bindings of variables to values that's used for resolving variable references, both in Lisp and elsewhere, is ‟environment”.

> It has a list of global variable values
> to substitute whenever it is made current.

You mean like a closure can have? (A closure's environment can also have variables with names that aren't names of global variables, but that's not the point here.)
(setq foo
      (lexical-let ((shift-select-mode 'bar))
	(lambda () shift-select-mode)))
(funcall foo) → bar

> buffer-local variables _are_ buffer-local versions of _global_
> variables.

shift-select-mode above is a closure-local version of a global variable.

> With setq-default you are not setting
> a value that is in any manner more or less global than a buffer-local
> setting.

setq-default sets the global variable, which is visible in other buffers (unless they shadow it with their own buffer-locals).
A buffer-local variable is not visible in other buffers.

I don't know how buffer-locals are implemented internally, but from a user's (and Elisp programmer's) point of view, a buffer has an environment with variables that shadow global variables. If the value of each variable in that environment is stored as part of the structure that stores the value of the same-named global variable rather than being stored in a separate list of bindings for the environment, that's irrelevant. The effect is the same.

The help system agrees with me. It doesn't call buffer-locals ‟global”. It _contrasts_ buffer-locals and globals. E.g. describe-variable for mark-active tells me:
mark-active is a variable defined in `buffer.c'.
Its value is t
Local in buffer *Help*; global value is nil



  reply	other threads:[~2015-01-24 23:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  2:59 Rant - Elisp terminology is deceptive Kelly Dean
2015-01-23 20:15 ` Stefan Monnier
2015-01-24  0:41   ` Kelly Dean
2015-01-24  0:48     ` Óscar Fuentes
2015-01-24  3:28     ` Stephen J. Turnbull
2015-01-24  8:51       ` Eli Zaretskii
2015-01-24 10:32         ` Kelly Dean
2015-01-24 11:26           ` Eli Zaretskii
2015-01-24 10:30       ` Kelly Dean
2015-01-24 11:03         ` David Kastrup
2015-01-24 23:24           ` Kelly Dean [this message]
2015-01-25  9:16             ` David Kastrup
2015-01-26  3:52               ` Kelly Dean
2015-01-26  8:28                 ` Thien-Thi Nguyen
  -- strict thread matches above, loose matches on Subject: below --
2013-05-22  3:44 [PATCH] Desktop mode saves mark-ring too verbosely Kelly Dean
2013-11-23 13:40 ` Stefan Monnier
2015-01-21 12:11   ` Kelly Dean
2015-01-21 15:04     ` Stefan Monnier
2015-01-22  5:43       ` Kelly Dean
2015-01-22  8:20         ` Ivan Shmakov
2015-01-23 13:20           ` Kelly Dean
2015-01-23 14:09             ` Ivan Shmakov
2015-01-24  3:08             ` Stephen J. Turnbull
2015-01-24 23:30               ` Elisp terminology (was: Re: [PATCH] Desktop mode saves mark-ring too verbosely) Kelly Dean
2015-01-25  9:49                 ` Elisp terminology David Kastrup

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=4FMMk0pLUrXu73HsWAPNrK3cw3LlAT0PayRH8aoS4es@local \
    --to=kelly@prtime.org \
    --cc=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).