bug-gnu-emacs
[Top][All Lists]
Advanced

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

%-Comments in Emacs Octave-Mode


From: John W. Eaton
Subject: %-Comments in Emacs Octave-Mode
Date: Fri, 24 Oct 2003 12:54:07 -0500

On 24-Oct-2003, Christoph Dalitz <christoph.dalitz@hs-niederrhein.de> wrote:

| just observed that the Emacs octave-mode does not recognize lines
| beginning wiht % as comment lines.
| 
| Does someone know how to teach emacs this additional comment sign?
| I guess I have to add some special octave-mode-hook, but what
| should this hook contain?

Please try the following patch.  The problem that the deleted comment
refers to has apparently been fixed, so indenting and font locking
both appear to work properly now for things like

  sprintf ("%s" "some string")

even when % is considered a comment character.

Thanks,

jwe


ChangeLog:

2003-10-24  John W. Eaton  <jwe@bevo.che.wisc.edu>

        * emacs/octave-mod.el (octave-mode-syntax-table): Allow % to be a
        comment character.


Index: emacs/octave-mod.el
===================================================================
RCS file: /usr/local/cvsroot/octave/emacs/octave-mod.el,v
retrieving revision 1.26
diff -u -r1.26 octave-mod.el
--- emacs/octave-mod.el 30 Jul 2003 19:15:31 -0000      1.26
+++ emacs/octave-mod.el 24 Oct 2003 17:47:09 -0000
@@ -292,15 +292,6 @@
        ["Lookup Octave Index"          octave-help t])
   "Menu for Octave mode.")
 
-;; XXX FIXME XXX -- the syntax mode for `%' is punctuation instead of
-;; begin-comment because if it is begin-comment, then typing M-;
-;; (octave-indent-for-comment) on lines like
-;;
-;;  sprintf ("%d", foobar);
-;;
-;; causes them to be improperly indented (the `%' is moved over to the
-;; comment-column).
-
 (defvar octave-mode-syntax-table nil
   "Syntax table in use in octave-mode buffers.")
 (if octave-mode-syntax-table
@@ -323,7 +314,7 @@
     (modify-syntax-entry ?\" "\"" table)
     (modify-syntax-entry ?. "w"   table)
     (modify-syntax-entry ?_ "w"   table)
-    (modify-syntax-entry ?\% "."  table) ; see above
+    (modify-syntax-entry ?\% "<"  table)
     (modify-syntax-entry ?\# "<"  table)
     (modify-syntax-entry ?\n ">"  table)
     (setq octave-mode-syntax-table table)))




reply via email to

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