Change octave executable to jupyter kernel in emacs octave-mode - emacs

How do I change the octave-mode to use the command jupyter kernel --kernel octave as the default octave shell?
Edit: Here's a list of things I tried (adding them here as suggested in the comments):
Changed the variable inferior-octave-program using:
(eval-after-load 'octave (setq inferior-octave-program "jupyter console --kernel octave"))
This however gives the error: Searching for program: No such file or directory, jupyter console --kernel octave. And yes, I do have jupyter and octave_kernel installed and can launch it from terminal with jupyter console --kernel octave.

Untested - customize the variable inferior-octave-program; or if you prefer to do things manually, add the following to your emacs init file:
(eval-after-load 'octave (setq inferior-octave-program "jupyter kernel --kernel octave"))
The doc string for inferior-octave-program says:
inferior-octave-program is a variable defined in ‘octave.el’.
Its value is "octave"
This variable may be risky if used as a file-local variable.
You can customize this variable.
Documentation:
Program invoked by ‘inferior-octave’.

Related

Org-mode with Emacs: Where do I have to put my export in order to be able to use it in Emacs daemon?

I am struggling since this morning after the installation of CUDA 9 and cudnn 7. I am running emacs as a daemon, zsh as my default shell and I want to user org-mode to write notebook.
Here is my .zshenv:
...
export LIBRARY_PATH="/usr/include/gtk-3.0:$LIBRARY_PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-9.0/lib64:$LD_LIBRARY_FOUND"
export PATH="/usr/local/cuda-9.0/bin:$PATH"
export SHELL="/bin/zsh"
export WORKON_HOME=$HOME/.virtualenvs
and here is the minimal notebook:
#+BEGIN_SRC ipython :results drawer :async t :session test
import os
print(os.environ["LD_LIBRARY_PATH"])
#+END_SRC
The problem is that emacs does not know LD_LIBRARY_PATH. It says KeyError.
Do you know where I can put my environment variables in order to be able to be read both by my terminal and Emacs-As-A-Daemon ? I thought it was in .zshenv and .zprofile but neither of them is working in daemon mode... (Because yes, it is working when I launch it regularly).
Precision:
The content of os.environ shows that it seems to read the .profile file only... But why ? My default terminal is zsh, not bash. I tried to put my export in .zprofile, restart systemd daemon of emacs, even rebooting, but without any effect.. Sorry if this is a silly question.
Alright, I succeed to solve my issue. Instead of dealing with Emacs configuration, I changed the systemd unit file with the addition of the EnvironmentFile variable which I set it equal to the path of my .zshenv:
EnvironmentFile=~/.zshenv

export org that has latex formular to odt failed

I followed this doc: http://orgmode.org/manual/Working-with-LaTeX-math-snippets.html#fn-1
install perl-latexml on my ArchLinux, my emacs is 25.1.1 + spacemacs
My org has one latex formular, when config the following line in emacs, export to odt failed
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
(require 'org)
(require 'org-chinese-utils)
(ocus-enable)
(setq org-latex-to-mathml-convert-command
"latexmlmath \"%i\" --presentationmathml=%o")
)
Formatting LaTeX using mathml OpenDocument export failed: Wrong type
argument: integer-or-marker-p,
How to fix this, I do not know what causes this problem?
If I remove the configuration in .spacemacs, export works, but no latex formular converted.
(setq org-latex-to-mathml-convert-command
"latexmlmath \"%i\" --presentationmathml=%o")
There was a bug in the odt dispatcher. In the function org-odt--translate-latex-fragments (see ox-odt.el) the function org-format-latex is called with the wrong arguments (or wrong order). I actually believe that this function was changed, and perhaps not all of the dispatchers were updated properly. Anyway, the bug was fixed in late 2016. Here is a link to the patch.
I am having exactly the same problem. My system is identical using Arch Linux, Emacs 25.1.1 and spacemacs. I also installed perl-latexml and configured emacs accordingly.
The error message is
OpenDocument export failed: Wrong type argument: integer-or-marker-p, "/path/to/folder/"
From my understanding the argument should be "/path/to/folder/file.org/" instead of "/path/to/folder/".
The error message is the same when I try to use dvipng or imagemagick to render the math snippets.
I also tried my older emacs config without spacemacs. The problem persists, so its independent of spacemacs.

looking for help in configuring .emacs file for python (python.el),

My emacs version is 24.5, using in built python. I have written these lines in my .emacs for it:
(require 'python)
(setq python-shell-interpreter "C:/Python34")
The problem is none of the commands (when I am trying to run test.py) are working. I have tried several commands named like
M-x python-shell-*
and they all return
"wrong type argument:arrayp, nil".
What I am doing wrong?
What am I supposed to do?
What should be ideal configuration (.emacs)?
Further info:
Python 3.4 installed at C:/
Emacs at C:/Program Files/
$HOME is C:/user/akk/appdata/roaming/
That variable is for the Python interpreter, not the Python directory.
I don't have a Windows machine to test on, but if you update your configuration to point to the actual binary (possibly C:/Python34/python.exe?) you should find that it works.
According to the mode documentation in the top of python.el, you can set this on windows like (change Python27 to Python34 for your use case:
(setq python-shell-interpreter "C:\\Python27\\python.exe")

Emacs 24.3 cannot find package (key-chord) during startup

I have Emacs 24.3 running on Raspbian. I'm kind of enjoying running Emacs on Linux - seems to be a beter fit than on Windows. I installed the very useful key-chord package using the usual package functions. This results in a directory in ~\.emacs.d\elpa\key-chord-20080915.2156.
Then I inserted the following in my init file:
(require 'key-chord)
(key-chord-mode 1)
This kicks out the following error:
File error: Cannot open load file, key-chord
However, if I hit M-x I can find all the key-chord functions and run key-chord mode and associated bits and pieces. What am I doing wrong...?
Emacs loads the installed packages after evaluating your init file. If you need your packages in your init file, you can use (package-initialize) to manually initialize the packages.
The reason you see some or all key-chord functions is that these functions are "autoloaded". You don't need a require to use these functions; in fact, the package is automatically loaded when you use such a function.

Emacs - Can't get Flymake to work with JSHint

I'm trying to get JSHint to work with Flymake.
jshint is indeed installed in /opt/bin and works. /opt/bin is in Emacs' exec-path.
I've followed the directions on the EmacsWiki and have this in my init.el:
(defun flymake-jshint-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "jshint" (list local-file))))
(setq flymake-err-line-patterns
(cons '("^ [[:digit:]]+ \\([[:digit:]]+\\),\\([[:digit:]]+\\): \\(.+\\)$"
nil 1 2 3)
flymake-err-line-patterns))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.js\\'" flymake-jshint-init))
When I open JavaScript files, my modeline appears as:
[(Javascript Flymake* AC)]
This is odd because the * usually doesn't appear when I'm using Flymake with C++ or Python. According to the Flymake docs, Flymake* means "Flymake is currently running." However, Flymake isn't showing any errors.
I've checked the *Messages* buffer but it only lists a few lines of Fontifying foo.js... (regexps...................). No errors.
Other suggestions?
Try using M-: to execute (setq flymake-log-level 3), which will cause flymake to print debug info into *Messages*.
Here's how I use flymake with jslint, which works nicely for me -- that code might give you a clue about what's going wrong for you.
You might also consider js2-mode, which provides some language-aware lint-like warnings without resorting to running an external process.
I found a project called jshint-mode and tried that. It created a buffer called *jshint-mode* which revealed the error: JSHint couldn't find the formidable module.
I ran M-x setenv in Emacs to set NODE_PATH so that jshint could find the formidable library. I also set NODE_PATH in /etc/profile.
jshint-mode did not work for me (I use Linux Mint 14 'Nadia') -- I was getting errors with "flymake's configuration" when it runs curl to talk to the Node.js instance running the jshint script. This was perplexing, and I'm not familiar with ELisp to go around messing with the .el files.
I solved this by instead going straight to the Emacs flymake project fork on github which now has support for jshint built-in (it needs to be installed as npm -g install jshint which in turn requires you to install npm and node.js if you haven't already). This made things work.
One more caveat: on my Linux box, node was an executable already existing in /usr/sbin and I had to make a symbolic link named node in /usr/local/bin to override the former. This was necessary as the Node.js binary for Linux Mint (possibly Ubuntu as well, I haven't checked) is named nodejs instead and will cause many scripts written assuming a binary name of node to fail. You can test this by typing node: if it is the pre-existing binary it generally returns to the prompt silently, but if it is Node.js it prompts you with a > (you can Ctrl-D to quit out of there)