From unknown Tue Jun 24 05:14:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13994: End of buffer error for forward-sexp Resent-From: "Aaron S. Hawley" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Mar 2013 21:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13994 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 13994@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs Received: via spool by submit@debbugs.gnu.org id=B.13636438092165 (code B ref -1); Mon, 18 Mar 2013 21:57:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 Mar 2013 21:56:49 +0000 Received: from localhost ([127.0.0.1]:34219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UHi2x-0000Yr-KW for submit@debbugs.gnu.org; Mon, 18 Mar 2013 17:56:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52231) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UHi2t-0000Yf-NP for submit@debbugs.gnu.org; Mon, 18 Mar 2013 17:56:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHi1J-0007u3-8A for submit@debbugs.gnu.org; Mon, 18 Mar 2013 17:55:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:41213) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHi1J-0007ty-5E for submit@debbugs.gnu.org; Mon, 18 Mar 2013 17:55:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHi1E-0003hW-H7 for bug-gnu-emacs@gnu.org; Mon, 18 Mar 2013 17:55:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHi1C-0007cw-Ga for bug-gnu-emacs@gnu.org; Mon, 18 Mar 2013 17:55:00 -0400 Received: from mail-qc0-x236.google.com ([2607:f8b0:400d:c01::236]:63633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHi1C-0007cZ-Aq for bug-gnu-emacs@gnu.org; Mon, 18 Mar 2013 17:54:58 -0400 Received: by mail-qc0-f182.google.com with SMTP id k19so3109300qcs.27 for ; Mon, 18 Mar 2013 14:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=n88uIWOh/PelaLi4aLHzUIOoZNa9+k1WwNegXTCJk5Q=; b=hSzwYBFTZqNfF/WxuhDDtuoumrQddbfBLOL5uNMIuwAyePMChByJ2we8a0+hn1pkU3 ovlE1wQwMJv4/AnZbqi71EX10Ls+ylKLHtatWwgLb/4GKNxT6EYlAysy2xcR2WVgkU04 wJMQabwHHcJ/KXYJQ8zvmeG/Pk9l5y7UdAUj1vbFoGS7jJMx0iwyuWrnyqsT6bPnE1P6 983aDIFsQLqXh1kvHyCt278qYsyINwD/8AHynFkGXQ3PJLS+qyyvw59W4Ei7RzU/dQJk scCpD8jmSGWPET4mM7DnrTovJLkKW14o3k9x6K2HMAseFapFXZSxZs73rhRXetq3FPgz uukQ== MIME-Version: 1.0 X-Received: by 10.229.112.38 with SMTP id u38mr1289561qcp.30.1363643696983; Mon, 18 Mar 2013 14:54:56 -0700 (PDT) Received: by 10.49.128.200 with HTTP; Mon, 18 Mar 2013 14:54:56 -0700 (PDT) Date: Mon, 18 Mar 2013 17:54:56 -0400 Message-ID: From: "Aaron S. Hawley" Content-Type: multipart/mixed; boundary=002354471d8c28d7a204d83a0ae7 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --002354471d8c28d7a204d83a0ae7 Content-Type: text/plain; charset=ISO-8859-1 I would like C-M-f (`forward-sexp') to signal an error when reaching the beginning or end of a buffer. When running a keyboard macro that contains this command, it should reach an error condition of "End of buffer". If wish to run C-0 C-x e on a file full of S-expressions and have the macro end when an error is reached. Currently, my macro puts Emacs in an infinite loop. I've attached a patch that adds these error conditions. I also need to correct my email address in the ChangeLog. What I wrote isn't every strict. I only catch the condition when the function is started from beginning or end of buffer. If the user gives an argument for more S-expressions than there are between the beginning of the buffer there is no error triggered. This was a compromise but also a simpler patch to contribute. I've added the unit tests I wrote to implement. I hope they're helpful. I'm not sure why this was never the case in the first place, nor do I know what the consequence of fixing it is. I'm not sure if the lack of an error is necessary in the 112 libraries where this function is used in Emacs (and probably many times more in libraries outside of Emacs!). I'm hoping that after the release Emacs 24.3, now is a good time to install this in trunk and find out. Thanks, /a === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-03-18 19:44:15 +0000 +++ lisp/ChangeLog 2013-03-18 20:37:01 +0000 @@ -1,3 +1,5 @@ +2013-03-18 Aaron S. Hawley + + * emacs-lisp/lisp.el (forward-sexp): Signal an error when end of + buffer or beginning of buffer reached. + @@ -1974,7 +1979,7 @@ (js--multi-line-declaration-indentation): New function. (js--proper-indentation): Use it. -2013-01-11 Aaron S. Hawley +2013-01-11 Aaron S. Hawley * calc/calc.el (calc-highlight-selections-with-faces) (calc-dispatch): === modified file 'lisp/emacs-lisp/lisp.el' --- lisp/emacs-lisp/lisp.el 2013-01-01 09:11:05 +0000 +++ lisp/emacs-lisp/lisp.el 2013-03-18 19:38:50 +0000 @@ -58,6 +58,10 @@ (or arg (setq arg 1)) (if forward-sexp-function (funcall forward-sexp-function arg) + (when (and (> arg 0) (eobp)) + (signal 'end-of-buffer nil)) + (when (and (< arg 0) (bobp)) + (signal 'beginning-of-buffer nil)) (goto-char (or (scan-sexps (point) arg) (buffer-end arg))) (if (< arg 0) (backward-prefix-chars)))) === added file 'test/automated/sexp-tests.el' --- test/automated/sexp-tests.el 1970-01-01 00:00:00 +0000 +++ test/automated/sexp-tests.el 2013-03-18 21:51:52 +0000 @@ -0,0 +1,98 @@ +;;; sexp-tests.el --- Test S-expression support in Emacs + +;; Copyright (C) 2013 Aaron S. Hawley + +;; Author: Aaron S. Hawley +;; Keywords: internal + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Testing of `forward-sexp'. + +;;; Code: + +(require 'ert) + +(ert-deftest sexp-forward-1 () + "Test basics of \\[forward-sexp]." + (with-temp-buffer + (insert "()") + (goto-char (point-min)) + (should (null + (forward-sexp 1))))) + +(ert-deftest sexp-backward-1 () + "Test basics of \\[backward-sexp]." + (with-temp-buffer + (insert "()") + (should (null + (forward-sexp -1))))) + +(ert-deftest sexp-forward-1-error-eobp () + "Test error when \\[forward-sexp] at `eobp'." + (with-temp-buffer + (insert "()") + (should-error + (forward-sexp 1)))) + +(ert-deftest sexp-backward-1-error-eobp () + "Test error when \\[backward-sexp] at `bobp'." + (with-temp-buffer + (insert "()") + (goto-char (point-min)) + (should-error + (forward-sexp -1)))) + +(ert-deftest sexp-forward-2-eobp-no-error () + "Test lack of error when \\[forward-sexp] beyond `eobp'." + (with-temp-buffer + (insert "()") + (goto-char (point-min)) + (should (null + (forward-sexp 2))) + (should (eobp)))) + +(ert-deftest sexp-backward-2-bobp-no-error () + "Test lack of error when \\[backward-sexp] beyond `bobp'." + (with-temp-buffer + (insert "()") + (should (null + (forward-sexp -2))) + (should (bobp)))) + +(ert-deftest sexp-forward-2-eobp-subsequent-error () + "Test error when \\[forward-sexp] when started from `eobp'." + (with-temp-buffer + (insert "()") + (goto-char (point-min)) + (should (null + (forward-sexp 2))) + (should (eobp)) + (should-error + (forward-sexp 1)))) + +(ert-deftest sexp-backward-2-bobp-subsequent-error () + "Test error when \\[backward-sexp] when started from `bobp'." + (with-temp-buffer + (insert "()") + (should (null + (forward-sexp -2))) + (should (bobp)) + (should-error + (forward-sexp -1)))) + +(provide 'sexp-tests) +;;; sexp-tests.el ends here -- In general, we reserve the right to have a poor memory--the computer, however, is supposed to remember! Poor computer. -- Guy Lewis Steele Jr. --002354471d8c28d7a204d83a0ae7 Content-Type: application/octet-stream; name="lisp.el.diff" Content-Disposition: attachment; filename="lisp.el.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_heg68gps1 PT09IG1vZGlmaWVkIGZpbGUgJ2xpc3AvQ2hhbmdlTG9nJwotLS0gbGlzcC9DaGFuZ2VMb2cJMjAx My0wMy0xOCAxOTo0NDoxNSArMDAwMAorKysgbGlzcC9DaGFuZ2VMb2cJMjAxMy0wMy0xOCAyMDoz NzowMSArMDAwMApAQCAtMSwzICsxLDUgQEAKKzIwMTMtMDMtMTggIEFhcm9uIFMuIEhhd2xleSAg PGFhcm9uLnMuaGF3bGV5QGdtYWlsLmNvbT4KKworICAgICAgICAqIGVtYWNzLWxpc3AvbGlzcC5l bCAoZm9yd2FyZC1zZXhwKTogU2lnbmFsIGFuIGVycm9yIHdoZW4gZW5kIG9mCisgICAgICAgIGJ1 ZmZlciBvciBiZWdpbm5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ICJUZXN0IGVycm9yIHdoZW4gXFxbZm9yd2FyZC1zZXhwXSB3aGVuIHN0YXJ0ZWQgZnJvbSBg ZW9icCcuIgorICAod2l0aC10ZW1wLWJ1ZmZlcgorICAgIChpbnNlcnQgIigpIikKKyAgICAoZ290 by1jaGFyIChwb2ludC1taW4pKQorICAgIChzaG91bGQgKG51bGwKKyAgICAgKGZvcndhcmQtc2V4 cCAyKSkpCisgICAgKHNob3VsZCAoZW9icCkpCisgICAgKHNob3VsZC1lcnJvcgorICAgICAoZm9y d2FyZC1zZXhwIDEpKSkpCisKKyhlcnQtZGVmdGVzdCBzZXhwLWJhY2t3YXJkLTItYm9icC1zdWJz ZXF1ZW50LWVycm9yICgpCisgICJUZXN0IGVycm9yIHdoZW4gXFxbYmFja3dhcmQtc2V4cF0gd2hl biBzdGFydGVkIGZyb20gYGJvYnAnLiIKKyAgKHdpdGgtdGVtcC1idWZmZXIKKyAgICAoaW5zZXJ0 ICIoKSIpCisgICAgKHNob3VsZCAobnVsbAorICAgICAoZm9yd2FyZC1zZXhwIC0yKSkpCisgICAg KHNob3VsZCAoYm9icCkpCisgICAgKHNob3VsZC1lcnJvcgorICAgICAoZm9yd2FyZC1zZXhwIC0x KSkpKQorCisocHJvdmlkZSAnc2V4cC10ZXN0cykKKzs7OyBzZXhwLXRlc3RzLmVsIGVuZHMgaGVy ZQoK --002354471d8c28d7a204d83a0ae7-- From unknown Tue Jun 24 05:14:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13994: End of buffer error for forward-sexp Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Mar 2013 13:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13994 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "Aaron S. Hawley" Cc: 13994@debbugs.gnu.org Received: via spool by 13994-submit@debbugs.gnu.org id=B13994.136473714925699 (code B ref 13994); Sun, 31 Mar 2013 13:40:02 +0000 Received: (at 13994) by debbugs.gnu.org; 31 Mar 2013 13:39:09 +0000 Received: from localhost ([127.0.0.1]:53844 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UMITU-0006gR-5D for submit@debbugs.gnu.org; Sun, 31 Mar 2013 09:39:09 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:36879) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UMITQ-0006gI-S7 for 13994@debbugs.gnu.org; Sun, 31 Mar 2013 09:39:05 -0400 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r2VDaFWp021385; Sun, 31 Mar 2013 09:36:15 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id CE164AE334; Sun, 31 Mar 2013 09:36:14 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Sun, 31 Mar 2013 09:36:14 -0400 In-Reply-To: (Aaron S. Hawley's message of "Mon, 18 Mar 2013 17:54:56 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4535=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4535> : streams <931454> : uri <1381065> X-Spam-Score: -3.2 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) > 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. Stefan From unknown Tue Jun 24 05:14:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13994: End of buffer error for forward-sexp Resent-From: "Aaron S. Hawley" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Apr 2013 20:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13994 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 13994@debbugs.gnu.org Received: via spool by 13994-submit@debbugs.gnu.org id=B13994.13668362028764 (code B ref 13994); Wed, 24 Apr 2013 20:44:02 +0000 Received: (at 13994) by debbugs.gnu.org; 24 Apr 2013 20:43:22 +0000 Received: from localhost ([127.0.0.1]:41606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UV6XB-0002HI-GE for submit@debbugs.gnu.org; Wed, 24 Apr 2013 16:43:22 -0400 Received: from mail-qe0-f48.google.com ([209.85.128.48]:47871) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UV6Wv-0002Gi-04 for 13994@debbugs.gnu.org; Wed, 24 Apr 2013 16:43:14 -0400 Received: by mail-qe0-f48.google.com with SMTP id 9so1544357qea.21 for <13994@debbugs.gnu.org>; Wed, 24 Apr 2013 13:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=08coMudeoxihdwWK14xhKCLSslZmE83OlM10Y/fgpwE=; b=tWGBj4LYKgCH4P0GxjhDNlhwHasGJA1gf/P+LQxGwNX+Eh+t7tE14CYNatiiHhCyZq B32gktdV4twSkBFUi1Cdrm/o4cC51QWeiy7cRnGmW1r56ZadT/0ie6KsxKgO7tzbjm7J yHMq20CiRP4lYck4YphbSBvsE3qjb3t6QajNF6dewU1pnohdK1EMaqBDoezzeyWczK3T eNx3t2jUIxL6PZU4qgCVWJhIHyxIKhh3dIRmaAE7MenLgCIquSWxtmYpy7nAwB6b8BPk xDTJTQ3WmEC9etRkdtYOfuL7Yd3nYY6wsXdPzCfqHpw/76GU5OriJ59B6E+uZVjCtL5U ZBIQ== MIME-Version: 1.0 X-Received: by 10.229.126.27 with SMTP id a27mr745384qcs.30.1366835880182; Wed, 24 Apr 2013 13:38:00 -0700 (PDT) Received: by 10.49.13.41 with HTTP; Wed, 24 Apr 2013 13:38:00 -0700 (PDT) In-Reply-To: References: Date: Wed, 24 Apr 2013 16:38:00 -0400 Message-ID: From: "Aaron S. Hawley" Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) >> 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. Do you have an example of code that you've seen "needs the current behavior" at the beginning or end of the buffer. I'd be happy to crusade and study this further and root those out. So far, I've looked at these functions in Emacs to see if they still work. end-of-sexp beginning-of-sexp thing-at-point-bounds-of-list-at-point sort-numeric-fields transpose-sexps blink-matching-open diary-list-sexp-entries diary-mark-sexp-entries comint-extract-string From unknown Tue Jun 24 05:14:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13994: End of buffer error for forward-sexp Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Apr 2013 21:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13994 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "'Aaron S. Hawley'" , "'Stefan Monnier'" Cc: 13994@debbugs.gnu.org Received: via spool by 13994-submit@debbugs.gnu.org id=B13994.136683887915726 (code B ref 13994); Wed, 24 Apr 2013 21:28:01 +0000 Received: (at 13994) by debbugs.gnu.org; 24 Apr 2013 21:27:59 +0000 Received: from localhost ([127.0.0.1]:41650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UV7EN-00045b-80 for submit@debbugs.gnu.org; Wed, 24 Apr 2013 17:27:59 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:31312) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UV7EJ-00045M-2K for 13994@debbugs.gnu.org; Wed, 24 Apr 2013 17:27:57 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r3OLMlTN025822 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 24 Apr 2013 21:22:48 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3OLMl8D017449 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 24 Apr 2013 21:22:47 GMT Received: from abhmt112.oracle.com (abhmt112.oracle.com [141.146.116.64]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3OLMl1C015453; Wed, 24 Apr 2013 21:22:47 GMT Received: from dradamslap1 (/130.35.178.8) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 24 Apr 2013 14:22:46 -0700 From: "Drew Adams" References: Date: Wed, 24 Apr 2013 14:22:45 -0700 Message-ID: <60DF8CA8098A46B1A6B5F6E815AC8CE4@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Ac5BK9HTE+r7EevbShOooO5RDeJ7mAAA8/lw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Spam-Score: -1.5 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) > 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. Pretty small sample. > Do you have an example of code that you've seen "needs the current > behavior" at the beginning or end of the buffer.... > > So far, I've looked at these functions in Emacs to see if > they still work. > > end-of-sexp > beginning-of-sexp > thing-at-point-bounds-of-list-at-point > sort-numeric-fields > transpose-sexps > blink-matching-open > diary-list-sexp-entries > diary-mark-sexp-entries > comint-extract-string Pretty small sample. There must be thousands of uses of `forward-sexp' in existing Emacs-Lisp code out there. How many of them depend (intentionally or not) on `forward-sexp' returning nil for premature `eobp'? Who knows. Now everytime some code does (when (looking-at "\"") (forward-sexp 1)) or whatever it will need to be fixed to wrap it in `ignore-errors' or otherwise treat the `eobp' case? Doesn't sound like a sound approach at this point. Might have been a reasonable suggestion 30 years ago. What's the point? If you have some code that needs to raise an error when `forward-sexp' reaches eob, that's easy enough to do, no? Not to mention that the code for `forward-sexp' explicitly takes point to eob when `scan-sexps' returns nil. IOW, that behavior is presumably by design. And not to mention that it calls `forward-sexp-function', if non-nil, to do everything, in which case (depending on where you would place your call to `error') you might be changing the meaning/behavior for its code as well, if it reaches eob. From unknown Tue Jun 24 05:14:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13994: End of buffer error for forward-sexp Resent-From: "Aaron S. Hawley" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Apr 2013 21:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13994 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Drew Adams Cc: Stefan Monnier , 13994@debbugs.gnu.org Received: via spool by 13994-submit@debbugs.gnu.org id=B13994.136683963517734 (code B ref 13994); Wed, 24 Apr 2013 21:41:01 +0000 Received: (at 13994) by debbugs.gnu.org; 24 Apr 2013 21:40:35 +0000 Received: from localhost ([127.0.0.1]:41671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UV7QY-0004bz-Hq for submit@debbugs.gnu.org; Wed, 24 Apr 2013 17:40:34 -0400 Received: from mail-qc0-f175.google.com ([209.85.216.175]:49787) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UV7QX-0004bp-ML for 13994@debbugs.gnu.org; Wed, 24 Apr 2013 17:40:34 -0400 Received: by mail-qc0-f175.google.com with SMTP id j3so1201601qcs.20 for <13994@debbugs.gnu.org>; Wed, 24 Apr 2013 14:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=oQiLx4pgFDJ4lDZtYBUz1/jgqhBLWS5PW1tFsuvVPxg=; b=EotTQqCgE2S3a+IAxPIF57oh4txN4X8O0B9u58E3Q/6PZ4L2Y9d6YSq6Lff8+duDVf Gof5/MOCsfsO/sWLaUaYRlo9DTEqPs2VV1AOP7nGI9Wo4hgOwiMq+k0hj7PTRvRburvZ Yih6dyGCyX3Nh3wbIrS3HwY0SoD9W4Ludcx3VCPMDFzZ3SmksE808J1YWERyLw/s/5+M c265y+e5l8Up7CT+5Hm6wpx9n0cumzX9HCwz6RfCveP5+PelmTT8WxJwQ0YCqN56Siu/ 1hPIPGtyXoaykD7Hsq3LmL1krGcF4VIPdR2kgFRmdGpf7VZHHebjLC9NLoYaepk/aKmv FfKw== MIME-Version: 1.0 X-Received: by 10.229.82.211 with SMTP id c19mr1973743qcl.75.1366839328823; Wed, 24 Apr 2013 14:35:28 -0700 (PDT) Received: by 10.49.13.41 with HTTP; Wed, 24 Apr 2013 14:35:28 -0700 (PDT) In-Reply-To: <60DF8CA8098A46B1A6B5F6E815AC8CE4@us.oracle.com> References: <60DF8CA8098A46B1A6B5F6E815AC8CE4@us.oracle.com> Date: Wed, 24 Apr 2013 17:35:28 -0400 Message-ID: From: "Aaron S. Hawley" Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) > Now everytime some code does (when (looking-at "\"") (forward-sexp 1)) or > whatever it will need to be fixed to wrap it in `ignore-errors' or otherwise > treat the `eobp' case? What I'm finding in my small sample is that most code already has ignore-errors or is finding the end or beginning of a buffer with a different Emacs primitive. In other words, no code changes! > What's the point? If you have some code that needs to raise an error when > `forward-sexp' reaches eob, that's easy enough to do, no? I wouldn't have sent a patch if I didn't think it should be the default. > Not to mention that the code for `forward-sexp' explicitly takes point to eob > when `scan-sexps' returns nil. IOW, that behavior is presumably by design. I don't believe my patch is changing that behavior. > And not to mention that it calls `forward-sexp-function', if non-nil, to do > everything, in which case (depending on where you would place your call to > `error') you might be changing the meaning/behavior for its code as well, if it > reaches eob. I'm pretty sure my patch doesn't take anything away from the user's ability to entirely redefine forward-sexp by setting forward-sexp-function. From unknown Tue Jun 24 05:14:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13994: End of buffer error for forward-sexp Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Apr 2013 03:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13994 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "Aaron S. Hawley" Cc: 13994@debbugs.gnu.org Received: via spool by 13994-submit@debbugs.gnu.org id=B13994.13668621175752 (code B ref 13994); Thu, 25 Apr 2013 03:56:02 +0000 Received: (at 13994) by debbugs.gnu.org; 25 Apr 2013 03:55:17 +0000 Received: from localhost ([127.0.0.1]:42022 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UVDHA-0001Uh-KQ for submit@debbugs.gnu.org; Wed, 24 Apr 2013 23:55:16 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:40727) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UVDH8-0001UT-Dl for 13994@debbugs.gnu.org; Wed, 24 Apr 2013 23:55:14 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpYYW/2dsb2JhbABEvw4Xc4IeAQEEAVYWCgMQCzQSFBgNJIgeBsEtkQoDklqSIIFegxM X-IPAS-Result: Av4EABK/CFFFpYYW/2dsb2JhbABEvw4Xc4IeAQEEAVYWCgMQCzQSFBgNJIgeBsEtkQoDklqSIIFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="8242656" Received: from 69-165-134-22.dsl.teksavvy.com (HELO ceviche.home) ([69.165.134.22]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 24 Apr 2013 23:50:04 -0400 Received: by ceviche.home (Postfix, from userid 20848) id B68D8660E8; Wed, 24 Apr 2013 23:50:07 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Wed, 24 Apr 2013 23:50:07 -0400 In-Reply-To: (Aaron S. Hawley's message of "Wed, 24 Apr 2013 16:38:00 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >>> 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 From unknown Tue Jun 24 05:14:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13994: End of buffer error for forward-sexp Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Apr 2013 07:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13994 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "Aaron S. Hawley" Cc: 13994@debbugs.gnu.org Received: via spool by 13994-submit@debbugs.gnu.org id=B13994.13672197324976 (code B ref 13994); Mon, 29 Apr 2013 07:16:01 +0000 Received: (at 13994) by debbugs.gnu.org; 29 Apr 2013 07:15:32 +0000 Received: from localhost ([127.0.0.1]:49443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UWiJA-0001IB-4K for submit@debbugs.gnu.org; Mon, 29 Apr 2013 03:15:32 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:58331 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UWiJ8-0001I1-R9 for 13994@debbugs.gnu.org; Mon, 29 Apr 2013 03:15:31 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 8226D258B9E93C; Mon, 29 Apr 2013 00:15:13 -0700 (PDT) From: Juri Linkov Organization: JURTA References: Date: Mon, 29 Apr 2013 10:10:37 +0300 In-Reply-To: (Aaron S. Hawley's message of "Mon, 18 Mar 2013 17:54:56 -0400") Message-ID: <87a9ohvmea.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > I would like C-M-f (`forward-sexp') to signal an error when reaching > the beginning or end of a buffer. If you want only `C-M-f' to signal an error, then you could create a new command with a name like `forward-sexp-command' that signals an error and bind it to `C-M-f'. That's what e.g `scroll-up-command' does to control error-signaling only for the command bound to `C-v' without affecting the lower-level function `scroll-up'. From unknown Tue Jun 24 05:14:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13994: End of buffer error for forward-sexp Resent-From: Andreas =?UTF-8?Q?R=C3=B6hler?= Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Apr 2013 12:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13994 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 13994@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13672393315062 (code B ref -1); Mon, 29 Apr 2013 12:43:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Apr 2013 12:42:11 +0000 Received: from localhost ([127.0.0.1]:49847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UWnPG-0001Ja-Lq for submit@debbugs.gnu.org; Mon, 29 Apr 2013 08:42:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55117) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UWnPC-0001JP-Ll for submit@debbugs.gnu.org; Mon, 29 Apr 2013 08:42:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWnOt-0007d7-J9 for submit@debbugs.gnu.org; Mon, 29 Apr 2013 08:41:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-100.0 required=5.0 tests=BAYES_40, RCVD_IN_DNSWL_NONE, USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:53421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWnOt-0007d3-Fz for submit@debbugs.gnu.org; Mon, 29 Apr 2013 08:41:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWnOo-0003X2-CN for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2013 08:41:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWnOm-0007bV-Ep for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2013 08:41:42 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:63046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWnOm-0007b6-5Y for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2013 08:41:40 -0400 Received: from [192.168.178.21] (brln-4dbc4f2b.pool.mediaWays.net [77.188.79.43]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0LpeYo-1V06HH2rBe-00fOuy; Mon, 29 Apr 2013 14:41:37 +0200 Message-ID: <517E6B03.9040109@easy-emacs.de> Date: Mon, 29 Apr 2013 14:43:47 +0200 From: Andreas =?UTF-8?Q?R=C3=B6hler?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:HF6zLZIL9XrSjlJyhb3vX9SZqVqOI7eOPMWAreGmEho 30g+u3Cs7iTjTGhd+Zog/6owuDH8ZS5gmY6kPFPOH5TVcHThRh A+YrmX4LgC4qOHRKnRdm0tWiJz7em5/U7RegR3dDSDYTOHQSbc iVj0+/2dia9+ZFBWvyBEF2mxsgRY86k3hp4zoGuXS7O7QiUO2R LgjFMGijQnEBiSHjTWvRMTNT7dJe97AKeuUSbY4z99PCoTKtWW Fe3VXBDiYSLU3U81CwGshJWx43bOGaREFkWD5rVEkeynLSo2WX OBkrmm6QYIXaXt5hh4W0FWLZEasU4QcK1z8/qSjPRDdR104WzT 8njoXkkPxc+eTBvhnBGVLgURIPoms5wiQsu58tLsl X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Am 18.03.2013 22:54, schrieb Aaron S. Hawley: > I would like C-M-f (`forward-sexp') to signal an error when reaching > the beginning or end of a buffer. When running a keyboard macro that > contains this command, it should reach an error condition of "End of > buffer". If wish to run C-0 C-x e on a file full of S-expressions and > have the macro end when an error is reached. Currently, my macro puts > Emacs in an infinite loop. > > I've attached a patch that adds these error conditions. I also need > to correct my email address in the ChangeLog. > > What I wrote isn't every strict. I only catch the condition when the > function is started from beginning or end of buffer. If the user > gives an argument for more S-expressions than there are between the > beginning of the buffer there is no error triggered. This was a > compromise but also a simpler patch to contribute. I've added the > unit tests I wrote to implement. I hope they're helpful. > > I'm not sure why this was never the case in the first place, nor do I > know what the consequence of fixing it is. I'm not sure if the lack > of an error is necessary in the 112 libraries where this function is > used in Emacs (and probably many times more in libraries outside of > Emacs!). I'm hoping that after the release Emacs 24.3, now is a good > time to install this in trunk and find out. > > Thanks, > /a > > === modified file 'lisp/ChangeLog' > --- lisp/ChangeLog 2013-03-18 19:44:15 +0000 > +++ lisp/ChangeLog 2013-03-18 20:37:01 +0000 > @@ -1,3 +1,5 @@ > +2013-03-18 Aaron S. Hawley > + > + * emacs-lisp/lisp.el (forward-sexp): Signal an error when end of > + buffer or beginning of buffer reached. > + > @@ -1974,7 +1979,7 @@ > (js--multi-line-declaration-indentation): New function. > (js--proper-indentation): Use it. > > -2013-01-11 Aaron S. Hawley > +2013-01-11 Aaron S. Hawley > > * calc/calc.el (calc-highlight-selections-with-faces) > (calc-dispatch): > > === modified file 'lisp/emacs-lisp/lisp.el' > --- lisp/emacs-lisp/lisp.el 2013-01-01 09:11:05 +0000 > +++ lisp/emacs-lisp/lisp.el 2013-03-18 19:38:50 +0000 > @@ -58,6 +58,10 @@ > (or arg (setq arg 1)) > (if forward-sexp-function > (funcall forward-sexp-function arg) > + (when (and (> arg 0) (eobp)) > + (signal 'end-of-buffer nil)) > + (when (and (< arg 0) (bobp)) > + (signal 'beginning-of-buffer nil)) > (goto-char (or (scan-sexps (point) arg) (buffer-end arg))) > (if (< arg 0) (backward-prefix-chars)))) > > > === added file 'test/automated/sexp-tests.el' > --- test/automated/sexp-tests.el 1970-01-01 00:00:00 +0000 > +++ test/automated/sexp-tests.el 2013-03-18 21:51:52 +0000 > @@ -0,0 +1,98 @@ > +;;; sexp-tests.el --- Test S-expression support in Emacs > + > +;; Copyright (C) 2013 Aaron S. Hawley > + > +;; Author: Aaron S. Hawley > +;; Keywords: internal > + > +;; This program is free software; you can redistribute it and/or modify > +;; it under the terms of the GNU General Public License as published by > +;; the Free Software Foundation, either version 3 of the License, or > +;; (at your option) any later version. > + > +;; This program is distributed in the hope that it will be useful, > +;; but WITHOUT ANY WARRANTY; without even the implied warranty of > +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +;; GNU General Public License for more details. > + > +;; You should have received a copy of the GNU General Public License > +;; along with this program. If not, see . > + > +;;; Commentary: > + > +;; Testing of `forward-sexp'. > + > +;;; Code: > + > +(require 'ert) > + > +(ert-deftest sexp-forward-1 () > + "Test basics of \\[forward-sexp]." > + (with-temp-buffer > + (insert "()") > + (goto-char (point-min)) > + (should (null > + (forward-sexp 1))))) > + > +(ert-deftest sexp-backward-1 () > + "Test basics of \\[backward-sexp]." > + (with-temp-buffer > + (insert "()") > + (should (null > + (forward-sexp -1))))) > + > +(ert-deftest sexp-forward-1-error-eobp () > + "Test error when \\[forward-sexp] at `eobp'." > + (with-temp-buffer > + (insert "()") > + (should-error > + (forward-sexp 1)))) > + > +(ert-deftest sexp-backward-1-error-eobp () > + "Test error when \\[backward-sexp] at `bobp'." > + (with-temp-buffer > + (insert "()") > + (goto-char (point-min)) > + (should-error > + (forward-sexp -1)))) > + > +(ert-deftest sexp-forward-2-eobp-no-error () > + "Test lack of error when \\[forward-sexp] beyond `eobp'." > + (with-temp-buffer > + (insert "()") > + (goto-char (point-min)) > + (should (null > + (forward-sexp 2))) > + (should (eobp)))) > + > +(ert-deftest sexp-backward-2-bobp-no-error () > + "Test lack of error when \\[backward-sexp] beyond `bobp'." > + (with-temp-buffer > + (insert "()") > + (should (null > + (forward-sexp -2))) > + (should (bobp)))) > + > +(ert-deftest sexp-forward-2-eobp-subsequent-error () > + "Test error when \\[forward-sexp] when started from `eobp'." > + (with-temp-buffer > + (insert "()") > + (goto-char (point-min)) > + (should (null > + (forward-sexp 2))) > + (should (eobp)) > + (should-error > + (forward-sexp 1)))) > + > +(ert-deftest sexp-backward-2-bobp-subsequent-error () > + "Test error when \\[backward-sexp] when started from `bobp'." > + (with-temp-buffer > + (insert "()") > + (should (null > + (forward-sexp -2))) > + (should (bobp)) > + (should-error > + (forward-sexp -1)))) > + > +(provide 'sexp-tests) > +;;; sexp-tests.el ends here > IIRC that was the default at XEmacs. Very annoying, as beginning or EOB are hitted quit often. Than the debugger starts. For now, what about writing (if (forward-sexp) DO-SOMEthing (message "%s" "nil")) Best regards, Andreas From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 24 00:37:02 2016 Received: (at control) by debbugs.gnu.org; 24 Feb 2016 05:37:02 +0000 Received: from localhost ([127.0.0.1]:42225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYS8E-00044p-FS for submit@debbugs.gnu.org; Wed, 24 Feb 2016 00:37:02 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:53932) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYS8D-00044Y-FV for control@debbugs.gnu.org; Wed, 24 Feb 2016 00:37:01 -0500 Received: from cpe-60-225-211-161.nsw.bigpond.net.au ([60.225.211.161] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aYS7q-0001w3-37 for control@debbugs.gnu.org; Wed, 24 Feb 2016 06:36:38 +0100 Date: Wed, 24 Feb 2016 16:36:34 +1100 Message-Id: <87oab6fz4t.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #13994 X-MailScanner-ID: 1aYS7q-0001w3-37 X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1456896998.88844@sERRy/Cts13hAPWSazgpCg X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tags 13994 wontfix close 13994