[Top][All Lists]

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

Re: Emacs development...

From: Tim Cross
Subject: Re: Emacs development...
Date: Sun, 22 Aug 2021 18:11:48 +1000
User-agent: mu4e 1.6.4; emacs 27.2.50

Arthur Miller <arthur.miller@live.com> writes:

> Tim Cross <theophilusx@gmail.com> writes:
>> Arthur Miller <arthur.miller@live.com> writes:
>>> Tim Cross <theophilusx@gmail.com> writes:
>>>> Jean-Christophe Helary <lists@traduction-libre.org> writes:
>>>>>> On Aug 21, 2021, at 23:08, Tim Cross <theophilusx@gmail.com> wrote:
>>>>>> I would also recommend getting comfortable with ielm (M-x ielm), an
>>>>>> Interactive Emacs Lisp Mode, as well as learning how to evaluate
>>>>>> expressions in the source buffer. 
>>>>> Thank you Tim for the suggestion. I like ielm a lot, when I use it.
>>>>> What I am trying to do now is fix a bug in package.el and I don't see how 
>>>>> I can
>>>>> use ielm for that. Do you have suggestions ?
>>>> The relevance of ielm is that it is a powerful and useful tool you have
>>>> at hand when doing development or bug fixing in elisp. It provides the
>>>> REPL where you can test/evaluate bits of code. How useful it is for a
>>>> specific issue will depend on that issue. 
>>> What does ielm offer over M-: (eval-expression)? I use a lot M-: so I am
>>> interested to know if I can improve on my workflow. 
>> Evaluating sexp in the code is very valuable. However, sometimes, I just
> What do you mean in the code? Like C-x C-e?
> M-: opens a repl, similar to ielm. It places cursor in minibuffer and
> lets me eval a function with any arguments and so. Ielm asks me to keep
> a prompt open in another buffer. So I have to switch to and from that
> buffer, so I never really appreciate it. So I wonder if ielm has
> something more to offer, than what I get from M-:?

M-: isn't what I would call a REPL. It just provides a way to evaluate a
lisp expression which you can enter in the echo area. It is similar to
eval-last-sexp (C-x C-e), except as you say, you can specify the arguments.

Where ielm differs is that it is more like a proper REPL - it adds the
'L' (loop) which you don't have with M-:, which is really just the REP
(read, eval print) part. With ielm you can enter multiple statements, go back
through history and edit/modify an expression and re-evaluate it. Define
a new function and then call it, set a variable and then see its printed
form by just typing it at the prompt etc. I also find it a lot easier
when entering more complex expressions than just using the minibuffer
with M-:.

When I'm writing new eilsp, I will often open a new *.el file and a ielm
buffer. I might write the first pass of a function in ielm, run it with
different arguments until it works as desired and then copy it back to
the *.el file to save it.

I don't find it an issue to switch buffers - this is what I'm doing all
the time. I have a frame with multiple tabs and each tab might have
multiple windows and I will jump around between them constantly. It only
takes one or two key strokes, so I find it no more hassle than M-:.

Being able to edit more complex expressions and move up/down through the
history is extremely useful. However, I also really enjoy interactive
development and exploration. I hate writing a whole heap of code and
then having to spend hours debugging it. I prefer to write small
functions and build them up bit by bit, running and testing them as I
go. For this, ielm is a key tool. 

What would be even better is the ability to send code from the buffer to
be evaluated in the ielm buffer. I think Stefan posted something about
this recently. This could make it easier to execute expressions within a
context you have created and provide some additional functionality which
isn't easily done now (though of course, being Emacs, you can set it up).

To what extent you would find ielm useful really depends on personal taste
and style when it comes to development and/or debugging. This is both
the power and weakness of Emacs. It is powerful because you can create
the workflow which is more natural and customised to individual tastes.
It is a weakness because 'out of the box', things are very vanilla and
it can take time to learn what is possible and configure it. To be
honest, my current emacs lisp environment is nowhere as refined and
configured as it once was. Back when I was doing more elisp, things were
heavily customised with many advanced features enabled, custom key
bindings, additional functions, advice etc etc. However, I rarely find
it necessary to do much elisp these days. I've even stopped maintaining
my own emacs configuration and now just use spacemacs - I have always
liked VI's modal editing style and I find spacemacs mostly works really
well. I have some fairly minor tweaks and customisation, but on the
whole, I just leave it alone and get on with the other stuff I need to

reply via email to

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