emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug: :lexical header argument not handled when tangling [9.1.9 (rele


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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Immanuel,

immanuel <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]