* [PATCH] initialize org-babel-tangle-lang-exts to nil
@ 2024-06-28 21:22 Tom Gillespie
2024-06-29 6:51 ` Ihor Radchenko
0 siblings, 1 reply; 3+ messages in thread
From: Tom Gillespie @ 2024-06-28 21:22 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 120 bytes --]
Hi,
Here is a fix for bad init values for org-babel-tangle-lang-exts.
Details in the patch commit message.
Best,
Tom
[-- Attachment #2: 0001-initialize-org-babel-tangle-lang-exts-to-nil.patch --]
[-- Type: text/x-patch, Size: 9393 bytes --]
From 71558cc80181b5d7a1d720785165b358984284e3 Mon Sep 17 00:00:00 2001
From: Tom Gillespie <tgbugs@gmail.com>
Date: Fri, 28 Jun 2024 14:08:08 -0700
Subject: [PATCH] initialize org-babel-tangle-lang-exts to nil
* lisp/ob-C.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-awk.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-clojure.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-fortran.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-groovy.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-haskell.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-java.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-latex.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-lisp.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-lua.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-maxima.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-ocaml.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-perl.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-processing.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-python.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-ruby.el (org-babel-tangle-lang-exts): init to nil
* lisp/ob-sed.el (org-babel-tangle-lang-exts): init to nil
org-bable-tangle-lang-exts should be initialized to nil and not as a
void variable, if it is not already initialized then this will cause a
void-variable error immediately when it is used in add-to-list
this corrects the original addition in
4a0e5cf88f684db775ccf43dc5edc2e8754a2d92 as well as other files that
followed the pattern
---
lisp/ob-C.el | 2 +-
lisp/ob-awk.el | 2 +-
lisp/ob-clojure.el | 2 +-
lisp/ob-fortran.el | 2 +-
lisp/ob-groovy.el | 2 +-
lisp/ob-haskell.el | 2 +-
lisp/ob-java.el | 2 +-
lisp/ob-latex.el | 2 +-
lisp/ob-lisp.el | 2 +-
lisp/ob-lua.el | 2 +-
lisp/ob-maxima.el | 2 +-
lisp/ob-ocaml.el | 2 +-
lisp/ob-perl.el | 2 +-
lisp/ob-processing.el | 2 +-
lisp/ob-python.el | 2 +-
lisp/ob-ruby.el | 2 +-
lisp/ob-sed.el | 2 +-
17 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index cecaa60e7..0e5235d62 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -42,7 +42,7 @@
(declare-function org-entry-get "org" (pom property &optional inherit literal-nil))
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("C++" . "cpp"))
(add-to-list 'org-babel-tangle-lang-exts '("D" . "d"))
diff --git a/lisp/ob-awk.el b/lisp/ob-awk.el
index 0c07aec82..203fd0041 100644
--- a/lisp/ob-awk.el
+++ b/lisp/ob-awk.el
@@ -42,7 +42,7 @@
(declare-function org-babel-ref-resolve "ob-ref" (ref))
(declare-function orgtbl-to-generic "org-table" (table params))
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("awk" . "awk"))
(defvar org-babel-awk-command "awk"
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index c7ebbbb95..f760bf698 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -65,7 +65,7 @@
(defvar cider-buffer-ns)
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj"))
(add-to-list 'org-babel-tangle-lang-exts '("clojurescript" . "cljs"))
diff --git a/lisp/ob-fortran.el b/lisp/ob-fortran.el
index f2047d767..de654866a 100644
--- a/lisp/ob-fortran.el
+++ b/lisp/ob-fortran.el
@@ -39,7 +39,7 @@
(declare-function org-entry-get "org"
(pom property &optional inherit literal-nil))
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("fortran" . "F90"))
(defvar org-babel-default-header-args:fortran '())
diff --git a/lisp/ob-groovy.el b/lisp/ob-groovy.el
index 73b0d33fc..5624fdf0b 100644
--- a/lisp/ob-groovy.el
+++ b/lisp/ob-groovy.el
@@ -37,7 +37,7 @@
(require 'ob)
-(defvar org-babel-tangle-lang-exts) ;; Autoloaded
+(defvar org-babel-tangle-lang-exts nil) ;; Autoloaded
(add-to-list 'org-babel-tangle-lang-exts '("groovy" . "groovy"))
(defvar org-babel-default-header-args:groovy '())
(defcustom org-babel-groovy-command "groovy"
diff --git a/lisp/ob-haskell.el b/lisp/ob-haskell.el
index 05f340fa0..74a595914 100644
--- a/lisp/ob-haskell.el
+++ b/lisp/ob-haskell.el
@@ -53,7 +53,7 @@
"ext:inf-haskell" (&optional reload))
(declare-function org-entry-get "org" (pom property &optional inherit literal-nil))
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("haskell" . "hs"))
(defvar org-babel-default-header-args:haskell
diff --git a/lisp/ob-java.el b/lisp/ob-java.el
index fd6206357..2d4fcdd9e 100644
--- a/lisp/ob-java.el
+++ b/lisp/ob-java.el
@@ -34,7 +34,7 @@
(require 'ob)
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("java" . "java"))
(defvar org-babel-temporary-directory) ; from ob-core
diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el
index b72ca0625..36e8fb00b 100644
--- a/lisp/ob-latex.el
+++ b/lisp/ob-latex.el
@@ -45,7 +45,7 @@
(declare-function org-back-to-heading "org" (&optional invisible-ok))
(declare-function org-next-visible-heading "org" (arg))
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("latex" . "tex"))
(defvar org-format-latex-header) ; From org.el
diff --git a/lisp/ob-lisp.el b/lisp/ob-lisp.el
index 0e416ad9f..32f7bd3eb 100644
--- a/lisp/ob-lisp.el
+++ b/lisp/ob-lisp.el
@@ -46,7 +46,7 @@
(declare-function sly-eval "ext:sly" (sexp &optional package))
(declare-function slime-eval "ext:slime" (sexp &optional package))
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("lisp" . "lisp"))
(defvar org-babel-default-header-args:lisp '())
diff --git a/lisp/ob-lua.el b/lisp/ob-lua.el
index f7950eadd..9f7bcc351 100644
--- a/lisp/ob-lua.el
+++ b/lisp/ob-lua.el
@@ -38,7 +38,7 @@
(declare-function lua-toggle-shells "ext:lua-mode" (arg))
(declare-function run-lua "ext:lua" (cmd &optional dedicated show))
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("lua" . "lua"))
(defvar org-babel-default-header-args:lua '())
diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
index afd615f8d..2dede202e 100644
--- a/lisp/ob-maxima.el
+++ b/lisp/ob-maxima.el
@@ -42,7 +42,7 @@
(graphics-pkg . ((plot draw))))
"Maxima-specific header arguments.")
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("maxima" . "max"))
(defvar org-babel-default-header-args:maxima '())
diff --git a/lisp/ob-ocaml.el b/lisp/ob-ocaml.el
index 6554193a7..45df11fb5 100644
--- a/lisp/ob-ocaml.el
+++ b/lisp/ob-ocaml.el
@@ -47,7 +47,7 @@
(declare-function tuareg-run-ocaml "ext:tuareg" ())
(declare-function tuareg-interactive-send-input "ext:tuareg" ())
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("ocaml" . "ml"))
(defvar org-babel-default-header-args:ocaml '())
diff --git a/lisp/ob-perl.el b/lisp/ob-perl.el
index 1006ffb12..4eb9104a3 100644
--- a/lisp/ob-perl.el
+++ b/lisp/ob-perl.el
@@ -34,7 +34,7 @@
(require 'ob)
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("perl" . "pl"))
(defvar org-babel-default-header-args:perl '())
diff --git a/lisp/ob-processing.el b/lisp/ob-processing.el
index 2733b1d1f..f78aa23b4 100644
--- a/lisp/ob-processing.el
+++ b/lisp/ob-processing.el
@@ -62,7 +62,7 @@
(defvar org-babel-temporary-directory)
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("processing" . "pde"))
;; Default header tags depend on whether exporting html or not; if not
diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 1afbcb5de..7efa6e63d 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -36,7 +36,7 @@
(require 'org-macs)
(require 'python)
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("python" . "py"))
(defvar org-babel-default-header-args:python '())
diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el
index d920fb585..93f0d66be 100644
--- a/lisp/ob-ruby.el
+++ b/lisp/ob-ruby.el
@@ -49,7 +49,7 @@
(defvar inf-ruby-default-implementation)
(defvar inf-ruby-implementations)
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("ruby" . "rb"))
(defvar org-babel-default-header-args:ruby '())
diff --git a/lisp/ob-sed.el b/lisp/ob-sed.el
index 495f2b3e3..84bf1385d 100644
--- a/lisp/ob-sed.el
+++ b/lisp/ob-sed.el
@@ -49,7 +49,7 @@
(defvar org-babel-sed-command "sed"
"Name of the sed executable command.")
-(defvar org-babel-tangle-lang-exts)
+(defvar org-babel-tangle-lang-exts nil)
(add-to-list 'org-babel-tangle-lang-exts '("sed" . "sed"))
(defconst org-babel-header-args:sed
--
2.44.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] initialize org-babel-tangle-lang-exts to nil
2024-06-28 21:22 [PATCH] initialize org-babel-tangle-lang-exts to nil Tom Gillespie
@ 2024-06-29 6:51 ` Ihor Radchenko
2024-06-29 6:57 ` Tom Gillespie
0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2024-06-29 6:51 UTC (permalink / raw)
To: Tom Gillespie; +Cc: emacs-orgmode
Tom Gillespie <tgbugs@gmail.com> writes:
> Here is a fix for bad init values for org-babel-tangle-lang-exts.
> Details in the patch commit message.
> ...
> Subject: [PATCH] initialize org-babel-tangle-lang-exts to nil
> ...
> org-bable-tangle-lang-exts should be initialized to nil and not as a
> void variable, if it is not already initialized then this will cause a
> void-variable error immediately when it is used in add-to-list
>
> this corrects the original addition in
> 4a0e5cf88f684db775ccf43dc5edc2e8754a2d92 as well as other files that
> followed the pattern
Thanks for the patch, but it is not a correct way to fix the problem.
`org-babel-tangle-lang-exts' is a custom option defined in
ob-tangle.el. If you define it as a global variable separately, there
will be subtle bugs depending on the order of loading of ob-tangle and
the other files defining the same variable.
Currently, it is expected that babel backends *must* be loaded after
ob-tangle.
More accurate approach would be using (eval-after-load 'ob-tangle
...). This is what is being done in WIP branch that addresses many
similar problems across Org mode:
https://git.sr.ht/~yantar92/org-mode/log/feature/refactor-deps-v2
https://git.sr.ht/~yantar92/org-mode/commit/6bcb99413e18324367fa27f8572955d5a92092ce
Canceled.
--
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] 3+ messages in thread
* Re: [PATCH] initialize org-babel-tangle-lang-exts to nil
2024-06-29 6:51 ` Ihor Radchenko
@ 2024-06-29 6:57 ` Tom Gillespie
0 siblings, 0 replies; 3+ messages in thread
From: Tom Gillespie @ 2024-06-29 6:57 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
> More accurate approach would be using (eval-after-load 'ob-tangle
> ...). This is what is being done in WIP branch that addresses many
> similar problems across Org mode:
> https://git.sr.ht/~yantar92/org-mode/log/feature/refactor-deps-v2
> https://git.sr.ht/~yantar92/org-mode/commit/6bcb99413e18324367fa27f8572955d5a92092ce
Got it. Will keep an eye on this. Thanks!
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-29 6:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28 21:22 [PATCH] initialize org-babel-tangle-lang-exts to nil Tom Gillespie
2024-06-29 6:51 ` Ihor Radchenko
2024-06-29 6:57 ` Tom Gillespie
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.