Subject: bug#6834: octave-mode block comments need highlighting

From: Stefan Monnier <[email-masked]>
Date: Thu, 12 Aug 2010 11:48:32 +0200

> In octave mode, block comments (separated by "%{" and "%}") should be
> highlighted in the same font as regular line comments.

The patch below should morally fix it, but as the comment explains, it
won't work until we fix the underlying C code.

        Stefan

=== modified file 'lisp/progmodes/octave-mod.el'
--- lisp/progmodes/octave-mod.el	2010-05-20 15:12:20 +0000
+++ lisp/progmodes/octave-mod.el	2010-08-12 09:46:20 +0000
@@ -298,8 +295,16 @@
     (modify-syntax-entry ?\" "\"" table)
     (modify-syntax-entry ?. "w"   table)
     (modify-syntax-entry ?_ "w"   table)
-    (modify-syntax-entry ?\% "<"  table)
-    (modify-syntax-entry ?\# "<"  table)
+    ;; FIXME: The < property of # and % makes Emacs ignore any subsequent char
+    ;; including {, so it never gets to see the multi-line comments.
+    ;; This is a shortcoming in syntax.c.  In Twelf-mode (which also
+    ;; suffers from this problem) we work around the issue by setting
+    ;; "% " rather than just "%" as a comment-starter, but it seems
+    ;; this wouldn't cut it for Octave.
+    (modify-syntax-entry ?\% "< 13"  table)
+    (modify-syntax-entry ?\# "< 13"  table)
+    (modify-syntax-entry ?\{ "(} 2b"  table)
+    (modify-syntax-entry ?\} "){ 4"  table)
     (modify-syntax-entry ?\n ">"  table)
     table)
   "Syntax table in use in `octave-mode' buffers.")