The parallel toolbox for MATLAB has a command, spmd
(https://se.mathworks.com/help/parallel-computing/spmd.html), that octave-mode does not recognize. Note: I know how to make octave-mode recognize it as a keyword.
The problem is that MATLAB expects spmd
to have a matching end
, which confuses octave-mode that sees an "extra" end
. In addition, the statements in between should be indented. E.g. like this:
parpool(3)
spmd
q = magic(labindex + 2);
end
How can I make octave-mode treat spmd
as per above?
The lisp snippet below makes octave-mode highlight spmd
as if it was a keyword:
(font-lock-add-keywords 'octave-mode
'(("\\<spmd\\>". font-lock-keyword-face)))
Update: Clarified intention of workaround snippet above.
Update 2: Using Stefan's workaround partially solves the issue. The end
is now matched to spmd
, although indentation is to large for some reason. See below for an example of the result, where the statements
while false
1; # The expected amount of indentation
end
spmd
1; # Twice the expected amount of indentation
end