help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

changing string delimiter character to be matching curly brackets


From: stuart
Subject: changing string delimiter character to be matching curly brackets
Date: Wed, 12 Sep 2007 14:31:10 -0700
User-agent: G2/1.0

I am creating a custom mode and I want to make curly brackets an
alternative way of delimiting string, so that a string 'foo' bould be
either {foo} or "foo". I am able to override the comment and escape
chars, as follows:

;; Change the interpretation of particular chars in Emacs' syntax
table
(defvar fst-mode-syntax-table
  (let ((fst-mode-syntax-table (make-syntax-table)))
    (modify-syntax-entry  ?#   "<"  fst-mode-syntax-table)  ; start
comment
    (modify-syntax-entry  ?\n  ">"  fst-mode-syntax-table)  ; end
comment
    (modify-syntax-entry  ?\\  "_"  fst-mode-syntax-table)  ; don't
escape quote
    (modify-syntax-entry  ?%   "/"  fst-mode-syntax-table)  ;
functions as escape char
    fst-mode-syntax-table)
  "Syntax table for fst-mode")

But if I add in these lines, it doesn't do what I hoped it would:

    (modify-syntax-entry  ?{   '"'  fst-mode-syntax-table)  ; start
string
    (modify-syntax-entry  ?}   '"'  fst-mode-syntax-table)  ; end
string

Either the syntax is wrong or the strategy is. (I'm guessing the
latter.)

Any suggestions? (Please include the obfuscated email below in your
reply since I don't regularly check this list. Thanks.

s t u a r t | AT | z a p a t a | DOT | o r g



reply via email to

[Prev in Thread] Current Thread [Next in Thread]