GNU bug report logs - #14332
24.3; Octave indentation bug

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Thu, 2 May 2013 04:06:02 UTC

Severity: normal

Found in version 24.3

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 14332 <at> debbugs.gnu.org
Subject: bug#14332: 24.3; Octave indentation bug
Date: Mon, 06 May 2013 11:29:42 +0800
[Message part 1 (text/plain, inline)]
On 2013-05-06 09:04 +0800, Stefan Monnier wrote:
> Then your best bet is probably to put in the mode's syntax-table the
> syntax corresponding to the most common use of \ (either as an escape
> char in strings or as an operator), and then use syntax-propertize to
> put the other syntax on the other case (where you can check (nth
> 3 (syntax-ppss (math-beginning 0))) to see if you're within a string).

What I would like is to have \ mean "." unless it is in double-quoted
strings where it should be "\\". I have the following non-working patch.
Ideas?

diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 2e848600..d5a1af2b 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -137,6 +137,8 @@ (defun octave-syntax-propertize-function (start end)
   (goto-char start)
   (octave-syntax-propertize-sqs end)
   (funcall (syntax-propertize-rules
+            ("\\\\" (0 (when (eq (nth 3 (syntax-ppss (match-beginning 0))) ?\")
+                         "\\")))
             ;; Try to distinguish the string-quotes from the transpose-quotes.
             ("\\(?:^\\|[[({,; ]\\)\\('\\)"
              (1 (prog1 "\"'" (octave-syntax-propertize-sqs end)))))
@@ -242,7 +244,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)

[oct_ind.m (text/plain, attachment)]

This bug report was last modified 12 years and 14 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.