From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#49842: re-builder restriction to region (lisp/emacs-lisp/re-builder) Date: Thu, 05 Aug 2021 12:57:58 +0200 Message-ID: <87a6lwi2fd.fsf@gnus.org> References: <87lf5jqing.fsf@gmail.com> <877dh23smo.fsf@gmail.com> <874kc5fz13.fsf_-_@gnus.org> <87bl6d3p01.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7171"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 49842@debbugs.gnu.org To: Karthik Chikmagalur Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 05 12:59:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mBb5i-0001dk-53 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Aug 2021 12:59:10 +0200 Original-Received: from localhost ([::1]:45010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBb5h-0008UM-7d for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Aug 2021 06:59:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBb5a-0008U5-Lz for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2021 06:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34483) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mBb5a-0004ZP-FT for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2021 06:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mBb5a-0006AN-Er for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2021 06:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Aug 2021 10:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49842 X-GNU-PR-Package: emacs Original-Received: via spool by 49842-submit@debbugs.gnu.org id=B49842.162816108923640 (code B ref 49842); Thu, 05 Aug 2021 10:59:02 +0000 Original-Received: (at 49842) by debbugs.gnu.org; 5 Aug 2021 10:58:09 +0000 Original-Received: from localhost ([127.0.0.1]:46029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mBb4i-00069E-Nr for submit@debbugs.gnu.org; Thu, 05 Aug 2021 06:58:08 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:52018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mBb4g-00068h-ST for 49842@debbugs.gnu.org; Thu, 05 Aug 2021 06:58:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=A4lSoFQoWnhFIPRvsCEw++quWAzVHXHMQ+tu0ZA3PjY=; b=J5Gmr4uIT3MezUeY5DZOUj5mch KqdaeeeiiNTJo5Y15FTYhgGSwH5wXEK63wD6xBvXUN6I2QRaTwImqQzzEr/gJIPr8GSvcNXI04Ybj wvreY7L7VY3BYIbg8i2sgLncsaO+vW5HOvEfalRVtr8a3SQwDMQHOG+HZBauCojhpT6U=; Original-Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mBb4Y-0002mj-HN; Thu, 05 Aug 2021 12:58:00 +0200 In-Reply-To: <87bl6d3p01.fsf@gmail.com> (Karthik Chikmagalur's message of "Wed, 04 Aug 2021 13:59:26 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:211218 Archived-At: Karthik Chikmagalur writes: > I'm working on a few improvements to re-builder including the above, > and need to store some state information (bounds of region, etc) that > persists until the re-builder session is closed. I see two ways to do > this: > > 1. With a buffer-local variable in reb-target-buffer, with the > assumption that only one re-builder session can be run per buffer. > > 2. With a lexical closure in the re-builder update code. > > I'm not very familiar with elisp best practices, is there a reason to > prefer one over the other beyond the direct effect on the re-builder > code logic/complexity? Traditionally, Emacs Lisp didn't have lexical binding, so people usually stashed the data in buffer-local values. Now that all of the in-tree code uses lexical binding, I think using closures usually gives more readable and maintainable code. But it's up to the person implementing it what they prefer, or what makes most sense to them in that particular case, really. (Sometimes using buffer-local values is much more convenient, and sometimes closures are.) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no