emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [BUG?][PATCH] Should the `lexical-binding' variable be bound during src block with :lexical t? [9.4.6 (9.4.6-ga451f9 @ /home/n/.emacs.d/straight/build/org/)]
Date: Fri, 10 Sep 2021 11:53:39 +1000	[thread overview]
Message-ID: <871r5xfa8t.fsf@gmail.com> (raw)
In-Reply-To: <87tuit73ij.fsf@gmail.com>


No Wayman <iarchivedmywholelife@gmail.com> writes:

> I ran into this with some code I'm writing which checks against 
> `lexical-binding'.
> Should the following result in "lexical binding enabled" or 
> "lexical binding disabled"?:
>
> #+begin_src emacs-lisp :lexical t
> (message "lexical binding %sabled" (if lexical-binding "en" 
> "dis"))
> #+end_src
>
> Currently the `lexical-binding' variable is not bound because 
> `org-babel-execute:emacs-lisp'
> passes t to `eval', which enables lexical binding, but does not 
> bind the `lexical-binding' variable.
> The attached patch binds the variable in the lexical environment.
> It's a matter of whether or not this is the right thing to do.
> Thoughts?
>
>

My thoughts on this would be that if lexical-bindings is supposed to be
bound to t, it should be done by eval when it gets a non-nil value for
it's optional argument. If I execute (eval FORM t) in an emacs lisp
buffer, it looks like lexical-bind is not set either, so I don't think
it should be in org either. To set it means we could get the same code
behaving differently depending on whether the source block is 'tangled'
and then evaluated or evaluated within org, which doesn't feel right.

Might be worth asking on emacs-devel why (eval FORM t) does not set this variable?


  reply	other threads:[~2021-09-10  2:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 22:58 No Wayman
2021-09-10  1:53 ` Tim Cross [this message]
2021-09-10  2:38   ` No Wayman
2021-09-10  6:32 ` Timothy
2021-09-10 15:12   ` No Wayman
2021-09-10 15:15     ` No Wayman

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.orgmode.org/

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

  git send-email \
    --in-reply-to=871r5xfa8t.fsf@gmail.com \
    --to=theophilusx@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [BUG?][PATCH] Should the `lexical-binding'\'' variable be bound during src block with :lexical t? [9.4.6 (9.4.6-ga451f9 @ /home/n/.emacs.d/straight/build/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

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).