Zap aliases in `org-babel-active-languages' and sort the result

This commit is contained in:
Gerard Vermeulen 2023-05-11 20:37:56 +02:00
parent 3f31f3d094
commit c4df881777

View File

@ -2529,45 +2529,46 @@ Return a list of items where the filename is the `car' of each item and the
#+header: :wrap "src emacs-lisp :results silent :tangle no" #+header: :wrap "src emacs-lisp :results silent :tangle no"
#+begin_src emacs-lisp :exports both :results value pp #+begin_src emacs-lisp :exports both :results value pp
(defun org-babel-active-languages () (defun org-babel-active-languages ()
(let ((result '("conf" "latex-extra-header" "latex-header" "text" "toml"))) (let ((result '("conf" "text" "toml")))
(mapatoms (mapatoms
(lambda (x) (lambda (x)
(when (and (when (and
(string-prefix-p "org-babel-execute:" (symbol-name x)) (string-prefix-p "org-babel-execute:" (symbol-name x))
(not (eq 'org-babel-shell-initialize (get x 'definition-name)))) ;; Get rid of all sub-modes in `ob-shell':
(not (eq 'org-babel-shell-initialize (get x 'definition-name)))
;; Get rid of aliases:
(not (eq 'symbol (type-of (symbol-function x)))))
(when (symbol-file x) (when (symbol-file x)
(push (string-remove-prefix "org-babel-execute:" (symbol-name x)) (push (string-remove-prefix "org-babel-execute:" (symbol-name x))
result))))) result)))))
result)) result))
(mapcar #'list (org-babel-active-languages)) (mapcar #'list (cl-sort (org-babel-active-languages) #'string<))
#+end_src #+end_src
#+caption[Active Org Babel languages]: #+caption[Active Org Babel languages]:
#+caption: Active Org Babel languages. #+caption: Active Org Babel languages.
#+RESULTS: lst:org-babel-active-languages #+RESULTS: lst:org-babel-active-languages
#+begin_src emacs-lisp :results silent :tangle no #+begin_src emacs-lisp :results silent :tangle no
(("calc") (("C")
("perl")
("lisp")
("eshell")
("maxima")
("fortran")
("D")
("C")
("C++") ("C++")
("latex-header") ("D")
("org") ("calc")
("cpp")
("js")
("shell")
("elisp")
("latex-extra-header")
("latex")
("emacs-lisp")
("conf") ("conf")
("cpp")
("emacs-lisp")
("eshell")
("fortran")
("js")
("latex")
("latex-extra-header") ("latex-extra-header")
("latex-header") ("latex-header")
("lisp")
("maxima")
("org")
("perl")
("scheme")
("shell")
("text") ("text")
("toml")) ("toml"))
#+end_src #+end_src