1

I've been working with matlab-mode and matlab-shell for the last few days, and I'm really digging it so far. The only two things I can't get to work properly are completion - neither in shell, nor in .m files - and jumping to function definitions, and I would really appreciate some help with these. when I hit TAB in shell, my text turns into

>> emacsdocomplete('EEG.(cond')

and when I hit RETURN I get (the appropriate):

emacs_completions_output =
 java.lang.String[]:
   'cond'
   'condeig'

but it's not integrated into the shell properly, i.e. I can't choose which of the above I want, I have to re-type the command along with the chosen completion. In .m files I just get nothing except for the word completion for words already in the buffer - which I've configured myself.

I've read somewhere that the completion is meant to be related to CEDET somehow but I couldn't make out much more (I'm working on Doom Emacs, and I seen to have CEDET installed, and can run matlab-cedet-setup, which does nothing as far as I can tell).

As to function definitions - I don't even know where to start.. I've read that ctags now supports matlab, but I don't know where (if) the actual .m files for the built-in functions reside in the install dir.

Ideally I'd love to be able to stand on a function name and be able to get the "help funcName" output in another buffer or something (this works from the shell).

Thanks a lot!

2
  • I am experiencing something similar. For example AC of "norm" returns: Company: An error occurred in auto-begin Company: backend company-matlab-shell error "Internal error, ’emacsdocomplete('nor')’ returned unexpected output, ut = java.lang.String[]: 'norm' 'norm2' 'normalize' 'normalizeDFT2Coefficients' 'normalizeWords' 'norminv' 'normlms' 'normpdf' 'normplot' 'normprod' 'normr' 'normrank' 'normrnd' 'normspec' 'northarrow' " with args (prefix) user-error: Cannot complete at point Mark set
    – Ajned
    Commented Nov 18, 2020 at 14:44
  • Did you manage to find a solution to this? Thanks
    – Ajned
    Commented Oct 2, 2021 at 6:46

1 Answer 1

0

The problem is that the output is read-only in Doom Emacs. As a workaround use inhibit-read-only.

I did it like this:

(defadvice! inhibit-real-only-a (oldfun &rest r) 
 "Temporary remove read-only lines in shell buffer"
 :around#'matlab-shell-collect-command-output
  (let ((inhibit-read-only t)) (apply oldfun r)))
2
  • How does this work? Are we supposed to put it in out init file? If so it has not worked for me. I am using GNU emacs 27.1. Thanks
    – Ajned
    Commented Oct 2, 2021 at 6:32
  • @Ajned, it works only with Doom Emacs, where you have to add it to config.el
    – estownya
    Commented Jun 24, 2022 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.