From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: Why looking-at-p works? Date: Tue, 6 Mar 2018 10:53:15 -0800 Message-ID: References: <87tvtttz49.fsf@mbork.pl> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1520362386 7372 195.159.176.226 (6 Mar 2018 18:53:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 6 Mar 2018 18:53:06 +0000 (UTC) To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 06 19:53:02 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 1etHhs-0001IM-Sl for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Mar 2018 19:53:01 +0100 Original-Received: from localhost ([::1]:57605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etHjv-0008Mf-H8 for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Mar 2018 13:55:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etHiU-0007nT-HR for help-gnu-emacs@gnu.org; Tue, 06 Mar 2018 13:53:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etHiT-0003jR-Mu for help-gnu-emacs@gnu.org; Tue, 06 Mar 2018 13:53:38 -0500 Original-Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]:33472) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1etHiT-0003iu-IE for help-gnu-emacs@gnu.org; Tue, 06 Mar 2018 13:53:37 -0500 Original-Received: by mail-qk0-x231.google.com with SMTP id f25so26140410qkm.0 for ; Tue, 06 Mar 2018 10:53:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aof3lGalW9F9W7Wixo5q7oBzGW+GLclJUVoEgLczvD0=; b=lL0GkNo3z6vd9EY5bimLRHfnLRH+JdYb3HkIpeupch8twsRqRK0TKqLml9IKlYSGRI ClY1ifZ9JKmC48L61dFc1RMKMOWzBe6gAGI72K8hQsIc9xjYBWiCqYYdWhKbOPUhdkmf 6NpvilnZn8v7CjPscGcjcUieK8bdTJpwnfIFkDQBGZiN5FDJdEBzAW4SlCU4XpVdcZz3 F2tUU4d8VoqwtI+/758ZEFMYgI+r2Rfb42KW1CFZMCYpJCTZQDltAxIm7QWNa5BV590X 0XhLfI1BUYsQhYTYWTDk3KjMxo0mBmezo57usNFbw22feo5tuaEaNptc+BvYjf3Fu84J VvPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aof3lGalW9F9W7Wixo5q7oBzGW+GLclJUVoEgLczvD0=; b=tH+GveqTpTMoAJ9+f3jvNk+a7vMjkEcWNue0emClnHfkDZtaYL9L6blc3k585mzQdh nL0oDMWWjrvXjJ8tdtcc2W2HzQyqsAgB8r5mCV6TP6NfOPPey0zOzhSVXzoyjDvdN1rE eJJkkb2yniNs9xzcaHClfVPC+Z4EurSeFCccxGR7+dXejL7bISSgQTfMMNNI+7zYtFea 3IlAJPG2oEHytIczBqXFgPeZaQPuM3H1YkKlrcjroJ8qLKk9fNV/YptzVspnGN5bHByw 3rVNPqtof7GHk8eqI9GjAsWWKH3UgNmxeDNUlXDmDVVyw0ub5cK62ecrLcUdq7QWmIC7 xiKg== X-Gm-Message-State: AElRT7H5VC83NsJJwVzj1rKUkyBsIdaTNuDE+isU6J5ye6kmWuIvnvd3 mx0c9aEHRX+0J3A0s26qe28g587NpxgV9mJnnNZOfJTw X-Google-Smtp-Source: AG47ELu+tL0dJldxBDE8vnwny5nm5ctApCoIOYoovdQQ/haf5Az3N2w0e9rJcTPemuzeubWw3Ff3vwikXntVRT6b/KY= X-Received: by 10.55.162.86 with SMTP id l83mr27665621qke.160.1520362416445; Tue, 06 Mar 2018 10:53:36 -0800 (PST) Original-Received: by 10.200.52.16 with HTTP; Tue, 6 Mar 2018 10:53:15 -0800 (PST) In-Reply-To: <87tvtttz49.fsf@mbork.pl> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::231 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:116117 Archived-At: 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. John