emacs-orgmode
[Top][All Lists]
Advanced

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

[BUG] org-export: incorrect assignment of bind keywords [9.7.3 (9.7.3-2f


From: Suhail Singh
Subject: [BUG] org-export: incorrect assignment of bind keywords [9.7.3 (9.7.3-2f1844 @ /home/user/.emacs.d/elpa/org-9.7.3/)]
Date: Tue, 11 Jun 2024 20:26:28 -0400

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

In Org 9.7.3, the variables bound using the =#+BIND= keyword have values that
are nested.  E.g., when a string value is provided, the value actually gets set
to a singleton list containing said string.  This can be observed using the
snippet:

#+name: bugs/org/9.7/bind-vars
#+header: :tangle /tmp/ox-bind-variable-mre.el
#+begin_src emacs-lisp :lexical t
  ;; -*- lexical-binding: t; no-byte-compile: nil; -*-

  (require 'ox)
  (require 'ox-org)

  (let ((org-export-allow-bind-keywords t)
        (org-confirm-babel-evaluate nil))
    (princ (format "%s\n" (org-version)))
    (princ (format "%s"
                   (org-export-string-as "#+BIND: my/bug/ox/foo \"foo\"
  ,#+BIND: my/bug/ox/bar

  ,#+begin_src emacs-lisp :exports results :results output
    (princ (format \"%s = '%s' :: %s\n\" \"my/bug/ox/foo\" my/bug/ox/foo 
(type-of my/bug/ox/foo)))
    (princ (format \"%s = '%s' :: %s\n\" \"my/bug/ox/bar\" my/bug/ox/bar 
(type-of my/bug/ox/bar)))
  ,#+end_src"
                                         'org
                                         t))))
#+end_src

#+RESULTS: bugs/org/9.7/bind-vars
: #+bind: my/bug/ox/foo "foo"
: #+bind: my/bug/ox/bar
: 
: #+results: 
: : my/bug/ox/foo = '(foo)' :: cons
: : my/bug/ox/bar = 'nil' :: symbol

The bug is in the definition of ~org-export--set-variables~.  By fixing the
issue in ~org-export--set-variables~ we get the expected values set:

#+begin_src emacs-lisp :lexical t :noweb yes
  ;; -*- lexical-binding: t; no-byte-compile: nil; -*-
  (require 'org)
  (require 'ox)

  (defun org-export--set-variables (variable-alist)
    "Set buffer-local variables according to VARIABLE-ALIST in current buffer."
    (pcase-dolist (`(,var . ,val) variable-alist)
      (set (make-local-variable var) (car val))))

  <<bugs/org/9.7/bind-vars>>
#+end_src

#+RESULTS:
: #+bind: my/bug/ox/foo "foo"
: #+bind: my/bug/ox/bar
: 
: #+results: 
: : my/bug/ox/foo = 'foo' :: string
: : my/bug/ox/bar = 'nil' :: symbol


The patch is attached below.

Attachment: 0001-org-export-Fix-assignment-of-bind-keywords.patch
Description: Text Data


Emacs  : GNU Emacs 29.3 (build 2, x86_64-suse-linux-gnu, GTK+ Version 3.24.41, 
cairo version 1.18.0)
Package: Org mode version 9.7.3 (9.7.3-2f1844 @ 
/home/user/.emacs.d/elpa/org-9.7.3/)

-- 
Suhail

reply via email to

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