Subject: bug#14332: 24.3; Octave indentation bug

From: Leo Liu <[email-masked]>
Date: Mon, 06 May 2013 16:26:13 +0800

On 2013-05-06 11:29 +0800, Leo Liu wrote:
> What I would like is to have \ mean "." unless it is in double-quoted
> strings where it should be "\\".

This patch seems working. This is the first time I am using the
syntax-table property. Stefan, do you see any problem with the patch?

diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 2e848600..66fda302 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -134,6 +134,12 @@ (defvar octave-font-lock-keywords
   "Additional Octave expressions to highlight.")
 
 (defun octave-syntax-propertize-function (start end)
+  (funcall (syntax-propertize-rules
+            ("\\\\" (0 (when (eq (nth 3 (save-excursion
+                                          (syntax-ppss (match-beginning 0))))
+                                 ?\")
+                         (string-to-syntax "\\")))))
+           start end)
   (goto-char start)
   (octave-syntax-propertize-sqs end)
   (funcall (syntax-propertize-rules
@@ -242,7 +248,7 @@ (defvar octave-mode-syntax-table
     (modify-syntax-entry ?& "."   table)
     (modify-syntax-entry ?| "."   table)
     (modify-syntax-entry ?! "."   table)
-    (modify-syntax-entry ?\\ "\\" table)
+    (modify-syntax-entry ?\\ "."  table)
     (modify-syntax-entry ?\' "."  table)
     ;; Was "w" for abbrevs, but now that it's not necessary any more,
     (modify-syntax-entry ?\` "."  table)