0

I'm using octave mode for matlab which works great mostly. However, now I've run into a difference in quoting mechanisms between matlab and octave which makes emacs misinterpret the code and mess up indentation. I'm searching for the first left parenthesis in a string:

startind=find(s=='(',1);

The characters in between the single quotes are not escaped, which makes emacs expect a closing right parenthesis. The right parenthesis doesn't show up and the indentation and syntax highlighting of the rest of the file is off. I tried adding:

(add-hook 'octave-mode-hook
(lambda () (modify-syntax-entry ?\' "\"")))

but it makes no difference. I also checked the syntax class of single quote after reloading my init file by evaluating the line below with C-x C-e:

(char-to-string (char-syntax ?\'))

which returns:

"."

And I also checked the syntax class of double quote:

(char-to-string (char-syntax ?\"))

which returns:

"\""

What am I missing here? I'm a copy-paster when it comes to elisp and would be grateful for help.

NickD
  • 27,023
  • 3
  • 23
  • 42

0 Answers0