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

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

Re: changing string delimiter character to be matching curly brackets


From: Kevin Rodgers
Subject: Re: changing string delimiter character to be matching curly brackets
Date: Thu, 13 Sep 2007 21:05:29 -0600
User-agent: Thunderbird 1.5.0.13 (Macintosh/20070809)

stuart wrote:
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.)

The syntax is wrong: '"' should be "\""

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

Too bad.

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

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

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