From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Bug: :lexical header argument not handled when tangling [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/)] Date: Wed, 12 Feb 2020 12:59:12 +0100 Message-ID: <87o8u410fj.fsf@gnu.org> References: <871rxen3g9.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:51153) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1qfl-0007SF-CX for emacs-orgmode@gnu.org; Wed, 12 Feb 2020 06:59:18 -0500 In-Reply-To: <871rxen3g9.fsf@gmail.com> (immanuel's message of "Wed, 21 Aug 2019 13:49:26 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: immanuel Cc: emacs-orgmode@gnu.org Hi Immanuel, immanuel writes: > #+BEGIN_SRC emacs-lisp :lexical t :tangle elisp.el > (defun lex-p () > "Return t if lexical binding is in effect." > (interactive) > (let (lex > _lex-p) > (let ((lex t)) > (setq _lex-p > (lambda () > lex))) > (if (funcall _lex-p) > (message "lexical binding") > (message "no lexical binding")))) > > (lex-p) > #+END_SRC > > When evaluating this code block with C-c C-c I get lexical binding. > When tangling it or with org-babel-load-file I get no lexical > binding. You can declare lexical-binding in the source block, like this: #+BEGIN_SRC emacs-lisp :lexical t :tangle elisp.el ;;; elisp.el -*- lexical-binding: t; -*- (defun lex-p () "Return t if lexical binding is in effect." (interactive) (let (lex _lex-p) (let ((lex t)) (setq _lex-p (lambda () lex))) (if (funcall _lex-p) (message "lexical binding") (message "no lexical binding")))) (lex-p) #+END_SRC #+RESULTS: : lexical binding -- Bastien