diff options
| author | Chong Yidong | 2012-02-17 22:01:05 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-02-17 22:01:05 +0800 |
| commit | 7b926f3f3db5d9a22260209547fb3e60df919ecf (patch) | |
| tree | 7728b5c424cb28deb71a90afe24b9eaa89320a5c | |
| parent | ee0ce425dbd94d9b15c1442f9699a47b7feeaf90 (diff) | |
| download | emacs-7b926f3f3db5d9a22260209547fb3e60df919ecf.tar.gz emacs-7b926f3f3db5d9a22260209547fb3e60df919ecf.zip | |
Clarify doc of scan-lists.
* doc/lispref/syntax.texi (Motion via Parsing): Doc fix for scan-lists.
* src/syntax.c (Fscan_lists): Doc fix.
Fixes: debbugs:10833
| -rw-r--r-- | doc/lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/lispref/syntax.texi | 30 | ||||
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/syntax.c | 21 |
4 files changed, 36 insertions, 23 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index ab01544c453..85e78abdc32 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-02-17 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * syntax.texi (Motion via Parsing): Doc fix for scan-lists. | ||
| 4 | |||
| 1 | 2012-02-17 Glenn Morris <rgm@gnu.org> | 5 | 2012-02-17 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * hooks.texi (Standard Hooks): Fix cross-ref to Emacs manual. | 7 | * hooks.texi (Standard Hooks): Fix cross-ref to Emacs manual. |
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index dbfa4ca9045..e2fb3238642 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi | |||
| @@ -646,25 +646,25 @@ result, Emacs treats them as four consecutive empty string constants. | |||
| 646 | based on parsing expressions. | 646 | based on parsing expressions. |
| 647 | 647 | ||
| 648 | @defun scan-lists from count depth | 648 | @defun scan-lists from count depth |
| 649 | This function scans forward @var{count} balanced parenthetical groupings | 649 | This function scans forward @var{count} balanced parenthetical |
| 650 | from position @var{from}. It returns the position where the scan stops. | 650 | groupings from position @var{from}. It returns the position where the |
| 651 | If @var{count} is negative, the scan moves backwards. | 651 | scan stops. If @var{count} is negative, the scan moves backwards. |
| 652 | 652 | ||
| 653 | If @var{depth} is nonzero, assume that the starting point is already | 653 | If @var{depth} is nonzero, treat the starting position as being |
| 654 | @var{depth} parentheses deep. This function counts out @var{count} | 654 | @var{depth} parentheses deep. The scanner moves forward or backward |
| 655 | number of points where the parenthesis depth goes back to zero, then | 655 | through the buffer until the depth changes to zero @var{count} times. |
| 656 | stops. Thus, a positive value for @var{depth} has the effect of | 656 | Hence, a positive value for @var{depth} has the effect of moving out |
| 657 | moving out @var{depth} levels of parenthesis, whereas a negative | 657 | @var{depth} levels of parenthesis from the starting position, while a |
| 658 | @var{depth} has the effect of moving deeper by @var{-depth} levels of | 658 | negative @var{depth} has the effect of moving deeper by @var{-depth} |
| 659 | parenthesis. | 659 | levels of parenthesis. |
| 660 | 660 | ||
| 661 | Scanning ignores comments if @code{parse-sexp-ignore-comments} is | 661 | Scanning ignores comments if @code{parse-sexp-ignore-comments} is |
| 662 | non-@code{nil}. | 662 | non-@code{nil}. |
| 663 | 663 | ||
| 664 | If the scan reaches the beginning or end of the buffer (or its | 664 | If the scan reaches the beginning or end of the accessible part of the |
| 665 | accessible portion), and the depth is not zero, an error is signaled. | 665 | buffer before it has scanned over @var{count} parenthetical groupings, |
| 666 | If the depth is zero but the count is not used up, @code{nil} is | 666 | the return value is @code{nil} if the depth at that point is zero; if |
| 667 | returned. | 667 | the depth is non-zero, a @code{scan-error} error is signaled. |
| 668 | @end defun | 668 | @end defun |
| 669 | 669 | ||
| 670 | @defun scan-sexps from count | 670 | @defun scan-sexps from count |
diff --git a/src/ChangeLog b/src/ChangeLog index 12b4fa97c33..7ad28b0473d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-02-17 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * syntax.c (Fscan_lists): Doc fix (Bug#10833). | ||
| 4 | |||
| 1 | 2012-02-15 Paul Eggert <eggert@cs.ucla.edu> | 5 | 2012-02-15 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 6 | ||
| 3 | * image.c (MAX_IMAGE_SIZE): Increase from 6.0 to 10.0; see | 7 | * image.c (MAX_IMAGE_SIZE): Increase from 6.0 to 10.0; see |
diff --git a/src/syntax.c b/src/syntax.c index bb473a52b3a..645a65f13e6 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -2844,18 +2844,23 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf | |||
| 2844 | 2844 | ||
| 2845 | DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0, | 2845 | DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0, |
| 2846 | doc: /* Scan from character number FROM by COUNT lists. | 2846 | doc: /* Scan from character number FROM by COUNT lists. |
| 2847 | Returns the character number of the position thus found. | 2847 | Scan forward if COUNT is positive, backward if COUNT is negative. |
| 2848 | Return the character number of the position thus found. | ||
| 2849 | |||
| 2850 | A \"list", in this context, refers to a balanced parenthetical | ||
| 2851 | grouping, as determined by the syntax table. | ||
| 2848 | 2852 | ||
| 2849 | If DEPTH is nonzero, paren depth begins counting from that value, | 2853 | If DEPTH is nonzero, treat that as the nesting depth of the starting |
| 2850 | only places where the depth in parentheses becomes zero | 2854 | point (i.e. the starting point is DEPTH parentheses deep). This |
| 2851 | are candidates for stopping; COUNT such places are counted. | 2855 | function scans over parentheses until the depth goes to zero COUNT |
| 2852 | Thus, a positive value for DEPTH means go out levels. | 2856 | times. Hence, positive DEPTH moves out that number of levels of |
| 2857 | paretheses, while negative DEPTH moves to a deeper level. | ||
| 2853 | 2858 | ||
| 2854 | Comments are ignored if `parse-sexp-ignore-comments' is non-nil. | 2859 | Comments are ignored if `parse-sexp-ignore-comments' is non-nil. |
| 2855 | 2860 | ||
| 2856 | If the beginning or end of (the accessible part of) the buffer is reached | 2861 | If we reach the beginning or end of the accessible part of the buffer |
| 2857 | and the depth is wrong, an error is signaled. | 2862 | before we have scanned over COUNT lists, return nil if the depth at |
| 2858 | If the depth is right but the count is not used up, nil is returned. */) | 2863 | that point is zero, and signal a error if the depth is nonzero. */) |
| 2859 | (Lisp_Object from, Lisp_Object count, Lisp_Object depth) | 2864 | (Lisp_Object from, Lisp_Object count, Lisp_Object depth) |
| 2860 | { | 2865 | { |
| 2861 | CHECK_NUMBER (from); | 2866 | CHECK_NUMBER (from); |