all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Cc: 49842@debbugs.gnu.org
Subject: bug#49842: re-builder restriction to region (lisp/emacs-lisp/re-builder)
Date: Thu, 05 Aug 2021 12:57:58 +0200	[thread overview]
Message-ID: <87a6lwi2fd.fsf@gnus.org> (raw)
In-Reply-To: <87bl6d3p01.fsf@gmail.com> (Karthik Chikmagalur's message of "Wed, 04 Aug 2021 13:59:26 -0700")

Karthik Chikmagalur <karthikchikmagalur@gmail.com> 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





  reply	other threads:[~2021-08-05 10:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03  4:03 bug#49842: re-builder restriction to region (lisp/emacs-lisp/re-builder) Karthik Chikmagalur
2021-08-04  1:28 ` bug#49842: re-builder restriction to region Karthik Chikmagalur
2021-08-04  7:29   ` bug#49842: re-builder restriction to region (lisp/emacs-lisp/re-builder) Lars Ingebrigtsen
2021-08-04 20:59     ` Karthik Chikmagalur
2021-08-05 10:57       ` Lars Ingebrigtsen [this message]
2022-08-22 11:01       ` Lars Ingebrigtsen
2022-09-19 19:22         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6lwi2fd.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=49842@debbugs.gnu.org \
    --cc=karthikchikmagalur@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.