0

The docstring of scan-sexps says:

If the beginning or end is reached between groupings but before count is used up, nil is returned.

Putting point (|) before the first element of a list:

(|a b c)

and calling backward-sexp, however, throws an error such as:

(scan-error "Containing expression ends prematurely" 1600 1600)

It's unclear whether this is expected behavior when there's text in the buffer before (a b c). It seems to me that nil should be returned instead--or am I misunderstanding the docstring.

  • Please consider filing a doc bug, saying what you think is not clear: M-x report-emacs-bug. Emacs developers will listen and let you know if they agree that it is unclear, and they will likely ask for your suggestions about how to make the doc clearer. – Drew Mar 8 '17 at 22:54
1

Here is the whole paragraph.

If the beginning or end of (the accessible part of) the buffer is reached in the middle of a parenthetical grouping, an error is signaled. If the beginning or end is reached between groupings but before count is used up, nil is returned.

So "beginning or end" in this sentence refers to point-min resp. -max. It doesn't matter if there is text before (|a b c), since you don't get out of the expression anyway and thus don't reach these positions. The fact that the function signals an error in this case is not mentioned at all, but rather needs to be infered from the positive description of its behaviour ("balanced expressions"), I suppose.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.