From: Leo Liu <sdl.web@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 14332@debbugs.gnu.org
Subject: bug#14332: 24.3; Octave indentation bug
Date: Mon, 06 May 2013 11:29:42 +0800 [thread overview]
Message-ID: <m14neg4wgp.fsf@gmail.com> (raw)
In-Reply-To: <jwvzjw8kjjk.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 05 May 2013 21:04:14 -0400")
[-- Attachment #1: Type: text/plain, Size: 1611 bytes --]
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)
[-- Attachment #2: oct_ind.m --]
[-- Type: text/plain, Size: 83 bytes --]
## -*-Octave-*-
"abc\"abc"
if (true)
a = (1 \(2-3));
else
a = 0;
endif
next prev parent reply other threads:[~2013-05-06 3:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-02 4:04 bug#14332: 24.3; Octave indentation bug Leo Liu
2013-05-05 5:29 ` Stefan Monnier
2013-05-05 5:35 ` Leo Liu
2013-05-05 7:17 ` Stefan Monnier
2013-05-05 7:28 ` Leo Liu
2013-05-06 1:04 ` Stefan Monnier
2013-05-06 3:29 ` Leo Liu [this message]
2013-05-06 8:26 ` Leo Liu
2013-05-06 14:48 ` Stefan Monnier
2013-05-06 15:57 ` Leo Liu
2013-05-06 21:37 ` Stefan Monnier
2013-05-06 23:58 ` Leo Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m14neg4wgp.fsf@gmail.com \
--to=sdl.web@gmail.com \
--cc=14332@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).