bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#49842: re-builder restriction to region (lisp/emacs-lisp/re-builder)


From: Lars Ingebrigtsen
Subject: bug#49842: re-builder restriction to region (lisp/emacs-lisp/re-builder)
Date: Thu, 05 Aug 2021 12:57:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]