emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Evgenii Klimov <eugene.dev@lipklim.org>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: [Pre-PATCH v2] Add the capability to specify lexical scope in tangled files (was: Add new :lexical header argument)
Date: Fri, 14 Jul 2023 09:15:00 +0000	[thread overview]
Message-ID: <87jzv2j1m3.fsf@localhost> (raw)
In-Reply-To: <87zg3zbegv.fsf@lipklim.org>

Evgenii Klimov <eugene.dev@lipklim.org> writes:

> diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
> index a4725ae8c..c632c4814 100644
> --- a/etc/ORG-NEWS
> +++ b/etc/ORG-NEWS
> @@ -284,6 +284,13 @@ setting the ~STYLE~ property for each sub-task.
>  The change is breaking when ~org-use-property-inheritance~ is set to ~t~.
>  
>  ** New and changed options
> +*** =:lexical= header argument now influences tangled files
> +
> +When extracting an Elisp src block, the target's file
> +~lexical-binding~ variable is set according to the src block's
> +=:lexical= parameter.  If at least one block is set to lexical scope,
> +then the whole file will be with lexical scope.

I am not sure if I like this approach.
I have 2 problems with the patch:

1. Previous users of :lexical header arg might be surprised.
   Though it is an OK breaking change since people who used :lexical
   argument and expected it to be ignored in the tangled file probably
   did something wrong.
   
2. More importantly, we are adding ob-emacs-lisp-specific handling into
   generic ob-tangle.

What about generalizing the idea and providing a way to set Emacs
buffer-local variables in the tangled files?

Can be something like:

#+begin_src elisp :file-locals (lexical-binding t eval (line-number-mode))

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


  reply	other threads:[~2023-07-14  9:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13 18:30 [Pre-PATCH] Add new :lexical header argument Evgenii Klimov
2023-07-13 18:41 ` Ihor Radchenko
2023-07-13 22:00   ` [Pre-PATCH v2] Add the capability to specify lexical scope in tangled files (was: Add new :lexical header argument) Evgenii Klimov via General discussions about Org-mode.
2023-07-14  9:15     ` Ihor Radchenko [this message]
2023-07-14  9:23       ` Timothy
2023-07-15  7:45         ` Ihor Radchenko
2023-07-15 16:10           ` Timothy
2023-07-16  9:43             ` Ihor Radchenko
2023-08-23 11:44       ` Ihor Radchenko
2023-08-27  8:20         ` Evgenii Klimov
     [not found] <mailman.49.1689350420.11515.emacs-orgmode@gnu.org>
2023-07-14 20:43 ` No Wayman
2023-07-14 21:25   ` Evgenii Klimov
2023-07-14 21:57     ` Thomas S. Dye
2023-07-15  8:12       ` Ihor Radchenko
2023-07-15 16:11         ` Thomas S. Dye
2023-07-15 19:33           ` Berry, Charles
2023-07-16  9:24             ` Ihor Radchenko

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=87jzv2j1m3.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=eugene.dev@lipklim.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/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).