FYI, some modes open only one inferior processs. For example, run-python will open an inferior process only if there isn't already an inferior process running. What you suggested with run-python actually does what you want.
For other modes (Matlab?), you could use a function that unhooks itself, like so:
(defun run-python-once ()
I achieved what I wanted by overriding some definitions from the original major mode. In /lisp/progmodes/octave.el (the file was zipped, I had to unzip it to view the source), I redefined octave-indent-comment which originally goes like this:
(defun octave-indent-comment ()
"A function for `smie-indent-functions' (which see)."
Try using more than one % or # in a row: %% or %%% etc.
By default, the number of consecutive comment chars determines the kind of comment and its behavior (e.g., with respect to indentation).
See the Elisp manual, node
I have so far discovered that spawning a new Emacs process is a solution.
Here is what I have done.
1. Add a function to start an external emacs process.
(defvar my/async-emacs-repl-org-babel-init-file "~/.emacs.d/org-babel-async-init" "File to load on executing async babel evaluation.")
(defun my/async-emacs-repl--start (process-name init-file)
For future references and out-of-box libraries. I will accept this one for the answer because these are more recent.
Here's a library using async.el
My other solution (available in melpa):
Unless some thing has changed with newer versions of MatLab, short answer is you cannot (MaTLaB 2011b here). Eric Ludlam, maintainer of matlab-emacs, does say so here in the matlab-emacs mailing list. MatLab lost an undocumented API which allowed it to show icons for breakpoints with select versions of GUD.
This issue is related to recent changes in org-mode (i.e. org 9.3). In the latest change log they mentioned that:
:file header argument no longer assume "file" :results
The "file" :results value is now mandatory for a code block returning a link to a file. The :file or :file-ext header arguments no longer imply a "file" result is expected.
So, one ...
Here's a version that seems to work (discovered by trial-and-error; and BTW it is using octave, since I don't have matlab):
#+begin_src octave :var a= :var b= :session
#+CALL: vectsb(a=[1 2 3],b=[3 2 1])
| 4 | 4 | 4 |
The org-babel section of the Org mode manual ...
The function org-babel-octave-evaluate-session is bugged. Fixed it with a rewrite. It should work correctly on Matlab input now. If anyone else has trouble with Matlab and org-babel interfacing in session mode, copy the following to a file and run (require 'ob-octave-fix.el nil t):
;; Session evaluation of MATLAB in org-babel is broken, this goes some
The package name is matlab-mode but the provided feature is matlab. Have a look at the very end of that source code file.
According to use-package Manual you have to get that right.
So your use-package declaration should look like this:
'("\\.m\\'" . matlab-mode))
Supposedly, this is a bug in MATLAB R2016b. A solution is to downgrade to R2016a!
I installed R2016b to find out that MATLAB crashes upon start up. What is strange however, is that I managed to run R2016b from Emacs once. My first thought was a bad configuration, but it kept crashing despite having cleared the config from ~/Library/Application\ Support/...
Start by installing el-get; then, juts el-get-install and select matlab-mode. Then, have a look to INSTALL and README. Here you'll find all you need. Don't forget to
At this point, you'll be able to launch the matlab shell as an inferior process, evaluate regions, lines, etc., and use mlint to check your code.
Note that you may ...
I don't use MATLAB, but this sounded like a problem I had when first starting to use emacs.
Did you originally try M-x compile to compile your code? That will run the shell command specified by the next input. The default is make, which is used for c programming. Here's the documentation: http://www.gnu.org/software/emacs/manual/html_node/emacs/Compilation....