jacktasia / dumb-jump

an Emacs "jump to definition" package for 50+ languages
GNU General Public License v3.0
1.57k stars 150 forks source link

Dumb-Jump for Octave/Matlab #325

Closed Nidish96 closed 4 years ago

Nidish96 commented 4 years ago

Thanks for the great package! I am currently in the process of migrating completely onto Octave. As you know, it's syntax is nearly identical to Matlab. However, Dumb-Jump seems to perform differently on matlab-mode and octave-mode. On Matlab-mode, it works like a charm. On octave-mode however, it can't even find the definition of a file in the same directory, leave alone other directories.

Any ideas what could be causing this/how i could fix it (by "merging" octave and matlab mode somehow)?

jacktasia commented 4 years ago

Thanks for the kind words.

Any ideas what could be causing this/how i could fix it (by "merging" octave and matlab mode somehow)?

Yes, .m is an overloaded extension with multiple languages using it, including obj-c, so to get around this, I derive the dumb-jump language from the emacs mode. The fix for this should be simple. Try putting this in a scratch buffer:

(defun dumb-jump-get-language-from-mode ()
  "Extract the language from the 'major-mode' name.  Currently just everything before '-mode'."
  (let* ((lookup '(sh "shell" cperl "perl" matlab "matlab" octave "matlab"))
        (m (dumb-jump-get-mode-base-name))
        (result (plist-get lookup (intern m))))
    result))

Then do C-x C-e on the last ) to override this function with the octave change. Then try jumping again from an octave-mode buffer.

Please let me know if this works for you. If it does, I'll commit the changes, so you and other octave users don't have to have a custom config for it.

Thanks!

Nidish96 commented 4 years ago

Thank you for the prompt response!

I just tried the fix and can confirm that dumb-jump works properly on Octave.

Thanks again for a very neat and usable package! :)

jacktasia commented 4 years ago

Awesome, thanks for confirming!