* [BUG] org-export: incorrect assignment of bind keywords [9.7.3 (9.7.3-2f1844 @ /home/user/.emacs.d/elpa/org-9.7.3/)]
@ 2024-06-12 0:26 Suhail Singh
2024-06-13 15:31 ` Ihor Radchenko
0 siblings, 1 reply; 2+ messages in thread
From: Suhail Singh @ 2024-06-12 0:26 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2321 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-export-Fix-assignment-of-bind-keywords.patch --]
[-- Type: text/x-patch, Size: 1047 bytes --]
From c92105507d97159a7ba7c1af02c4a3a517ccdf6a Mon Sep 17 00:00:00 2001
From: Suhail <suhail@bayesians.ca>
Date: Tue, 11 Jun 2024 20:05:22 -0400
Subject: [PATCH] org-export: Fix assignment of bind keywords
* lisp/ox.el (org-export--set-variables): The value of the variable
corresponds to the cadr of the entry and not the cdr.
TINYCHANGE
---
lisp/ox.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/ox.el b/lisp/ox.el
index 1c52ca290..f8a763bc7 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -2585,7 +2585,7 @@ (defun org-export-install-filters
(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) val)))
+ (set (make-local-variable var) (car val))))
(cl-defun org-export-copy-buffer (&key to-buffer drop-visibility
drop-narrowing drop-contents
base-commit: 3e4c89e55649f95cffbf70fcf64dcbc69760f96f
--
2.45.2
[-- Attachment #3: Type: text/plain, Size: 200 bytes --]
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [BUG] org-export: incorrect assignment of bind keywords [9.7.3 (9.7.3-2f1844 @ /home/user/.emacs.d/elpa/org-9.7.3/)]
2024-06-12 0:26 [BUG] org-export: incorrect assignment of bind keywords [9.7.3 (9.7.3-2f1844 @ /home/user/.emacs.d/elpa/org-9.7.3/)] Suhail Singh
@ 2024-06-13 15:31 ` Ihor Radchenko
0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2024-06-13 15:31 UTC (permalink / raw)
To: Suhail Singh; +Cc: emacs-orgmode
"Suhail Singh" <suhailsingh247@gmail.com> writes:
> 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:
> ...
> #+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
Thanks for reporting!
Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=96113f3b5
--
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-13 15:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-12 0:26 [BUG] org-export: incorrect assignment of bind keywords [9.7.3 (9.7.3-2f1844 @ /home/user/.emacs.d/elpa/org-9.7.3/)] Suhail Singh
2024-06-13 15:31 ` Ihor Radchenko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.