From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Karthik Chikmagalur Newsgroups: gmane.emacs.bugs Subject: bug#49842: re-builder restriction to region (lisp/emacs-lisp/re-builder) Date: Wed, 04 Aug 2021 13:59:26 -0700 Message-ID: <87bl6d3p01.fsf@gmail.com> References: <87lf5jqing.fsf@gmail.com> <877dh23smo.fsf@gmail.com> <874kc5fz13.fsf_-_@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21426"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 49842@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 04 23:00:11 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 1mBNzn-0005OX-Fl for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Aug 2021 23:00:11 +0200 Original-Received: from localhost ([::1]:50942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBNzm-0007LX-Hs for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Aug 2021 17:00:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBNze-0007LM-P4 for bug-gnu-emacs@gnu.org; Wed, 04 Aug 2021 17:00:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mBNze-0006nw-Ha for bug-gnu-emacs@gnu.org; Wed, 04 Aug 2021 17:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mBNze-0001xM-E7 for bug-gnu-emacs@gnu.org; Wed, 04 Aug 2021 17:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Karthik Chikmagalur Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Aug 2021 21:00: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.16281107777462 (code B ref 49842); Wed, 04 Aug 2021 21:00:02 +0000 Original-Received: (at 49842) by debbugs.gnu.org; 4 Aug 2021 20:59:37 +0000 Original-Received: from localhost ([127.0.0.1]:45265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mBNzE-0001wI-R2 for submit@debbugs.gnu.org; Wed, 04 Aug 2021 16:59:37 -0400 Original-Received: from mail-pj1-f48.google.com ([209.85.216.48]:38611) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mBNzC-0001w4-HA for 49842@debbugs.gnu.org; Wed, 04 Aug 2021 16:59:35 -0400 Original-Received: by mail-pj1-f48.google.com with SMTP id mz5-20020a17090b3785b0290176ecf64922so10632397pjb.3 for <49842@debbugs.gnu.org>; Wed, 04 Aug 2021 13:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=Z9mmKAB8ccmnqoN2rJwKpJS19dOSLFLGtV1GC5Pq6Io=; b=V9OLjLU84HKcd3TSIWjluueyRaUDkTYpts0cC1DKNIlffWA6ky7v7HdNkDmTwOOl3V JTdFNgFNOlLGHbyFcrCiKq0fwyYjPyKysQ6j4vwRiie5g67LKNEac0SDi+Hg0oaxcDFz JJN6Uvydlivn5Z9djRHsuJPypEnHwiOGJyYa8aflR5TG6THsJ7Q1UdpSEQy+BMk8tQ7u YLLDpDlqMEBDPVZcWxwK0uzH5Iw1P3PhI5t+LFNiiYd4SwTcsH/BtHuUTnNwakaXVj9M Gqyp/1mt+YonHj/G6gr0uCnanum31rZEnGfIVEdW9dxiYaWAt89D8zbADsk7Ju1rx9NR G5RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=Z9mmKAB8ccmnqoN2rJwKpJS19dOSLFLGtV1GC5Pq6Io=; b=J56YwF0Craci6xL/vu2NvD3v1ow8+iRDEddll0O3GJNiGezXsebP4xy2RYBed05tuF KYdy67Cf5Wq8bDZrIvb0s5skLtUPFCIZ4veGE4XjMKManC7YKQE+Osw1fq715+sakfhE hjvuMYUesI4VQG0PNIo77+4bfcOukkIKbHZ9wPP5I3htxcuWl9GcU5PYOf4fCAFHoaqd V0M99yNZUStqq5Devh+0KqL3hDC3xH3UF5zcTVfld8/rfsqFLmwN4E0CMgt4KsnDy2Lq zUUviaC1H/PWJ08GPCcGUgag+kUQLD3CWxseC1WKw3OxnO8i0sJTSwJZmwc7ZL947QLO 118Q== X-Gm-Message-State: AOAM532dWw4VLd7KMHUeowe375W56GuojOSr6Mjz9gWoZEa5PohrhbF5 m7ik6HGJp/KyzyEiD3uayBE= X-Google-Smtp-Source: ABdhPJybmOMpYUI1ziu7GgqzdFxcDx4AFo7bTbnllVluEeX4jt06fk0RWwHxyb/tvfnrZf0JG3643Q== X-Received: by 2002:a17:90b:818:: with SMTP id bk24mr11309839pjb.21.1628110768572; Wed, 04 Aug 2021 13:59:28 -0700 (PDT) Original-Received: from localhost (169-231-132-213.wireless.ucsb.edu. [169.231.132.213]) by smtp.gmail.com with ESMTPSA id p2sm7114461pjz.33.2021.08.04.13.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 13:59:28 -0700 (PDT) In-Reply-To: <874kc5fz13.fsf_-_@gnus.org> 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:211187 Archived-At: 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? Karthik Lars Ingebrigtsen writes: > Karthik Chikmagalur writes: > >> IIRC, the right way to restrict this to the region would be to define >> a variable to hold the bounds of the region as specified by the user >> before starting re-builder and re-search-forward inside those >> bounds. Perhaps a closure that's tied to the specific re-builder >> session can be used to avoid issues with the value of this variable >> when running multiple simultaneous re-builder sessions. > > I'm not very familiar with re-builder.el myself, but I think that sounds > like a promising approach. > > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no