* font-lock in rexx-mode
@ 2006-12-09 0:44 Bob Babcock
2006-12-09 2:16 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Bob Babcock @ 2006-12-09 0:44 UTC (permalink / raw)
I'm using rexx-mode.el from
http://www.sve.man.ac.uk/General/Staff/perrin/rexx.html
In rexx, I could say
foo = "\"
and the backslash is just a character in quotes. But with font-lock-mode
enabled, the backslash breaks recognition of the end of the string and
syntax coloring breaks. Is there a way to turn off the special meaning of
backslash when in rexx mode?
If it matters, I'm using Emacs 21.3.1 under Windows.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: font-lock in rexx-mode
2006-12-09 0:44 font-lock in rexx-mode Bob Babcock
@ 2006-12-09 2:16 ` Stefan Monnier
2006-12-09 7:04 ` Bob Babcock
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2006-12-09 2:16 UTC (permalink / raw)
> I'm using rexx-mode.el from
> http://www.sve.man.ac.uk/General/Staff/perrin/rexx.html
> In rexx, I could say
> foo = "\"
> and the backslash is just a character in quotes. But with font-lock-mode
> enabled, the backslash breaks recognition of the end of the string and
> syntax coloring breaks. Is there a way to turn off the special meaning of
> backslash when in rexx mode?
Of course: each mode sets up its own `syntax-table' where the meaning of
each char is described. So if in Rexx a \ should not escape the next char,
the syntax-table should be changed.
Currently rexx-mode.el does:
(modify-syntax-entry ?\\ "\\" rexx-mode-syntax-table)
which as that \ should be treated as an escape char. So either this line is
in error, or the \ should sometimes be treated as an escape char and
sometimes not. I don't know anything about the syntax of Rexx, so I have no
idea when \ escapes and when it doesn't. E.g. how do you escape a " inside
a string in Rexx?
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: font-lock in rexx-mode
2006-12-09 2:16 ` Stefan Monnier
@ 2006-12-09 7:04 ` Bob Babcock
2006-12-09 14:11 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Bob Babcock @ 2006-12-09 7:04 UTC (permalink / raw)
Stefan Monnier <monnier@iro.umontreal.ca> wrote in
news:jwv8xhhg6m1.fsf-monnier+gnu.emacs.help@gnu.org:
> So if in Rexx a \ should not escape the
> next char, the syntax-table should be changed.
> Currently rexx-mode.el does:
>
> (modify-syntax-entry ?\\ "\\" rexx-mode-syntax-table)
>
> which as that \ should be treated as an escape char. So either this
> line is in error, or the \ should sometimes be treated as an escape
> char and sometimes not. I don't know anything about the syntax of
> Rexx, so I have no idea when \ escapes and when it doesn't. E.g. how
> do you escape a " inside a string in Rexx?
Thanks for the response. I don't understand why, but commenting out the
above line and restarting emacs doesn't change the behavior. (I do not
have a rexx-mode.elc. If I start emacs with --no-init-file, rexx-mode is
not recognized.)
Backslash is never an escape in Rexx. Rexx allows either single or double
quotes to delimit a string, so '"' would be a double quote. A string
containing both kinds of quote could be built by concatenation.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: font-lock in rexx-mode
2006-12-09 7:04 ` Bob Babcock
@ 2006-12-09 14:11 ` Stefan Monnier
2006-12-09 14:30 ` Stefan Monnier
2006-12-09 18:51 ` Bob Babcock
0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2006-12-09 14:11 UTC (permalink / raw)
>> So if in Rexx a \ should not escape the
>> next char, the syntax-table should be changed.
>> Currently rexx-mode.el does:
>>
>> (modify-syntax-entry ?\\ "\\" rexx-mode-syntax-table)
>>
>> which as that \ should be treated as an escape char. So either this
>> line is in error, or the \ should sometimes be treated as an escape
>> char and sometimes not. I don't know anything about the syntax of
>> Rexx, so I have no idea when \ escapes and when it doesn't. E.g. how
>> do you escape a " inside a string in Rexx?
> Thanks for the response. I don't understand why, but commenting out the
> above line and restarting emacs doesn't change the behavior. (I do not
> have a rexx-mode.elc. If I start emacs with --no-init-file, rexx-mode is
> not recognized.)
It's normal: this line is superfluous since it just repeats the default
setting of \. Instead of removing it, you want to replace it with another
line such as
(modify-syntax-entry ?\\ "." rexx-mode-syntax-table)
where the "." means "punctuation". See C-h f modify-syntax-entry RET
for a bit more documentation.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: font-lock in rexx-mode
2006-12-09 14:11 ` Stefan Monnier
@ 2006-12-09 14:30 ` Stefan Monnier
2006-12-09 18:51 ` Bob Babcock
1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2006-12-09 14:30 UTC (permalink / raw)
> It's normal: this line is superfluous since it just repeats the default
> setting of \. Instead of removing it, you want to replace it with another
> line such as
> (modify-syntax-entry ?\\ "." rexx-mode-syntax-table)
> where the "." means "punctuation". See C-h f modify-syntax-entry RET
> for a bit more documentation.
Oh and if it's really a bug in rexx-mode, as you seem to imply, then please
send it to the maintainer and/or post it somewhere for others to use (the
maintainer seem to have quit his job, so maybe you want to distribute your
own version, virtually improvising yourself maintainer).
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: font-lock in rexx-mode
2006-12-09 14:11 ` Stefan Monnier
2006-12-09 14:30 ` Stefan Monnier
@ 2006-12-09 18:51 ` Bob Babcock
1 sibling, 0 replies; 6+ messages in thread
From: Bob Babcock @ 2006-12-09 18:51 UTC (permalink / raw)
Stefan Monnier <monnier@iro.umontreal.ca> wrote in
news:jwv4ps5dutz.fsf-monnier+gnu.emacs.help@gnu.org:
> It's normal: this line is superfluous since it just repeats the
> default setting of \. Instead of removing it, you want to replace it
> with another line such as
>
> (modify-syntax-entry ?\\ "." rexx-mode-syntax-table)
I thought I had tried this last night and it didn't work, but today it
works. It was late and I was tired... Thanks.
I will send an email about this to the (retired) rexx-mode maintainer.
Perhaps he will consider making this small change. If not, I'll try to put
the revised version on a web page so search engines can find it.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-12-09 18:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-09 0:44 font-lock in rexx-mode Bob Babcock
2006-12-09 2:16 ` Stefan Monnier
2006-12-09 7:04 ` Bob Babcock
2006-12-09 14:11 ` Stefan Monnier
2006-12-09 14:30 ` Stefan Monnier
2006-12-09 18:51 ` Bob Babcock
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).