emacs-orgmode
[Top][All Lists]
Advanced

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

[BUG] Emacs-29.0.60: (setopt org-babel-load-languages ...) may cause war


From: gerard . vermeulen
Subject: [BUG] Emacs-29.0.60: (setopt org-babel-load-languages ...) may cause warnings
Date: Tue, 31 Jan 2023 07:19:42 +0000

Hi,

I have been replacing to calls to =custom-set-variables= with calls to the safer
=setopt= (new in Emacs-29.0.60) and I discovered that calling
src_emacs-lisp{(setopt org-babel-load-languages '((eshell t) (emacs-lisp t)))} raises a warning because =eshell= is missing from the =org-babel-load-languages= =defcustom=. The code below shows that this =defcustom= is quit out of sync with
the rest of the code base:

#+header: :wrap "src emacs-lisp :results silent :tangle no"
#+begin_src emacs-lisp :exports both :results value pp :exports both
(defun all-org-babel-execute-fns ()
"Find `ob-LANGUAGE' files in Org defining `org-babel-execute:LANGUAGE'.

Return a list of items where the filename is the `car' of each item and the
`cdr' of each item lists the `org-babel-execute:LANGUAGE' functions."
  (let* ((dir (file-name-parent-directory (locate-library "org")))
(names (directory-files dir t (rx "ob-" (+ print) ".el" eos))))
    (cl-loop for name in names
             for found = (has-org-babel-execute-fn name)
             when found collect found)))

(defun has-org-babel-execute-fn (name)
  (let* ((buffer (find-file-noselect name))
         (base (file-name-base (buffer-file-name buffer)))
(regexp (rx "defun" (+ blank) "org-babel-execute:" (group (+ graphic))))
         (matches))
    (save-match-data
      (save-excursion
        (with-current-buffer buffer
          (save-restriction
            (widen)
            (goto-char 1)
            (while (re-search-forward regexp nil t 1)
              (push (match-string-no-properties 1) matches))))))
    (when matches
      `(,base ,@matches))))

(all-org-babel-execute-fns)
#+end_src

#+RESULTS:
#+begin_src emacs-lisp :results silent :tangle no
(("ob-C" "C" "D" "C++" "cpp")
 ("ob-R" "R")
 ("ob-awk" "awk")
 ("ob-calc" "calc")
 ("ob-clojure" "clojurescript" "clojure")
 ("ob-css" "css")
 ("ob-ditaa" "ditaa")
 ("ob-dot" "dot")
 ("ob-emacs-lisp" "emacs-lisp")
 ("ob-eshell" "eshell")
 ("ob-forth" "forth")
 ("ob-fortran" "fortran")
 ("ob-gnuplot" "gnuplot")
 ("ob-groovy" "groovy")
 ("ob-haskell" "haskell")
 ("ob-java" "java")
 ("ob-js" "js")
 ("ob-julia" "julia")
 ("ob-latex" "latex")
 ("ob-lilypond" "lilypond")
 ("ob-lisp" "lisp")
 ("ob-lua" "lua")
 ("ob-makefile" "makefile")
 ("ob-maxima" "maxima")
 ("ob-ocaml" "ocaml")
 ("ob-octave" "octave" "matlab")
 ("ob-org" "org")
 ("ob-perl" "perl")
 ("ob-plantuml" "plantuml")
 ("ob-processing" "processing")
 ("ob-python" "python")
 ("ob-ruby" "ruby")
 ("ob-sass" "sass")
 ("ob-scheme" "scheme")
 ("ob-screen" "screen")
 ("ob-sed" "sed")
 ("ob-shell" "shell")
 ("ob-sql" "sql")
 ("ob-sqlite" "sqlite"))
#+end_src

The attached patch synchronizes the =defcustom= with the rest of the
code base, groups languages by org-babel file, and uses camel-case to
spell languages (the new fashion).

Best regards -- Gerard

Attachment: fix-org-babel-load-languages.patch
Description: Binary data


reply via email to

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