Fri 17 Sep 2010 08:04:08 PM UTC, original submission:
emacs does not recognize the "end" keyword as a block delimiter in octave-mode. Upon inspecting the file octave-mod.el, I see the following line before the variable "octave-end-keywords":
";; FIXME: only use specific "end" tokens here to avoid confusion when "end"
;; is used in indexing (the real fix is much more complex)."
I could not ascertain what the fix was, but I tried manually appending the "end" keyword in the "octave-end-keywords" list as well as the "octave-block-match-alist" environment, and I could not get the "end" keyword to be recognized. I did not understand why this was so because upon doing a find for "endif" on the file, one sees that "endif" occurs exactly thrice - once for a short-cut, and once each in the above-mentioned environments, and putting the "end" keyword on the same footing as "endif" would be naively expected to work (also "endwhile" and "endfor"). I have the following in the my .emacs file:
;; octave bindings
(autoload 'octave-mode "octave-mod" nil t)
(setq auto-mode-alist
(cons '("\\.m$" . octave-mode) auto-mode-alist))
(add-hook 'octave-mode-hook
(lambda ()
(abbrev-mode 1)
(auto-fill-mode 1)
(if (eq window-system 'x)
(font-lock-mode 1))))
(defun RET-behaves-as-LFD ()
(let ((x (key-binding "\C-j")))
(local-set-key "\C-m" x)))
(add-hook 'octave-mode-hook 'RET-behaves-as-LFD)
(setq octave-auto-indent t)
Specifically, I want the "end" keyword to indent properly because I have to write matlab-compatible code - the University server I submit jobs on has matlab installed on it and the sysadmin is reluctant to install octave there.
I have noticed an older version of octave-mod.el on the website:
opensource.apple.com/source/emacs/emacs-41/emacs/lisp/progmodes/octave-mod.el
which I am also attaching here, in which the "end" keyword is explicitly present in the octave-end-keywords list. Substituting this file for mine own, however, did not work for me.
|