ob-sagemath icon indicating copy to clipboard operation
ob-sagemath copied to clipboard

The ob-sagemath should match org-babel load convention.

Open stardiviner opened this issue 9 years ago • 2 comments

The file should rename to ob-sage.el to match org-babel load convenstion.

stardiviner avatar Aug 08 '16 05:08 stardiviner

You can load ob-sagemath by org-babel-do-load-languages as follows:

    (org-babel-do-load-languages
     'org-babel-load-languages
     '((sagemath . t)))

Will the mismatch cause an actual problem? I think if the file name is renamed, the package name also should be renamed. It will be more confusing for users. So if possible, I do not want to rename it.

stakemori avatar Aug 08 '16 09:08 stakemori

Because I have an advice which can lazy load babel support:

(defadvice org-babel-execute-src-block (around load-language nil activate)
  "Load language if needed."
  (let ((language (org-element-property :language (org-element-at-point))))
    ;; workaround for #+CALL: babel. (`language' will be `nil')
    (if language
        ;; whether language is already loaded in `org-babel-load-languages'.
        (unless (cdr (assoc (intern language) org-babel-load-languages))
          (require (intern (concat "ob-" language)))
          (add-to-list 'org-babel-load-languages (cons (intern language) t))
          (org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages))
      )
    ad-do-it))

What about rename babel language name #+BEGIN_SRC sage -> #+BEGIN_SRC sagemath ?

I know it is not a good idea to change name. But renaming package name and filename is the least cost for convention.

stardiviner avatar Aug 08 '16 12:08 stardiviner