diff options
Diffstat (limited to 'lispref/syntax.texi')
| -rw-r--r-- | lispref/syntax.texi | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/lispref/syntax.texi b/lispref/syntax.texi index a9df79e9f57..e8707709fe2 100644 --- a/lispref/syntax.texi +++ b/lispref/syntax.texi | |||
| @@ -256,7 +256,7 @@ English text has no comment characters. In Lisp, the semicolon | |||
| 256 | @deffn {Syntax class} @w{inherit} | 256 | @deffn {Syntax class} @w{inherit} |
| 257 | This syntax class does not specify a particular syntax. It says to look | 257 | This syntax class does not specify a particular syntax. It says to look |
| 258 | in the standard syntax table to find the syntax of this character. The | 258 | in the standard syntax table to find the syntax of this character. The |
| 259 | designator for this syntax code is @samp{@@}. | 259 | designator for this syntax class is @samp{@@}. |
| 260 | @end deffn | 260 | @end deffn |
| 261 | 261 | ||
| 262 | @deffn {Syntax class} @w{generic comment delimiter} | 262 | @deffn {Syntax class} @w{generic comment delimiter} |
| @@ -385,7 +385,7 @@ nestable. | |||
| 385 | @samp{p} identifies an additional ``prefix character'' for Lisp syntax. | 385 | @samp{p} identifies an additional ``prefix character'' for Lisp syntax. |
| 386 | These characters are treated as whitespace when they appear between | 386 | These characters are treated as whitespace when they appear between |
| 387 | expressions. When they appear within an expression, they are handled | 387 | expressions. When they appear within an expression, they are handled |
| 388 | according to their usual syntax codes. | 388 | according to their usual syntax classes. |
| 389 | 389 | ||
| 390 | The function @code{backward-prefix-chars} moves back over these | 390 | The function @code{backward-prefix-chars} moves back over these |
| 391 | characters, as well as over characters whose primary syntax class is | 391 | characters, as well as over characters whose primary syntax class is |
| @@ -566,7 +566,7 @@ have certain syntax classes. | |||
| 566 | 566 | ||
| 567 | @defun skip-syntax-forward syntaxes &optional limit | 567 | @defun skip-syntax-forward syntaxes &optional limit |
| 568 | This function moves point forward across characters having syntax | 568 | This function moves point forward across characters having syntax |
| 569 | classes mentioned in @var{syntaxes} (a string of syntax code | 569 | classes mentioned in @var{syntaxes} (a string of syntax class |
| 570 | characters). It stops when it encounters the end of the buffer, or | 570 | characters). It stops when it encounters the end of the buffer, or |
| 571 | position @var{limit} (if specified), or a character it is not supposed | 571 | position @var{limit} (if specified), or a character it is not supposed |
| 572 | to skip. | 572 | to skip. |
| @@ -730,6 +730,36 @@ This function is most often used to compute indentation for languages | |||
| 730 | that have nested parentheses. | 730 | that have nested parentheses. |
| 731 | @end defun | 731 | @end defun |
| 732 | 732 | ||
| 733 | @defun syntax-ppss &optional pos | ||
| 734 | This function returns the state that the parser would have at position | ||
| 735 | @var{pos}, if it were started with a default start state at the | ||
| 736 | beginning of the buffer. Thus, it is equivalent to | ||
| 737 | @code{(parse-partial-sexp (point-min) @var{pos})}, except that | ||
| 738 | @code{syntax-ppss} uses a cache to speed up the computation. Also, | ||
| 739 | the 2nd value (previous complete subexpression) and 6th value (minimum | ||
| 740 | parenthesis depth) of the returned state are not meaningful. | ||
| 741 | @end defun | ||
| 742 | |||
| 743 | @defun syntax-ppss-flush-cache beg | ||
| 744 | This function flushes the cache used by @code{syntax-ppss}, starting at | ||
| 745 | position @var{beg}. | ||
| 746 | |||
| 747 | When @code{syntax-ppss} is called, it automatically hooks itself | ||
| 748 | to @code{before-change-functions} to keep its cache consistent. | ||
| 749 | But this can fail if @code{syntax-ppss} is called while | ||
| 750 | @code{before-change-functions} is temporarily let-bound, or if the | ||
| 751 | buffer is modified without obeying the hook, such as when using | ||
| 752 | @code{inhibit-modification-hooks}. For this reason, it is sometimes | ||
| 753 | necessary to flush the cache manually. | ||
| 754 | @end defun | ||
| 755 | |||
| 756 | @defvar syntax-begin-function | ||
| 757 | If this is non-nil, it should be a function that moves to an earlier | ||
| 758 | buffer position where the parser state is equivalent to @code{nil}, | ||
| 759 | i.e., a position outside of any comment, string, or parenthesis. | ||
| 760 | @code{syntax-ppss} uses it to supplement its cache. | ||
| 761 | @end defvar | ||
| 762 | |||
| 733 | @defun scan-lists from count depth | 763 | @defun scan-lists from count depth |
| 734 | This function scans forward @var{count} balanced parenthetical groupings | 764 | This function scans forward @var{count} balanced parenthetical groupings |
| 735 | from position @var{from}. It returns the position where the scan stops. | 765 | from position @var{from}. It returns the position where the scan stops. |
| @@ -779,7 +809,7 @@ whitespace by the functions in this section and by @code{forward-sexp}. | |||
| 779 | @end defopt | 809 | @end defopt |
| 780 | 810 | ||
| 781 | @vindex parse-sexp-lookup-properties | 811 | @vindex parse-sexp-lookup-properties |
| 782 | The behaviour of @code{parse-partial-sexp} is also affected by | 812 | The behavior of @code{parse-partial-sexp} is also affected by |
| 783 | @code{parse-sexp-lookup-properties} (@pxref{Syntax Properties}). | 813 | @code{parse-sexp-lookup-properties} (@pxref{Syntax Properties}). |
| 784 | 814 | ||
| 785 | You can use @code{forward-comment} to move forward or backward over | 815 | You can use @code{forward-comment} to move forward or backward over |