From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help 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 Message-ID: References: <87im91ys4m.fsf@web.de> <874kklyqi2.fsf@web.de> <87im90dq2s.fsf@web.de> <87mtyb32ud.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20506"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0 (3d08634) (2020-11-07) Cc: help-gnu-emacs@gnu.org To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 18 12:23:17 2020 Return-path: Envelope-to: geh-help-gnu-emacs@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 1kqDqu-0005DR-R2 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 18 Dec 2020 12:23:16 +0100 Original-Received: from localhost ([::1]:54832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDqt-00038K-PX for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 18 Dec 2020 06:23:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqDor-0001yF-C1 for help-gnu-emacs@gnu.org; Fri, 18 Dec 2020 06:21:09 -0500 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:57577) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqDoo-0000ey-Cx for help-gnu-emacs@gnu.org; Fri, 18 Dec 2020 06:21:08 -0500 Original-Received: from localhost ([::ffff:41.202.241.37]) (AUTH: PLAIN securesender, TLS: TLS1.2,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000001E52B.000000005FDC9099.0000073E; Fri, 18 Dec 2020 04:20:57 -0700 Content-Disposition: inline In-Reply-To: <87mtyb32ud.fsf@web.de> Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126495 Archived-At: * Michael Heerdegen [2020-12-18 12:02]: > Jean Louis 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?