Remove broken "lst:valid-org-babel-load-languages-entries"

This commit is contained in:
Gerard Vermeulen 2024-06-11 10:31:36 +02:00
parent baab7a0639
commit b273f207d4

View File

@ -2934,71 +2934,11 @@ SCHEDULED: <2023-06-30 Fri>
:CUSTOM_ID: sec:org-introspection
:END:
1. Listing [[lst:valid-org-babel-load-languages-entries]] extracts an association
list of library names and ~org-babel-execute:LANGUAGE~ function names.
2. Listing [[lst:org-babel-active-languages]] produces a list containing language
1. Listing [[lst:org-babel-active-languages]] produces a list containing language
names that have ~org-babel-execute:LANGUAGE~ functions.
3. Listing [[lst:get-in-buffer-settings]] and [[lst:get-in-buffer-settings-result]] show
2. Listing [[lst:get-in-buffer-settings]] and [[lst:get-in-buffer-settings-result]] show
how to access [[info:org#In-buffer Settings][In-buffer Settings (info)]].
#+caption[Find valid entries for =org-babel-load-languages=]:
#+caption: Find valid entries for =org-babel-load-languages=.
#+name: lst:valid-org-babel-load-languages-entries
#+header: :wrap "src emacs-lisp -n :eval never :tangle no"
#+begin_src emacs-lisp -n :exports both :results value pp :tangle no
;; "Search failed:" with paren mismatching problems start here,
;; but the problems are not due to this source block.
(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
#+caption[Org Babel libraries with =org-babel-execute:language= functions]:
#+caption: Org Babel libraries with =org-babel-execute:language= functions.
#+RESULTS: lst:valid-org-babel-load-languages-entries
#+begin_src emacs-lisp -n :eval never :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
#+caption[Find active Org Babel languages]:
#+caption: Find active Org Babel languages.
#+name: lst:org-babel-active-languages