From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eduardo Ochs Newsgroups: gmane.emacs.devel Subject: Re: Proposing elisp-eval-target for eval-last-sexp and related commands Date: Tue, 17 Aug 2021 14:30:26 -0300 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000d622d505c9c4acd4" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19689"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs developers To: Psionic K Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 17 19:31:53 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mG2wJ-0004n3-N4 for ged-emacs-devel@m.gmane-mx.org; Tue, 17 Aug 2021 19:31:51 +0200 Original-Received: from localhost ([::1]:47092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mG2wI-0005sc-8H for ged-emacs-devel@m.gmane-mx.org; Tue, 17 Aug 2021 13:31:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mG2vD-00052F-3w for emacs-devel@gnu.org; Tue, 17 Aug 2021 13:30:43 -0400 Original-Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:56235) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mG2v7-0001K5-1W for emacs-devel@gnu.org; Tue, 17 Aug 2021 13:30:42 -0400 Original-Received: by mail-pj1-x1035.google.com with SMTP id mq3so182907pjb.5 for ; Tue, 17 Aug 2021 10:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gKbsIrl0mX/6eqX5j4E+S2s1AbU6JjQZ6f1LQNF2f7w=; b=tvTQxCH5TvZnfUKvJiLr/LnEZAOaWX8I6BwoFWxs+VqX/KMfPzlhcCvbeDT3qHp7uo 98T9L8DEGFu4O0Y1Umoa/3XkX38+gbdu4Zm2+4JJ0Zg5HiVfiREeypf+6L4HNQY8m5+q Q1ldAxomnia3uVIs2sfScITIJXySfZVtyWY/KQUs+cDu5WLUY7NN2K9SQfgHqMstlAgB A57sZ9UaATY6fdsYYzKsz/KtcMv4oDJPYIJVZRz2QX+GEsndrpXpKVph9SxAr8JismP9 T/9Bcj0MdOax1h1Q4Y8l31A9yoyxwnut2jV3g/tx3+c6rcYfFxuLZQNnIcuTRqONT29+ WNeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gKbsIrl0mX/6eqX5j4E+S2s1AbU6JjQZ6f1LQNF2f7w=; b=gbPYt7mUKWgLZ0heB0CxWxY+4fUlKY7gULMYJ0npsxx/ETz2mP52JnJ1i8uIfzBBZf eFms3+FLmjbQ4AhweVvfdRtfBiFC+pc0qeyogZLyse6c3R/7AAxs009Rrlr6KTracuc3 Iry6itXqPql6qWxTd2dT1DbmVbF9lmT2J4zpk74jm0IJCsgfGUv+X1vs1elZf2tl+qDs qfTbI/JClnF/95taEH02xPrFjZGNkT7zwkZgOQGwPVPVmw0aAisUB3vGGIVkkATdJokM orqCW8io1UdjgTurFpjmrB3OYwr5YGs0uWtwrf79RDMoOh4Ipb+oRQydviw5XmQ3acCl UqtQ== X-Gm-Message-State: AOAM53264VzbcUyeWVQnl8CMGVun3wxshBRMuOqBrgoAgk7eJsWbWUPj hRFXw/AfBM91HerZ0DFGoJ/FqqD4fM7+zBw6dn4= X-Google-Smtp-Source: ABdhPJwGEgkcGvlOTU+NzK/Uk5AvX+Sqne7emxv1t+kOnBT4z6DFtt0mOhyimdybrAT/3SmcL2NKypUoqNLGALh/5Ns= X-Received: by 2002:a17:90b:370d:: with SMTP id mg13mr3341855pjb.117.1629221434039; Tue, 17 Aug 2021 10:30:34 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=eduardoochs@gmail.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:272506 Archived-At: --000000000000d622d505c9c4acd4 Content-Type: text/plain; charset="UTF-8" Have you considered the possibility of implementing a _variant_ of eval-last-sexp that does what you want? That's what I do in eev... take a look at the section "0. How to use this" of this tutorial: http://angg.twu.net/eev-intros/find-lexical-intro.html Cheers, Eduardo Ochs http://angg.twu.net/#eev On Tue, 17 Aug 2021, 13:41 Psionic K, wrote: > Proposing to patch the eslip module so that if a buffer-local > `elisp-eval-target` has been set, `eval-last-sexp` and similar commands > will execute lisp in the context of another buffer. > > The use case is when developing elisp to operate on non-elisp buffers, > interacting with functionality for other languages such as when using LSP. > > This change would bring buffer-based development in line with ielm's > `ielm-change-working-buffer` behavior. > > While the `eval-last-sexp` commands are very ergonomic, there is no way to > direct them at another buffer without wrapping the last sexp in > `with-current-buffer`. Advising deep into `eval-last-sexp` is difficult > because we must call `set-buffer` after computing the elisp we want to > evaluate. > > With this support available, the users can then update the buffer local in > shortcut commands for buffer-based development of elisp for other modes. > > I intend to develop a patch. The main difficulty I can identify so far is > setting the buffer at the correct points so that the setup for evaluation > continues to occur in the correct context. > > -- > Psionic K > Software Engineer > > *Positron Solutions * > --000000000000d622d505c9c4acd4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Have you considered the possibility of implementing a _va= riant_ of eval-last-sexp that does what you want? That's what I do in e= ev... take a look at the section "0. How to use this" of this tut= orial:

=C2=A0 Cheers,
=
=C2=A0 =C2=A0 Eduardo Ochs
=C2=A0 = =C2=A0 http://angg.twu.net/#eev



On Tue, 17 Aug 2= 021, 13:41 Psionic K, <psionik@positron.solutions> wrote:
Proposing to patch the e= slip module so that if a buffer-local `elisp-eval-target` has been set, `ev= al-last-sexp` and similar commands will execute lisp in the context of anot= her buffer.

The use case is when developing elisp to operate on non-= elisp buffers,=20 interacting with functionality for other languages such as when using=20 LSP.

This change would bring buffer-based development in = line with ielm's `ielm-change-working-buffer` behavior.

While the `eval-last-sexp` commands are very ergonomic, there is no way = to direct them at another buffer without wrapping the last sexp in `with-cu= rrent-buffer`.=C2=A0 Advising deep into `eval-last-sexp` is difficult becau= se we must call `set-buffer` after computing the elisp we want to evaluate.=

With this support available, the users can then update t= he buffer local in shortcut commands for buffer-based development of elisp = for other modes.

I intend to develop a patch.=C2=A0 The main difficu= lty I can identify so=20 far is setting the buffer at the correct points so that the setup for=20 evaluation continues to occur in the correct context.

--=
<= div>= Software Engineer
--000000000000d622d505c9c4acd4--