From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: scan-sexps throws an error - are there any substitutes? Date: Fri, 27 Mar 2015 13:07:41 +0100 Message-ID: <87r3sa3ape.fsf@wmi.amu.edu.pl> References: <87sicrgy5i.fsf@wmi.amu.edu.pl> <57492c9d-d615-4854-bcb3-556acf55aeaa@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1427458117 7460 80.91.229.3 (27 Mar 2015 12:08:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Mar 2015 12:08:37 +0000 (UTC) To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 27 13:08:22 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YbT3T-0000jJ-Fm for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Mar 2015 13:08:03 +0100 Original-Received: from localhost ([::1]:49916 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbT3S-0001eE-91 for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Mar 2015 08:08:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbT3A-0001av-VP for help-gnu-emacs@gnu.org; Fri, 27 Mar 2015 08:07:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbT39-0001vh-S4 for help-gnu-emacs@gnu.org; Fri, 27 Mar 2015 08:07:44 -0400 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:40454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbT39-0001vW-KD for help-gnu-emacs@gnu.org; Fri, 27 Mar 2015 08:07:43 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 612C25B822 for ; Fri, 27 Mar 2015 13:07:42 +0100 (CET) Original-Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DbadXmileCP4 for ; Fri, 27 Mar 2015 13:07:42 +0100 (CET) Original-Received: from localhost (unknown [IPv6:2001:808:114:6:a42a:26bf:fdf9:7d7c]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id 466DF5B820 for ; Fri, 27 Mar 2015 13:07:42 +0100 (CET) In-reply-to: <57492c9d-d615-4854-bcb3-556acf55aeaa@default> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:808:114:2::50 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103387 Archived-At: On 2015-03-27, at 00:12, Drew Adams wrote: >> scan-sexps throws an error if it cannot move as many sexps as I want. >> This is fine in interactive use, but not really helpful in Lisp code I= =E2=80=99m >> writing. (For the curious: I=E2=80=99m trying to write a solid SLOC-c= ounting >> function, and I need moving by sexps to determine whether a string is >> a docstring, which I want to exclude from the count.) Any ideas what = to >> do? I could rewrite it in Elisp, but is it a good idea? I doubt so. >>=20 >> NB. I don't really use scan-sexps, I use backward-sexp, which is >> seemingly a higher level function =E2=80=93 but, unlike search functio= ns, it >> doesn't have a =E2=80=9Cnoerror=E2=80=9D argument. > > You can wrap any code in `ignore-errors' to, well, ignore errors. ;-) What a surprise! ;-) > You can also use `condition-case' to ignore particular signals. This will probably be better, thanks! Best, --=20 Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University