all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: Arthur Miller <arthur.miller@live.com>
Cc: Jean-Christophe Helary <lists@traduction-libre.org>, emacs-devel@gnu.org
Subject: Re: Emacs development...
Date: Sun, 22 Aug 2021 12:48:28 +1000	[thread overview]
Message-ID: <87tuji41l5.fsf@gmail.com> (raw)
In-Reply-To: <AM9PR09MB4977E814F0F29840E01D7A5796C39@AM9PR09MB4977.eurprd09.prod.outlook.com>


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
want to execute functions or parts of functions outside the context of
the code file. I might just want to verify my understanding of how a
function works, or call it with different arguments or modify something
etc. I'm not suggesting ielm as an alternative, but rather an addition
to the set of tools/techniques used. 

>
>> The main limitation with edebug (with debuggers generally), is that it
>> doesn't really help with understanding the logic and intention of the
>> code. It can help with understanding the 'mechanics' - what gets run
>> when and what gets set to what value at what point etc. However, this
>> rarely helps explain why. You may identify when a variable gets set to
>> the wrong value, but not why it ended up with the wrong value. Knowing
>> when it gets set to the wrong value can be useful, but often, if you
>> really understand the code, you can already see this by just running the
>> steps through mentally. 
> You have a point there, but in many cases people are not really sure
> what value is passed into variable, so they will printf or message in
> elisp, something just to see the value so they can identify which piece
> of code it gets.
>
> In that particular case, I would suggest that debugger is to prefer,
> instead of adding a printf statememnt which will go away in a seconds
> after.

I personally find doing things like that much faster and less hassle
than firing up the debugger, instrumenting functions and stepping
through code.

Everyone will have their own style. I've seen lots of people who depend
heavily on debuggers. I rarely use them for any language. Debugging is
tedious enough without making it worse IMO.

A lot can also depend on the quality of the code. If you have lots of
code which depends on side effects all over the place, then sometimes a
debugger is the only way you can try and track down the problem. On the
other hand, clean functional code which avoids side effects tends to be
easier as you can clearly see where and how things get modified without
having to watch for changes or trace code execution. 

Different languages can also change the equation a bit. I am more likely
to use a debugger when working in C or assembly, but never when working
with CL, Clojure, javascript, elisp etc. I might with Java, but then
again, if I'm forced to do java, I'm already bored and no longer having
fun!

>
> Before I learned to use a debugger it could have being a lot
> of System.out.println statements, to the point I needed to search the
> output in a text editor. It was many years ago when even grep was an
> esoteric command for me :).

All depends on how you use/add those statements. If you find it
necessary to search through heaps of lines of output, I would argue you
are not using the statements judiciously. You add statements where they
are beneficial and remove them as soon as there not. Same with using the
debugger - you don't instrument everything and watch all the variables -
you apply things judiciously and clean up as you go. 



  reply	other threads:[~2021-08-22  2:48 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-21  5:07 Emacs development Jean-Christophe Helary
2021-08-21  6:46 ` Eli Zaretskii
2021-08-21  7:08   ` Jean-Christophe Helary
2021-08-21  7:16     ` Tassilo Horn
2021-08-21  7:50       ` Jean-Christophe Helary
2021-08-21  7:54         ` Tassilo Horn
2021-08-21  8:12           ` Eli Zaretskii
2021-08-21 13:51           ` Arthur Miller
2021-08-21 22:00           ` [External] : " Drew Adams
2021-08-21  8:08         ` Stephen Berman
2021-08-21 12:05         ` Konstantin Kharlamov
2021-08-21 12:28           ` Jean-Christophe Helary
2021-08-21 14:08             ` Tim Cross
2021-08-21 15:00               ` Jean-Christophe Helary
2021-08-21 23:09                 ` Tim Cross
2021-08-22  1:26                   ` Jean-Christophe Helary
2021-08-22  2:25                     ` Tim Cross
2021-08-22  2:15                   ` Arthur Miller
2021-08-22  2:48                     ` Tim Cross [this message]
2021-08-22  7:47                       ` Arthur Miller
2021-08-22  8:11                         ` Tim Cross
2021-08-22 13:54                           ` T.V Raman
2021-08-22 16:04                             ` Eric Abrahamsen
2021-08-22 16:19                               ` Jean-Christophe Helary
2021-08-22 16:23                                 ` Eric Abrahamsen
2021-08-22 16:25                                 ` Arthur Miller
2021-08-22 16:43                                   ` Jean-Christophe Helary
2021-08-22 16:29                               ` Arthur Miller
2021-08-22 17:08                               ` T.V Raman
2021-08-22 17:44                                 ` Arthur Miller
2021-08-22 18:34                                   ` Stephen Berman
2021-08-22 23:12                                     ` Arthur Miller
2021-08-23  9:17                                       ` Arthur Miller
2021-08-22 14:41                           ` Arthur Miller
2021-08-21 14:07           ` Arthur Miller
2021-08-21  8:10     ` Eli Zaretskii
2021-08-21  8:36 ` Alfred M. Szmidt
  -- strict thread matches above, loose matches on Subject: below --
2015-02-21  2:36 Sam Auciello
2015-02-21  3:52 ` Alexis
2015-02-21  8:56   ` Eli Zaretskii
2015-02-21 10:07   ` Adam Sjøgren
2015-02-21 11:28     ` Eric Abrahamsen
2015-02-21 11:44       ` Eli Zaretskii
2015-02-21 12:24         ` Thien-Thi Nguyen
2015-02-21 12:27           ` Eli Zaretskii
2015-02-21 14:22             ` Thien-Thi Nguyen
2015-02-21 18:43               ` Eli Zaretskii
2015-02-22 17:17                 ` Thien-Thi Nguyen
2015-02-21 12:45         ` Eric Abrahamsen
2015-02-24 10:58     ` Filipp Gunbin

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=87tuji41l5.fsf@gmail.com \
    --to=theophilusx@gmail.com \
    --cc=arthur.miller@live.com \
    --cc=emacs-devel@gnu.org \
    --cc=lists@traduction-libre.org \
    /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.