emacs-devel
[Top][All Lists]
Advanced

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

Re: generic buffer parsing cache data


From: Paul Pogonyshev
Subject: Re: generic buffer parsing cache data
Date: Sun, 1 Jul 2007 15:16:31 +0300
User-agent: KMail/1.7.2

martin rudalics wrote:
> > I propose that each point position could have "cached parsing data".
> > This would be an alist indexed with cache data identifier.
> 
> Have you experimented with `syntax-ppss'?

I propose to add something generic.  For instance, Python mode needs to
know indentation level of blocks.  It seems that `syntax-ppss` doesn't
return it at all.  And adding everything that might ever be needed by
some XYZ mode seems counter-productive and complicates an already complex
function and its return value.

I just mean that major modes can have needs beyond that suited by
`syntax-ppss`.  And as far as I can see, they can either parse half of
the buffer each time they need something, or invent some ad-hoc custom
code for caching such data.

As a side note, I was told somewhen that `parse-partial-sexp` is not
limited to Lisp syntax.  How about this amendment to documentation?

Paul


*** syntax.c    23 Jun 2007 12:18:14 +0300      1.206
--- syntax.c    01 Jul 2007 15:13:54 +0300      
***************
*** 3021,3028 ****
  }
  
  DEFUN ("parse-partial-sexp", Fparse_partial_sexp, Sparse_partial_sexp, 2, 6, 
0,
!        doc: /* Parse Lisp syntax starting at FROM until TO; return status of 
parse at TO.
! Parsing stops at TO or when certain criteria are met;
   point is set to where parsing stops.
  If fifth arg OLDSTATE is omitted or nil,
   parsing assumes that FROM is the beginning of a function.
--- 3021,3029 ----
  }
  
  DEFUN ("parse-partial-sexp", Fparse_partial_sexp, Sparse_partial_sexp, 2, 6, 
0,
!        doc: /* Parse syntax starting at FROM until TO; return status of parse 
at TO.
! Exact rules are determined by buffer's major mode.  Parsing stops at
! TO or when certain criteria are met;
   point is set to where parsing stops.
  If fifth arg OLDSTATE is omitted or nil,
   parsing assumes that FROM is the beginning of a function.




reply via email to

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