unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* outrageous comment syntax
@ 2005-10-27  4:21 Ian Zimmerman
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Zimmerman @ 2005-10-27  4:21 UTC (permalink / raw)



comment-start-skip's value is 
"\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *"
Local in buffer simple-haskell.el; global value is nil

Documentation:
*Regexp to match the start of a comment plus everything up to its body.
If there are any \(...\) pairs, the comment delimiter text is held to begin
at the place matched by the close of the first pair.


However, I have a language with two comment syntaxes, one of which
depends on leading context and the other doesn't.  How in the world can
I set this variable properly?  The context must be within the first
group, and it cannot be :-(

You can actually guess the language, it's not completely obscure.
Prize: a virtual wine.

-- 
"It's not true or not."  A reality show producer (real quote)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: outrageous comment syntax
       [not found] <mailman.12863.1130387573.20277.help-gnu-emacs@gnu.org>
@ 2005-11-01  4:29 ` Stefan Monnier
  2005-11-01 23:36 ` rgb
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2005-11-01  4:29 UTC (permalink / raw)


> comment-start-skip's value is 
> "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *"
> Local in buffer simple-haskell.el; global value is nil

> Documentation:
> *Regexp to match the start of a comment plus everything up to its body.
> If there are any \(...\) pairs, the comment delimiter text is held to begin
> at the place matched by the close of the first pair.

> However, I have a language with two comment syntaxes, one of which
> depends on leading context and the other doesn't.  How in the world can
> I set this variable properly?  The context must be within the first
> group, and it cannot be :-(

I guess you can't.  Unless of course some concrete detail makes it possible,
but since you haven't provided any...

If you indeed can't, report it with M-x report-emacs-bug, of course,


        Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: outrageous comment syntax
       [not found] <mailman.12863.1130387573.20277.help-gnu-emacs@gnu.org>
  2005-11-01  4:29 ` outrageous comment syntax Stefan Monnier
@ 2005-11-01 23:36 ` rgb
  2005-11-03  3:50   ` Ian Zimmerman
  2005-11-03 16:07   ` Stefan Monnier
  1 sibling, 2 replies; 5+ messages in thread
From: rgb @ 2005-11-01 23:36 UTC (permalink / raw)


Ian Zimmerman wrote:
> comment-start-skip's value is
> "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *"
> Local in buffer simple-haskell.el; global value is nil
>
> Documentation:
> *Regexp to match the start of a comment plus everything up to its body.
> If there are any \(...\) pairs, the comment delimiter text is held to begin
> at the place matched by the close of the first pair.
>
>
> However, I have a language with two comment syntaxes, one of which
> depends on leading context and the other doesn't.  How in the world can
> I set this variable properly?  The context must be within the first
> group, and it cannot be :-(

When you san "cannot be" I assume you mean that use of shy groups
(?: ...) is insufficient to your needs?

I suggested a generalized fix for problems such as this a couple
months ago.  I'm not sure how to tell if it was dismissed, or if it's
in some state of analysis or even implementation.

Basically it involved a seemingly simple change to regexp primatives
to accept symbols as well as strings.  Accepting a symbol was a
compromise to my original suggestion of allowing functions to be
passed which apparently introduces problems.

The idea is to make regexp handling work more like font-lock.  With
font-lock routines, anywhere a regexp is legal you can pass a function
which is expected to behave like re-search...  When I say `behave
like' I mean in the way it leaves point, returns t or nil depending on
success and setting of match-data.

This would give everyone with problems such as this the ability to
simply code a custom solution without having to hack up an otherwise
useful package that simply needs search results to do it's job.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: outrageous comment syntax
  2005-11-01 23:36 ` rgb
@ 2005-11-03  3:50   ` Ian Zimmerman
  2005-11-03 16:07   ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Ian Zimmerman @ 2005-11-03  3:50 UTC (permalink / raw)


rgb wrote:
> Ian Zimmerman wrote:
> 
>>comment-start-skip's value is
>>"\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *"
>>Local in buffer simple-haskell.el; global value is nil
>>
>>Documentation:
>>*Regexp to match the start of a comment plus everything up to its body.
>>If there are any \(...\) pairs, the comment delimiter text is held to begin
>>at the place matched by the close of the first pair.
>>
>>
>>However, I have a language with two comment syntaxes, one of which
>>depends on leading context and the other doesn't.  How in the world can
>>I set this variable properly?  The context must be within the first
>>group, and it cannot be :-(
> 
> 
> When you san "cannot be" I assume you mean that use of shy groups
> (?: ...) is insufficient to your needs?
> 

I didn't know Emacs had them.  Thanks for pointing them out to me.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: outrageous comment syntax
  2005-11-01 23:36 ` rgb
  2005-11-03  3:50   ` Ian Zimmerman
@ 2005-11-03 16:07   ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2005-11-03 16:07 UTC (permalink / raw)


>> comment-start-skip's value is
>> "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *"
>> Local in buffer simple-haskell.el; global value is nil
>> 
>> Documentation:
>> *Regexp to match the start of a comment plus everything up to its body.
>> If there are any \(...\) pairs, the comment delimiter text is held to begin
>> at the place matched by the close of the first pair.
>> 
>> 
>> However, I have a language with two comment syntaxes, one of which
>> depends on leading context and the other doesn't.  How in the world can
>> I set this variable properly?  The context must be within the first
>> group, and it cannot be :-(

Since you haven't provided any hard data, I'll give you a sample solution to
another problem:

   (set (make-local-variable 'comment-start-skip)
        "#+[ \t]*\\|\\(uglyprefix +\\)--+[ \t]*")

Now maybe you problem can't be solved in the same way, of course.
The group-1 convention doesn't cover all cases.


        Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-11-03 16:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.12863.1130387573.20277.help-gnu-emacs@gnu.org>
2005-11-01  4:29 ` outrageous comment syntax Stefan Monnier
2005-11-01 23:36 ` rgb
2005-11-03  3:50   ` Ian Zimmerman
2005-11-03 16:07   ` Stefan Monnier
2005-10-27  4:21 Ian Zimmerman

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).