[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14332: 24.3; Octave indentation bug
From: |
Leo Liu |
Subject: |
bug#14332: 24.3; Octave indentation bug |
Date: |
Mon, 06 May 2013 11:29:42 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) |
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
Description: oct_ind.m
- bug#14332: 24.3; Octave indentation bug, Leo Liu, 2013/05/02
- bug#14332: 24.3; Octave indentation bug, Stefan Monnier, 2013/05/05
- bug#14332: 24.3; Octave indentation bug, Leo Liu, 2013/05/05
- bug#14332: 24.3; Octave indentation bug, Stefan Monnier, 2013/05/05
- bug#14332: 24.3; Octave indentation bug, Leo Liu, 2013/05/05
- bug#14332: 24.3; Octave indentation bug, Stefan Monnier, 2013/05/05
- bug#14332: 24.3; Octave indentation bug,
Leo Liu <=
- bug#14332: 24.3; Octave indentation bug, Leo Liu, 2013/05/06
- bug#14332: 24.3; Octave indentation bug, Stefan Monnier, 2013/05/06
- bug#14332: 24.3; Octave indentation bug, Leo Liu, 2013/05/06
- bug#14332: 24.3; Octave indentation bug, Stefan Monnier, 2013/05/06
- bug#14332: 24.3; Octave indentation bug, Leo Liu, 2013/05/06