emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: gerard.vermeulen@posteo.net
To: Emacs orgmode <emacs-orgmode@gnu.org>
Subject: [BUG] Emacs-29.0.60: (setopt org-babel-load-languages ...) may cause warnings
Date: Tue, 31 Jan 2023 07:19:42 +0000	[thread overview]
Message-ID: <712f2ef5b4edb2d9b565f6467e582030@posteo.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 2921 bytes --]

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 #2: fix-org-babel-load-languages.patch --]
[-- Type: application/octet-stream, Size: 2151 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index 1947c63a8..a3471ff64 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -302,42 +302,44 @@ requirement."
 		:key-type
 		(choice
 		 (const :tag "Awk" awk)
-		 (const :tag "C" C)
+		 (const :tag "C, D, C++, and cpp" C)
 		 (const :tag "R" R)
                  (const :tag "Calc" calc)
-		 (const :tag "Clojure" clojure)
+		 (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 "GnuPlot" gnuplot)
+		 (const :tag "Groovy" groovy)
 		 (const :tag "Haskell" haskell)
                  (const :tag "Java" java)
-		 (const :tag "Javascript" js)
-		 (const :tag "LaTeX" latex)
-                 (const :tag "Lilypond" lilypond)
+		 (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 "Matlab" matlab)
-                 (const :tag "Ocaml" ocaml)
-		 (const :tag "Octave" octave)
+                 (const :tag "OCaml" ocaml)
+		 (const :tag "Octave and MatLab" octave)
 		 (const :tag "Org" org)
 		 (const :tag "Perl" perl)
-		 (const :tag "Pico Lisp" picolisp)
+                 (const :tag "Processing" processing)
 		 (const :tag "PlantUML" plantuml)
 		 (const :tag "Python" python)
 		 (const :tag "Ruby" ruby)
 		 (const :tag "Sass" sass)
-		 (const :tag "Scala" scala)
 		 (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)
-		 (const :tag "Stan" stan))
+		 (const :tag "Sqlite" sqlite))
 		:value-type (boolean :tag "Activate" :value t)))
 
 ;;;; Customization variables

             reply	other threads:[~2023-01-31  7:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31  7:19 gerard.vermeulen [this message]
2023-01-31 10:34 ` [BUG] Emacs-29.0.60: (setopt org-babel-load-languages ...) may cause warnings Ihor Radchenko
2023-02-01 14:22   ` gerard.vermeulen
2023-02-02  8:26     ` Ihor Radchenko
2023-02-02 19:33       ` gerard.vermeulen
2023-03-03 14:58         ` Ihor Radchenko
2023-02-28  9:31       ` Bastien Guerry
2023-03-03 15:00         ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=712f2ef5b4edb2d9b565f6467e582030@posteo.net \
    --to=gerard.vermeulen@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).