emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs development...


From: Arthur Miller
Subject: Re: Emacs development...
Date: Sun, 22 Aug 2021 16:41:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Tim Cross <theophilusx@gmail.com> writes:

> 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. 
Isn't that what a repl is too? You type a form and press enter to get it
evaled in ielm. That is similar to eval-last-sexp, it is just that as
you say, one press <enter> instead of C-x C-e. I think both are
interfaces into emacs command loop, which is the real repl going on. I
don't know, I experience M-: as a hidden repl which is out of my way
until I needed while ielm asks me to have that repl open all the time in
a buffer. I don't say you are wrong, I just never really got into why I
should use ielm, and many are praising it, so I have a feel I am missing
something good :). 

>                          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.
But  you can do all that with M-:. It remembers history, you can go back
and forth and so. Results and printed forms, are echoed in the
minibuffer, and I usually open messages buffer.

There might you have the point: you don't need messages buffer with
ielm. Ielm displays everything in same buffer. I am so used to messages
buffer that I don't even thing of it. I have it almost always open. But
I don't switch to it, it is scrolling itself, and it is just "read only"
for me to see results from 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.

We all have personal workflow, I am not sure that one would be for me. I
have those few shortcuts I posted in some comment before. I type in .el
file and than I can eval any form, from entire defun to just variable
directly with a shortcut. I understand appeal with a freshly written
defun, and than when you press enter, you are ready to type some test to
test how it works, while I have to hit M-: first to test it. But can you
easily change defun, say you need to fix a typo in the middle of a
defun? How do you do that in ielm? Can you just go back in buffer and
retupe and re-eval? I never tried to be honest. I am so used that I can
move freely in .el buffer, and when I type M-: and it finishes, my
corsor is back at same spot so I can fix typos, change defun etc. I
don't even need to jump to the end of defun to test it again. Is it one
of those things thay call trade offs? Both have trade off, and it's
personal preferance which one to go for?

Sorry, I dont' mean to compete, I am just really curious myself. I
dislike constant switching between buffers, contexts and so. I would
just like to type code as I type prosa. I even dislike special
characters like #$[] and such since they are not as easy to type on the
keyboard. I like to use macros so I don't need to quote stuff :-).

> 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. 
Yes, that is me too. Regardless of a language. I prefer to write small
piece of code, small units. I would usually start by defining a function
and return points so I can compile it and run, than I would add a pice
of logic, like maybe a loop, or call to something else and compile
again, if possible run and so on. Unfortuantely does not scale well in
big code bases, complex guis and so. Not even when working with Emacs
C sorces, at least I didn't found a good way. But it works fine for
elisp.

> 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).
I am not sure I follow about that "with the context I created", why not
just execute it in the context itself, why sending everything somewhere
else? Maybe I am missing something there. But I am really intersted to
hear bout which functionality more?

> 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. 
Yes of course, I completely agree there. Seems lilke I have centered my
workflow around different tools and am little lazy to explore other
tools. That is why I ask you, since you seem to be using ielm :-). I am
very thankful for thorough explanations. Kind of you to explain it so
detailed.

> 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
> do. 
I find myself pressing lots of C-x and C-z, so I lately have being
thinking of how to lessen typing, and I think I like the idea used in
Vi, of having a "command mode" as normal and insert mode as editing
mode. But I have tried evil, and I can't really get that with 5
different modes and so. I also experienced some slugishness after evil
was on for a while. Maybe just mine config and me not being experienced
with evil. No Doom or Spacemacs here, just plain evil mode
installed. But I do like the idea with repeaters. I had thought for a
couple of monts to build a mode where I can press a key and have it
"sticky" until I turn it off. I think it is similar to idea of
mode. Someone on Reddit published yesterday a mode for just that, so
I don't need to build it myself now :-).



reply via email to

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