From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: Why looking-at-p works? Date: Tue, 06 Mar 2018 21:42:13 +0100 Message-ID: <87ina9szq2.fsf@mbork.pl> References: <87tvtttz49.fsf@mbork.pl> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1520369419 6979 195.159.176.226 (6 Mar 2018 20:50:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 6 Mar 2018 20:50:19 +0000 (UTC) User-Agent: mu4e 1.1.0; emacs 27.0.50 Cc: Help Gnu Emacs mailing list To: John Mastro Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 06 21:50:15 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1etJXF-0000aa-JV for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Mar 2018 21:50:09 +0100 Original-Received: from localhost ([::1]:58089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etJZI-0002SP-52 for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Mar 2018 15:52:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etJPv-0003Ca-H1 for help-gnu-emacs@gnu.org; Tue, 06 Mar 2018 15:42:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etJPq-0001wL-Lw for help-gnu-emacs@gnu.org; Tue, 06 Mar 2018 15:42:35 -0500 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:33849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etJPq-0001wA-Em for help-gnu-emacs@gnu.org; Tue, 06 Mar 2018 15:42:30 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id A4584E670A; Tue, 6 Mar 2018 21:42:29 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dLUEw4S-tn8o; Tue, 6 Mar 2018 21:42:26 +0100 (CET) Original-Received: from localhost (static-dwadziewiec-jedenpiec7.echostar.pl [109.232.29.157]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 4F750E66FB; Tue, 6 Mar 2018 21:42:26 +0100 (CET) In-reply-to: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.110.48.8 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:116118 Archived-At: On 2018-03-06, at 19:53, John Mastro wrote: > Marcin Borkowski wrote: >> Hi all, >> >> (defsubst looking-at-p (regexp) >> "\ >> Same as `looking-at' except this function does not change the match data." >> (let ((inhibit-changing-match-data t)) >> (looking-at regexp))) >> >> What happens is that if I make looking-at in the above code fail (e.g., >> by saying (looking-at-p 123)), inhibit-changing-match-data remains nil, >> even though there is no unwind-protect here. Why does it work like >> this? > > If I understand your question correctly, it's nothing specific to > looking-at-p. Let-bindings are protected by a sort of implicit > unwind-protect so that they're always "un-done" upon exiting the scope, > even in case of non-local exits like an error. Otherwise errors could > leave global variables in unpredictable states. Thanks, I suspected something like that. Where is it documented? I could find it neither in the Elisp Reference nor in let's docstring. TIA, -- Marcin Borkowski http://mbork.pl