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

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

Re: Making ielm behave like a shell (getting to previous commands using


From: Jean Louis
Subject: Re: Making ielm behave like a shell (getting to previous commands using the up-arrow key)
Date: Fri, 18 Dec 2020 14:19:40 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Michael Heerdegen <michael_heerdegen@web.de> [2020-12-18 12:02]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > That is how I learned it, instruction was somewhere on how to debug
> > and I used to do it much in Common Lisp that way.
> 
> I must admit that I did not exhaustively understand how you proceed
> because the code examples you had posted are broken (let binding syntax
> broken).
> 
> > When you have
> >
> > (let ((some 1)
> >       (more 2))
> >
> > How do you go about debugging such function?
> 
> Sometimes I insert `message' calls or something more sophisticated to
> output values.  That's the simplest tool.

I will discard the rest of your message to understand one part
first. How do you insert message calls? Give me some example.

For me and in my programming somebody from scheme programming,
probably in Guile teached me that I should be making smaller functions
where each function does something and outputs something. And I that
gave me impression of being very simple. But then in Emacs packages I
too often find long and incomprehensible functions that do not follow
the style I have learned before some years.

>From all functions I have rarely there is need to have a long
function. But when I do have longer function then the problem is often
to find out which check or variable changes properly and what is going
on. And in Common Lisp explanations on how to debug programs I have
adopted `setq' style. 

First step:

(let* ((mailing-hash (rcd-db-table-id-hash "mailinglistoptions" option *cf*))
       (mid (gethash 'mailinglistoptions_accounts mailing-hash))
       (mid-hash (rcd-db-table-id-hash "accounts" mid *cf*))
       (accounts-hash (rcd-db-table-id-hash "accounts" mid *cf*))
       (email-list (rcd-email-list mid)))
       )

Second step:

(let* ((setq mailing-hash (rcd-db-table-id-hash "mailinglistoptions" option 
*cf*))
       (mid (gethash 'mailinglistoptions_accounts mailing-hash))
       (mid-hash (rcd-db-table-id-hash "accounts" mid *cf*))
       (accounts-hash (rcd-db-table-id-hash "accounts" mid *cf*))
       (email-list (rcd-email-list mid)))
       )

Third step:

(let* ((mailing-hash (rcd-db-table-id-hash "mailinglistoptions" option *cf*))
       (setq mid (gethash 'mailinglistoptions_accounts mailing-hash))
       (mid-hash (rcd-db-table-id-hash "accounts" mid *cf*))
       (accounts-hash (rcd-db-table-id-hash "accounts" mid *cf*))
       (email-list (rcd-email-list mid)))
       )

Fourth step:

(let* ((mailing-hash (rcd-db-table-id-hash "mailinglistoptions" option *cf*))
       (mid (gethash 'mailinglistoptions_accounts mailing-hash))
       (setq mid-hash (rcd-db-table-id-hash "accounts" mid *cf*))
       (accounts-hash (rcd-db-table-id-hash "accounts" mid *cf*))
       (email-list (rcd-email-list mid)))
       )

That is how I would be going step by step. But now I will change it to
`setq-local' instead of `setq'

How would you do message calls there?







reply via email to

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