all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* syntax parsing of non-contiguous regions
@ 2009-09-19 20:14 Alexander Katovsky
  2009-09-20 19:53 ` Andreas Politz
  2009-09-20 20:21 ` Andreas Röhler
  0 siblings, 2 replies; 8+ messages in thread
From: Alexander Katovsky @ 2009-09-19 20:14 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I want Emacs' syntax motion functions to ignore certain regions of the 
buffer; i.e. to correctly parse non-contiguous regions. This can be done 
effectively if you can define the region to ignore as a comment and set 
parse-sexp-ignore-comments variable to true.

Here's the problem. The primary mode has comments starting with '!' and 
ending with newline ('\n') and the buffer region I want ignored as a 
comment starts with "%{" and ends with "}%". However, I cannot see any 
way to define these both as comments. The mechanism to cope with 
multi-character comment delimiters in the syntax table is too specific 
to C to use here. Does anyone have any other suggestions, 
text-properties, for example?

Thanks,
Alex






^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: syntax parsing of non-contiguous regions
@ 2009-09-21 22:18 Alexander Katovsky
  2009-09-22  5:42 ` Andreas Röhler
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Katovsky @ 2009-09-21 22:18 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs

I'm afraid I'm being a little slow understanding you're suggestion.  
I've already defined comment-start and comment-end as '!' and '\n' 
respectively.  Also, I need all the syntax motion functions 
(forward-sexp, parse-partial-sexp et al) to treat the embedded code as a 
comment so that the embedded code does not disrupt syntax motion 
outside.  For example, suppose that my primary mode is for code 
consisting of named blocks with comments starting with '!' and ending 
with newline, and my embedded code is C.  Then we could have

named-block  ! some comment
{
    %{
        if(a != b){}
    }%
}

Then the syntax motion functions would completely ignore the embedded 
code, just as it would a comment.  So if point is before the first 
opening brace then, no matter what's inside %{}%, forward-sexp would 
place point at the last closing brace.  And all the other syntax 
functions would just 'work' as well!

I'd be very grateful if could explain in a little more detail exactly 
what the 'hide-or-ignore' functions that you suggest are and how they 
could be used to achieve this effect.

Thanks,
Alex







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

end of thread, other threads:[~2009-09-22  5:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-19 20:14 syntax parsing of non-contiguous regions Alexander Katovsky
2009-09-20 19:53 ` Andreas Politz
2009-09-20 20:21 ` Andreas Röhler
2009-09-21 19:28   ` Alexander Katovsky
2009-09-21 20:13     ` Andreas Röhler
2009-09-21 21:55     ` Lennart Borgman
  -- strict thread matches above, loose matches on Subject: below --
2009-09-21 22:18 Alexander Katovsky
2009-09-22  5:42 ` Andreas Röhler

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.