Subject: bug#13994: End of buffer error for forward-sexp

From: Stefan Monnier <[email-masked]>
Date: Wed, 24 Apr 2013 23:50:07 -0400

>>> I would like C-M-f (`forward-sexp') to signal an error when reaching
>>> the beginning or end of a buffer.
>> That would make sense, indeed, but I'm afraid there's a fair bit of code
>> out there that needs the current behavior.
> I by no means use all of Emacs, but haven't run into an issue yet with
> my patch.  I use Emacs with t-d-o-e on.

Thoughts in random order:
- the gain is not very large, so the pain needs to be very low.
- forward-sexp is used at many places in many different circumstances,
  so it's difficult to find risky cases.
- I do agree that it is very likely that many/most uses of forward-sexp
  wouldn't suffer.
- Even if few problematic cases are out there (or out here in Emacs
  itself), it may take a very long time (read: not before an actual
  release) to find some of them.
- your patch only affects behavior at BOB/EOB, whereas I think it would
  make more sense to do the same for "before the first non-whitespace"
  and "after the last non-whitespace".  And comments should be considered
  whitespace in this respect (at least when parse-sexp-ignore-comments
  is non-nil).  Of course, fixing this might introduce more
  problematic cases.

        Stefan