diff options
author | Aaron Ecay <aaronecay@gmail.com> | 2016-02-14 15:14:30 +0000 |
---|---|---|
committer | Aaron Ecay <aaronecay@gmail.com> | 2016-02-22 16:04:03 +0000 |
commit | 848a87634d3d2d8de9e0403867a780897db63a73 (patch) | |
tree | 73d54ddfa89140606bea9fb618175dff0f04ba73 | |
parent | a311a856514e9245074b02c89d51a9f339784d1c (diff) | |
download | org-mode-848a87634d3d2d8de9e0403867a780897db63a73.tar.gz |
Add org-babel-make-language-alias function.
* lisp/ob-core.el (org-babel-make-language-alias): New function.
* lisp/ob-emacs-lisp.el: Use it.
Previously this was accomplished via org-src-lang-modes, but that is a
poor solution, as it conflates the remapping of language mode names with
the creation of aliases.
-rw-r--r-- | lisp/ob-core.el | 20 | ||||
-rw-r--r-- | lisp/ob-emacs-lisp.el | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 74d820c..7452a74 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -3161,6 +3161,26 @@ plus the parameter value." (and (member "graphics" (cdr (assq :result-params params))) (cdr (assq :file params)))) +(defun org-babel-make-language-alias (new old) + "Make source blocks of type NEW aliases for those of type OLD. + +NEW and OLD should be strings. This function should be called +after the babel API for OLD-type source blocks is fully defined. + +Callers of this function will probably want to add an entry to +`org-src-lang-modes' as well." + (dolist (fn '("execute" "expand-body" "prep-session" + "variable-assignments" "load-session")) + (let ((sym (intern-soft (concat "org-babel-" fn ":" old)))) + (when (and sym (fboundp sym)) + (defalias (intern (concat "org-babel-" fn ":" new)) sym)))) + ;; Technically we don't need a `dolist' for just one variable, but + ;; we keep it for symmetry/ease of future expansion. + (dolist (var '("default-header-args")) + (let ((sym (intern-soft (concat "org-babel-" var ":" old)))) + (when (and sym (boundp sym)) + (defvaralias (intern (concat "org-babel-" var ":" new)) sym))))) + (provide 'ob-core) ;; Local variables: diff --git a/lisp/ob-emacs-lisp.el b/lisp/ob-emacs-lisp.el index 18936a6..2eb2721 100644 --- a/lisp/ob-emacs-lisp.el +++ b/lisp/ob-emacs-lisp.el @@ -72,6 +72,8 @@ (org-babel-pick-name (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params)))))))) +(org-babel-make-language-alias "elisp" "emacs-lisp") + (provide 'ob-emacs-lisp) |