Subject: 23.2; emacs does not recognize the "end" keyword as a block-delimiter in octave-mode

From: Manjul Apratim <[email-masked]>
Date: Fri, 17 Sep 2010 17:31:33 -0400

Message-ID:
<[email-masked]>
--text follows this line--

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 still 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 can obtain matlab from my University for free, but I
refuse to do so and I would rather continue to work in
octave. Similarly, I would rather not use 'matlab-mode' and stick to
'octave-mode' instead.

I have come across certain previous versions of
octave-mod.el, and they seem to contain the "end" keyword alongwith the
other octave-end-keywords. I tried to replace my original octave-mod.el
file with one of those old files - specifically, one at (disdainfully on
an apple site, but no immediate alternatives were available):
opensource.apple.com/source/emacs/emacs-41/emacs/lisp/progmodes/octave-mod.el
but that did not help either, and though all the other keywords still
behaved the same, the "end" keyword was still not recognized.

I also apologize for not sending the email directly from emacs, since I did
not have my smtp settings
configured at this time.

Sincerely,

Manjul Apratim

In GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2010-09-01 on rutherfordium, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10706000
configured using `configure  '--build=i486-linux-gnu'
'--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
'--libexecdir=/usr/lib' '--localstatedir=/var/lib'
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim'
'--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g
-O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Octave

Minor modes in effect:
  show-paren-mode: t
  cua-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
<next> <next> <next> <next> <next> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<next> <next> <prior> <prior> <prior> <prior> <prior>
<prior> <help-echo> <down-mouse-1> x <mouse-1> <down-mouse-1>
<mouse-movement> x <drag-mouse-1> <down-mouse-1> x
<mouse-1> <down-mouse-1> <mouse-1> <double-down-mouse-1>
x <double-mouse-1> <down-mouse-1> x <mouse-1> <down-mouse-1>
<mouse-1> C-x M-x <down-mouse-1> <mouse-1> <down-mouse-1>
<mouse-1> M-x <help-echo> r e p o r t - e m a c s -
b u g <return>

Recent messages:
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el
(source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el
(source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50octave3.2-emacsen.el (source)...done
Loading cua-base...done
Loading paren...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set

Load-path shadows:
/usr/share/emacs/23.2/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides
/usr/share/emacs/23.2/lisp/textmodes/flyspell
/usr/share/emacs23/site-lisp/dictionaries-common/ispell hides
/usr/share/emacs/23.2/lisp/textmodes/ispell
/usr/share/emacs/23.2/site-lisp/octave3.2-emacsen/octave-inf hides
/usr/share/emacs/23.2/lisp/progmodes/octave-inf
/usr/share/emacs/23.2/site-lisp/octave3.2-emacsen/octave-mod hides
/usr/share/emacs/23.2/lisp/progmodes/octave-mod

Features:
(shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock
sha1 hex-util hashcash mail-utils emacsbug easymenu octave-mod paren
cua-base cus-start cus-load tooltip ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd font-setting tool-bar dnd fontset image fringe
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev loaddefs button minibuffer faces cus-face files text-properties
overlay md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)