Subject: bug#71851: 31.0.50; error with (use-package org ...)

From: Ihor Radchenko <[email-masked]>
Date: Mon, 01 Jul 2024 11:11:08 +0000

Jeremy Bryant <[email-masked]> writes:

>> Steps to reproduce: on the latest master, Emacs -Q, evaluating
>>
>> (use-package org
>>   :custom
>>   (org-babel-load-languages '((latex . t) (emacs-lisp . t) (python . t))))
> ...
> Adding Ihor who may be able to review.
>
> FWIW, I tried this on 29.4 and there is no error, so this may be from a recent commit.

I was able to reproduce using exact steps, using Emacs master.
Emacs 29.4 has no problem. Loading external Org mode repo also works.

Sounds like something about autoloads? I am not sure.

The problem is triggered by

(defcustom org-babel-latex-process-alist
  `(,(cons 'png (alist-get 'dvipng org-preview-latex-process-alist)))

in ob-latex.

`org-preview-latex-process-alist' is defined in org.el and the backtrace
in the reproducer points to org.el loading ob-latex. Somehow, only on
master, `org-preview-latex-process-alist' is not available.

Debugger entered--Lisp error: (void-variable org-preview-latex-process-alist)
  #f(compiled-function () #<bytecode -0x14ab3e57384cb8f6>)()
  funcall(#f(compiled-function () #<bytecode -0x14ab3e57384cb8f6>))
  eval((funcall #'#f(compiled-function () #<bytecode -0x14ab3e57384cb8f6>)))
  custom-initialize-reset(org-babel-latex-process-alist (funcall #'#f(compiled-function () #<bytecode -0x14ab3e57384cb8f6>)))
  custom-declare-variable(org-babel-latex-process-alist (funcall #'#f(compiled-function () #<bytecode -0x14ab3e57384cb8f6>)) "Definitions of external processes for LaTeX result generation.\nSee `org-preview-latex-process-alist' for more details.\n\nThe following process symbols are recognized:\n- `png' :: Process used to produce .png output." :group org-babel :package-version (Org . "9.7") :type (alist :tag "LaTeX to image backends" :value-type (plist)))
  byte-code("\300\301\302\303\304DD\305\306\307\310\311&\7\210\300\312\302\303\313DD\314\306\307\310\303&\7\210\300\315\302\303\316DD\317\306\307\310\303&\7\210\300\320\302\303\321DD\322\306\307\310\303&\7\210\300\323\302\303\324DD\325\306\307\310\311\326\327&\11\210\300\330\302\303\331DD\332\306\307\310\333&\7\210\300\334\302\303\335DD\336\306\307\326\337\310\340&\11\207" [custom-declare-variable org-babel-latex-htlatex funcall function #f(compiled-function () #<bytecode -0x6ca028d8a28b9ec>) "The htlatex command to enable conversion of LaTeX to SVG or HTML." :group org-babel :type string org-babel-latex-preamble #f(compiled-function () #<bytecode 0x7df15e625b1ebfc>) "Closure which evaluates at runtime to the LaTeX preamble.\n\nIt takes 1 argument which is the parameters of the source block." org-babel-latex-begin-env #f(compiled-function () #<bytecode 0x7df15e625b1ebfc>) "Function that evaluates to the begin part of the document environment.\n\nIt takes 1 argument which is the parameters of the source block.\nThis allows adding additional code that will be ignored when\nexporting the literal LaTeX source." org-babel-latex-end-env #f(compiled-function () #<bytecode 0x7df15e625b1ebfc>) "Closure which evaluates at runtime to the end part of the document environment.\n\nIt takes 1 argument which is the parameters of the source block.\nThis allows adding additional code that will be ignored when\nexporting the literal LaTeX source." org-babel-latex-pdf-svg-process #f(compiled-function () #<bytecode 0x79ea5ab5192d60c>) "Command to convert a PDF file to an SVG file." :package-version (Org . "9.6") org-babel-latex-htlatex-packages #f(compiled-function () #<bytecode -0xc515f11e1fb26d2>) "Packages to use for htlatex export." (repeat (string)) org-babel-latex-process-alist #f(compiled-function () #<bytecode -0x14ab3e57384cb8f6>) "Definitions of external processes for LaTeX result generation.\nSee `org-preview-latex-process-alist' for more details.\n\nThe following process symbols are recognized:\n- `png' :: Process used to produce .png output." (Org . "9.7") (alist :tag "LaTeX to image backends" :value-type (plist))] 10)
  org-babel-do-load-languages(org-babel-load-languages ((latex . t) (emacs-lisp . t) (python . t)))
  custom-initialize-reset(org-babel-load-languages (funcall #'#f(compiled-function () #<bytecode 0x18c000ae69414>)))
  custom-declare-variable(org-babel-load-languages (funcall #'#f(compiled-function () #<bytecode 0x18c000ae69414>)) "Languages which can be evaluated in Org buffers.\n\\<org-mode-map>\nThis list can be used to load support for any of the available\nlanguages with babel support (see info node `(org) Languages').  Each\nlanguage will depend on a different set of system executables and/or\nEmacs modes.\n\nWhen a language is \"loaded\", code blocks in that language can\nbe evaluated with `org-babel-execute-src-block', which is bound\nby default to \\[org-ctrl-c-ctrl-c].\n\nThe `org-babel-no-eval-on-ctrl-c-ctrl-c' option can be set to\nremove code block evaluation from \\[org-ctrl-c-ctrl-c].  By\ndefault, only Emacs Lisp is loaded, since it has no specific\nrequirement." :group org-babel :set org-babel-do-load-languages :package-version (Org . "9.6") :type (alist :tag "Babel Languages" :key-type (choice (const :tag "Awk" awk) (const :tag "C, D, C++, and cpp" C) (const :tag "R" R) (const :tag "Calc" calc) (const :tag "Clojure and ClojureScript" clojure) (const :tag "CSS" css) (const :tag "Ditaa" ditaa) (const :tag "Dot" dot) (const :tag "Emacs Lisp" emacs-lisp) (const :tag "Eshell" eshell) (const :tag "Forth" forth) (const :tag "Fortran" fortran) (const :tag "GnuPlot" gnuplot) (const :tag "Groovy" groovy) (const :tag "Haskell" haskell) (const :tag "Java" java) (const :tag "JavaScript" js) (const :tag "Julia" julia) (const :tag "LaTeX" latex) (const :tag "LilyPond" lilypond) (const :tag "Lisp" lisp) (const :tag "Lua" lua) (const :tag "Makefile" makefile) (const :tag "Maxima" maxima) (const :tag "OCaml" ocaml) (const :tag "Octave and MatLab" octave) (const :tag "Org" org) (const :tag "Perl" perl) (const :tag "Processing" processing) (const :tag "PlantUML" plantuml) (const :tag "Python" python) (const :tag "Ruby" ruby) (const :tag "Sass" sass) (const :tag "Scheme" scheme) (const :tag "Screen" screen) (const :tag "Sed" sed) (const :tag "Shell Script" shell) (const :tag "Sql" sql) (const :tag "Sqlite" sqlite)) :value-type (boolean :tag "Activate" :value t)))
  byte-code("\300\301\302\303\304DD\305\306\307\310\311\312\313\314\315&\13\210\300\316\302\303\317DD\320\314\321\322\323\306\324&\11\210\325\326\327\"\210\325\330\327\"\207" [custom-declare-variable org-babel-load-languages funcall function #f(compiled-function () #<bytecode 0x18c000ae69414>) "Languages which can be evaluated in Org buffers.\n\\<org-mode-map>\nThis list can be used to load support for any of the available\nlanguages with babel support (see info node `(org) Languages').  Each\nlanguage will depend on a different set of system executables and/or\nEmacs modes.\n\nWhen a language is \"loaded\", code blocks in that language can\nbe evaluated with `org-babel-execute-src-block', which is bound\nby default to \\[org-ctrl-c-ctrl-c].\n\nThe `org-babel-no-eval-on-ctrl-c-ctrl-c' option can be set to\nremove code block evaluation from \\[org-ctrl-c-ctrl-c].  By\ndefault, only Emacs Lisp is loaded, since it has no specific\nrequirement." :group org-babel :set org-babel-do-load-languages :package-version (Org . "9.6") :type (alist :tag "Babel Languages" :key-type (choice (const :tag "Awk" awk) (const :tag "C, D, C++, and cpp" C) (const :tag "R" R) (const :tag "Calc" calc) (const :tag "Clojure and ClojureScript" clojure) (const :tag "CSS" css) (const :tag "Ditaa" ditaa) (const :tag "Dot" dot) (const :tag "Emacs Lisp" emacs-lisp) (const :tag "Eshell" eshell) (const :tag "Forth" forth) (const :tag "Fortran" fortran) (const :tag "GnuPlot" gnuplot) (const :tag "Groovy" groovy) (const :tag "Haskell" haskell) (const :tag "Java" java) (const :tag "JavaScript" js) (const :tag "Julia" julia) (const :tag "LaTeX" latex) (const :tag "LilyPond" lilypond) (const :tag "Lisp" lisp) (const :tag "Lua" lua) (const :tag "Makefile" makefile) (const :tag "Maxima" maxima) (const :tag "OCaml" ocaml) (const :tag "Octave and MatLab" octave) (const :tag "Org" org) (const :tag "Perl" perl) (const :tag "Processing" processing) (const :tag "PlantUML" plantuml) (const :tag "Python" python) (const :tag "Ruby" ruby) (const :tag "Sass" sass) (const :tag "Scheme" scheme) (const :tag "Screen" screen) (const :tag "Sed" sed) (const :tag "Shell Script" shell) (const :tag "Sql" sql) (const :tag "Sqlite" sqlite)) :value-type (boolean :tag "Activate" :value t)) org-clone-delete-id #f(compiled-function () #<bytecode 0x18c000ae69414>) "Remove ID property of clones of a subtree.\nWhen non-nil, clones of a subtree don't inherit the ID property.\nOtherwise they inherit the ID property with a new unique\nidentifier." boolean :version "24.1" org-id autoload org-release "org-version.el" org-git-version] 12)
  require(org nil t)
  (not (require 'org nil t))
  (if (not (require 'org nil t)) (display-warning 'use-package (format "Cannot load %s" 'org) :error))
  (progn (let ((custom--inhibit-theme-enable nil)) (if (memq 'use-package custom-known-themes) nil (custom-declare-theme 'use-package 'use-package-theme nil (list)) (enable-theme 'use-package) (setq custom-enabled-themes (remq 'use-package custom-enabled-themes))) (custom-theme-set-variables 'use-package '(org-babel-load-languages '((latex . t) (emacs-lisp . t) (python . t)) nil nil "Customized with use-package org"))) (if (not (require 'org nil t)) (display-warning 'use-package (format "Cannot load %s" 'org) :error)))
  (condition-case err (progn (let ((custom--inhibit-theme-enable nil)) (if (memq 'use-package custom-known-themes) nil (custom-declare-theme 'use-package 'use-package-theme nil (list)) (enable-theme 'use-package) (setq custom-enabled-themes (remq 'use-package custom-enabled-themes))) (custom-theme-set-variables 'use-package '(org-babel-load-languages '(... ... ...) nil nil "Customized with use-package org"))) (if (not (require 'org nil t)) (display-warning 'use-package (format "Cannot load %s" 'org) :error))) ((debug error) (funcall use-package--warning1 :catch err)))
  (progn (defvar use-package--warning1 #'(lambda (keyword err) (let ((msg (format "%s/%s: %s" ... keyword ...))) (display-warning 'use-package msg :error)))) (condition-case err (progn (let ((custom--inhibit-theme-enable nil)) (if (memq 'use-package custom-known-themes) nil (custom-declare-theme 'use-package 'use-package-theme nil (list)) (enable-theme 'use-package) (setq custom-enabled-themes (remq 'use-package custom-enabled-themes))) (custom-theme-set-variables 'use-package '(org-babel-load-languages '... nil nil "Customized with use-package org"))) (if (not (require 'org nil t)) (display-warning 'use-package (format "Cannot load %s" 'org) :error))) ((debug error) (funcall use-package--warning1 :catch err))))
  (progn (progn (defvar use-package--warning1 #'(lambda (keyword err) (let ((msg ...)) (display-warning 'use-package msg :error)))) (condition-case err (progn (let ((custom--inhibit-theme-enable nil)) (if (memq 'use-package custom-known-themes) nil (custom-declare-theme 'use-package 'use-package-theme nil (list)) (enable-theme 'use-package) (setq custom-enabled-themes (remq ... custom-enabled-themes))) (custom-theme-set-variables 'use-package '(org-babel-load-languages ... nil nil "Customized with use-package org"))) (if (not (require 'org nil t)) (display-warning 'use-package (format "Cannot load %s" 'org) :error))) ((debug error) (funcall use-package--warning1 :catch err)))))
  eval((progn (progn (defvar use-package--warning1 #'(lambda (keyword err) (let (...) (display-warning ... msg :error)))) (condition-case err (progn (let ((custom--inhibit-theme-enable nil)) (if (memq ... custom-known-themes) nil (custom-declare-theme ... ... nil ...) (enable-theme ...) (setq custom-enabled-themes ...)) (custom-theme-set-variables 'use-package '...)) (if (not (require ... nil t)) (display-warning 'use-package (format "Cannot load %s" ...) :error))) ((debug error) (funcall use-package--warning1 :catch err))))) t)
  elisp--eval-last-sexp(nil)
  #f(compiled-function () #<bytecode 0xf626b78376ca>)()
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  command-execute(eval-last-sexp)

-- 
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>