mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-04 15:41:37 -05:00
Keep uppercase characters in kernel language names
Converting to lowercase was done arbitrarily. So that one could write `(jupyter-lang wolfram-language)` instead of `(jupyter-lang Wolfram-Language)`. fixes #241 * CHANGELOG.org: Add note. * README.org: Update relevant sections. * jupyter-base.el (jupyter-canonicalize-language-string): Do it. * ob-jupyter.el (org-babel-jupyter-aliases-from-kernelspecs):
This commit is contained in:
parent
82f8fe691e
commit
587ed4e029
5 changed files with 21 additions and 14 deletions
|
@ -1,3 +1,9 @@
|
|||
* master
|
||||
|
||||
- Fixed regression due to uppercase characters in kernel language
|
||||
names, e.g. R. =emacs-jupyter= would not work at all with language
|
||||
specific features.
|
||||
|
||||
* v0.8.2
|
||||
|
||||
- Fix recursive loading error caused by =jupyter-tramp.el= autoloads.
|
||||
|
|
13
README.org
13
README.org
|
@ -419,10 +419,9 @@ to change the defaults for the =julia= kernel, you can set
|
|||
#+END_SRC
|
||||
*** Note on the language name provided by a kernelspec
|
||||
|
||||
Some kernelspecs use spaces or uppercase characters in the name of the kernel
|
||||
language. Those get replaced by dashes or lowercase characters in the language
|
||||
name you need to use for the source block, e.g. =Wolfram Language=
|
||||
becomes =jupyter-wolfram-language=.
|
||||
Some kernelspecs use spaces in the name of the kernel language. Those
|
||||
get replaced by dashes in the language name you need to use for the
|
||||
source block, e.g. =Wolfram Language= becomes =jupyter-Wolfram-Language=.
|
||||
|
||||
*** Integration with =ob-async=
|
||||
|
||||
|
@ -1427,9 +1426,9 @@ kernel language is =julia= for indenting the current line:
|
|||
(call-interactively #'julia-latexsub-or-indent))
|
||||
#+END_SRC
|
||||
|
||||
Note, when spaces or uppercase characters appear in the name of the kernel
|
||||
language they become dashes or lowercase characters in the symbol used for
|
||||
the =jupyter-lang= context, e.g. =Wolfram Language= becomes =wolfram-language=.
|
||||
Note, when spaces appear in the name of the kernel language they
|
||||
become dashes in the symbol used for the =jupyter-lang= context,
|
||||
e.g. =Wolfram Language= becomes =Wolfram-Language=.
|
||||
|
||||
There are many other entry points where methods may be overridden in such a
|
||||
way. Below is the full list of methods that can be overridden in this way
|
||||
|
|
|
@ -537,12 +537,14 @@ Note only SSH tunnels are currently supported."
|
|||
;;; Helper functions
|
||||
|
||||
(defun jupyter-canonicalize-language-string (str)
|
||||
"Return STR with \" \" converted to \"-\" and all characters in lower case."
|
||||
"Return STR with \" \" converted to \"-\".
|
||||
The `file-name-nondirectory' of STR will be converted and
|
||||
returned if it looks like a file path."
|
||||
;; The call to `file-name-nondirectory' is here to be more robust when
|
||||
;; running on systems like Guix or Nix. Some builders on those kinds of
|
||||
;; systems will indiscriminately replace "python" with something like
|
||||
;; "/gnu/store/.../bin/python" when building the kernelspecs.
|
||||
(downcase (replace-regexp-in-string " " "-" (file-name-nondirectory str))))
|
||||
(replace-regexp-in-string " " "-" (file-name-nondirectory str)))
|
||||
|
||||
(defvar server-buffer)
|
||||
(defvar jupyter-current-client)
|
||||
|
|
|
@ -636,11 +636,10 @@ SPECS defaults to `jupyter-available-kernelspecs'. Optional
|
|||
argument REFRESH has the same meaning as in
|
||||
`jupyter-available-kernelspecs'.
|
||||
|
||||
Note, spaces or uppercase characters in the kernel language name
|
||||
are converted into dashes or lowercase characters in the language
|
||||
alias, e.g.
|
||||
Note, spaces in the kernel language name are converted into
|
||||
dashes in the language alias, e.g.
|
||||
|
||||
Wolfram Language -> jupyter-wolfram-language
|
||||
Wolfram Language -> jupyter-Wolfram-Language
|
||||
|
||||
For convenience, after creating a language alias for a kernel
|
||||
language LANG, set the :kernel default header argument if not
|
||||
|
|
|
@ -678,7 +678,8 @@
|
|||
(ert-deftest jupyter-canonicalize-language-string ()
|
||||
:tags '(base env)
|
||||
(should (equal (jupyter-canonicalize-language-string "Wolfram Language")
|
||||
"wolfram-language"))
|
||||
"Wolfram-Language"))
|
||||
(should (equal (jupyter-canonicalize-language-string "R") "R"))
|
||||
(should (equal (jupyter-canonicalize-language-string "/gnu/store/python")
|
||||
"python")))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue