From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Nick Dokos Newsgroups: gmane.emacs.help Subject: Re: Why looking-at-p works? Date: Tue, 06 Mar 2018 18:17:13 -0500 Message-ID: <878tb4eqva.fsf@alphaville.usersys.redhat.com> References: <87tvtttz49.fsf@mbork.pl> <87ina9szq2.fsf@mbork.pl> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1520378208 8286 195.159.176.226 (6 Mar 2018 23:16:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 6 Mar 2018 23:16:48 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 07 00:16:44 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 1etLp1-00013K-0e for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Mar 2018 00:16:39 +0100 Original-Received: from localhost ([::1]:58823 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etLr3-0007Ux-Ly for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Mar 2018 18:18:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etLq3-0007TA-Pr for help-gnu-emacs@gnu.org; Tue, 06 Mar 2018 18:17:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etLq2-0000pJ-F2 for help-gnu-emacs@gnu.org; Tue, 06 Mar 2018 18:17:43 -0500 Original-Received: from [195.159.176.226] (port=59643 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1etLq2-0000oC-7A for help-gnu-emacs@gnu.org; Tue, 06 Mar 2018 18:17:42 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1etLnn-0000Bl-0x for help-gnu-emacs@gnu.org; Wed, 07 Mar 2018 00:15:23 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 36 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:/t3dtwfTQ4OvpL7/aJtL1YrjgMk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:116120 Archived-At: Marcin Borkowski writes: > 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. > (info "(elisp)Local variables") -- Nick