help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Emacs Octave mode


From: John W. Eaton
Subject: Emacs Octave mode
Date: Wed, 12 May 1999 02:02:41 -0500 (CDT)

On 11-May-1999, Daniel Friedman <address@hidden> wrote:

| I would like to know how to change two things in the Emacs Octave mode.
| I posted a question to comp.emacs but have received no
| response--perhaps my questions are a bit esoteric for that
| newsgroup--hence I turn here.
| 
| I'm running Emacs version 20.3.1., and I'd like to achieve some small
| customizations by changing my .emacs, not by changing system-wide files.
|                
| 1) In octave-mode, the hash mark (#) is used to start a comment.  I want
| to change this to the percent symbol (%), yet still have the indentation
| and fontification work asbefore.  I tried putting
|     (setq octave-mode hook
|         '( lambda () (setq octave-comment-char ?%) ))
| in my .emacs but this didn't do the trick.

I think you also need to change the syntax type for this character:

  (modify-syntax-entry ?\% "<"  octave-mode-syntax-table)

| 2) How can I change the indentation so that, for example, "endif" is
| indented the same amount as "if"?  Yet, not cause all functions to be
| indented ?

Not exactly sure what you mean by that, but if it is to set make a
function look like this:

  function
  if (foo)
    for i = 1:n
      bar;
    endfor
  else
    baz;
  endif
  endfunction

then I think the following should work:

 (delete "function" octave-begin-keywords)
 (setq octave-block-begin-regexp
  (concat "\\<\\("
   (mapconcat 'identity octave-begin-keywords "\\|")
   "\\)\\>"))

 (delete "endfunction" octave-end-keywords)
 (setq octave-block-end-regexp
  (concat "\\<\\("
   (mapconcat 'identity octave-end-keywords "\\|")
   "\\)\\>"))

even though it is a bit ugly.

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]