Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

modify-syntax-table?? (noweb.mode)

0 views
Skip to first unread message

Tom Clune

unread,
Mar 22, 1999, 3:00:00 AM3/22/99
to

I would like to modify the syntax table for a major
mode (primarily f90 if it matters) such that lines of the form

<< text >>

are treated as comments.

Actually, I can achieve the above, but not without also
causing expressions such as

if (i < 3) then

to have the last half of the line treated as a comment.
The cure is worse than the byte.

In case you're wondering why I desire such behavior, I'm
using literate programming for a number of my projects,
and would like to not have keywords such as "subroutine"
and "do" that appear in chunk names be incorrectly interpreted by
the major mode.

If a simple fix is not possible, I can accept that, but I strongly
suspect that 4 lines of the correct lisp code will fix it all up.

Thanks,

- Tom

-------------------------------------------------
Thomas Clune, Ph.D. Parallel Applications Analyst
Silicon Graphics, Inc. cl...@sgi.com
Code 931 NASA GSFC 301-286-4635 (work)
Greenbelt, MD 20771 301-286-1634 (fax)
-------------------------------------------------

Kai.Gro...@cs.uni-dortmund.de

unread,
Mar 22, 1999, 3:00:00 AM3/22/99
to
Tom Clune <cl...@zot.gsfc.nasa.gov> writes:

> I would like to modify the syntax table for a major
> mode (primarily f90 if it matters) such that lines of the form
>
> << text >>
>
> are treated as comments.

Isn't it sufficient to set comment-start and comment-end? Hm. Maybe
you'll lose the normal comments that way. Oh, well.

kai
--
I like _ b_ o_ t_ h kinds of music.

Dave Love

unread,
Mar 23, 1999, 3:00:00 AM3/23/99
to
>>>>> "TC" == Tom Clune <cl...@zot.gsfc.nasa.gov> writes:

TC> I would like to modify the syntax table for a major
TC> mode (primarily f90 if it matters) such that lines of the form

TC> << text >>

TC> are treated as comments.

Following `(elisp)Syntax Flags', you'd get this:

(modify-syntax-entry ?< "_ 12b" f90-mode-syntax-table)
(modify-syntax-entry ?> "_ 34b" f90-mode-syntax-table)

Does that not work for you?

Tom Clune

unread,
Mar 25, 1999, 3:00:00 AM3/25/99
to
Kai.Gro...@CS.Uni-Dortmund.DE writes:

> Tom Clune <cl...@zot.gsfc.nasa.gov> writes:
>
> > I would like to modify the syntax table for a major

> > mode (primarily f90 if it matters) such that lines of the form
> >

> > << text >>
> >
> > are treated as comments.
>
> Isn't it sufficient to set comment-start and comment-end? Hm. Maybe
> you'll lose the normal comments that way. Oh, well.

No, you'll still retain the normal comments, but you'll cause any
expression after a lone ">" to appear as a comment as well.

E.g.

If (a < 3) Then ! Text after "<" is treated (improperly) as a comment


I thought that two character comment-starts would solve the problem,
but apparently there is some difficulty in using the same character
for both the first and second start ...

Kai.Gro...@cs.uni-dortmund.de

unread,
Mar 25, 1999, 3:00:00 AM3/25/99
to
Tom Clune <cl...@zot.gsfc.nasa.gov> writes:

> I thought that two character comment-starts would solve the problem,
> but apparently there is some difficulty in using the same character
> for both the first and second start ...

I was trying to say that comment-start should be set to "<< " (or
maybe "<<").

What problems do you see with (setq comment-start "<<" comment-end
">>")?

Tom Clune

unread,
Mar 26, 1999, 3:00:00 AM3/26/99
to
Dave,

Thanks your solution works!

Dave Love <d.l...@dl.ac.uk> writes:
> Following `(elisp)Syntax Flags', you'd get this:
>
> (modify-syntax-entry ?< "_ 12b" f90-mode-syntax-table)
> (modify-syntax-entry ?> "_ 34b" f90-mode-syntax-table)
>
> Does that not work for you?

I had been trying:

(modify-syntax-entry ?< "< 12b" f90-mode-syntax-table)
(modify-syntax-entry ?> "> 34b" f90-mode-syntax-table)

since the function documentation says that "<" is for starting
comments and "_" is for symbol constituents ... Unfortunately,
this fails in a number of ways.

Thanks!

Dave Love

unread,
Mar 28, 1999, 3:00:00 AM3/28/99
to
>>>>> "KG" == Kai Grossjohann <Kai.Gro...@CS.Uni-Dortmund.DE> writes:

KG> I was trying to say that comment-start should be set to "<< " (or
KG> maybe "<<").

No, you'd want to keep the normal language `comment-start' in this
case. You still want C-; to use `!'.

Dave Love

unread,
Mar 28, 1999, 3:00:00 AM3/28/99
to
>>>>> "TC" == Tom Clune <cl...@zot.gsfc.nasa.gov> writes:

TC> I had been trying:

TC> (modify-syntax-entry ?< "< 12b" f90-mode-syntax-table)
TC> (modify-syntax-entry ?> "> 34b" f90-mode-syntax-table)

TC> since the function documentation says that "<" is for starting
TC> comments and "_" is for symbol constituents ...

The angles have `_' syntax when not part of the `alternative'
comments. If you find the manual confusing on the point, do make a
bug report about it.

0 new messages