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 22:53:59 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Drew Adams <drew.adams@oracle.com> [2020-12-18 22:12]:
> > Programs do not run with `setq'
> > there, it is inserted temporary to assign some variables step by step
> > until I find what is wrong.
> 
> I see.  I misunderstood.  So you are not evaluating
> the `let*' as written.  You are evaluating individual
> `setq' sexps you added to it.
> 
> > > (_IGNORED  (setq fred  'nope-24))
> > 
> > I have seen it works with _ alone
> 
> Yes, of course.  I want to make it obvious to myself.
> 
> It "works" with any symbol whatsoever, no need for
> "_" - that's just an informal convention.  It's all
> about communicating to human readers (e.g. yourself).

I guess that _ will then not complain when byte compiled as unused
variable or similar.

> > How do you debug? You use edebug-defun?
> 
> I use `debug', not `edebug'.  But many people use
> `edebug'.  I use `debug-on-entry', `debug-on-error',
> and explicit calls to `debug' inserted as breakpoints.

> For the latter, `(debug nil SOME-SEXP)' evaluates
> SOME-SEXP in the debugging context, and prints it
> at the top of the debugger when it's entered.  So
> it acts like an extra call to `message' (more
> precisely, it does an implicit `e').

OK I find `message' example and I see it is not necessary as I anyway
evaluate with one key in my rudimentary method. It uses message
basically.

(defun eval-with-setq-sexp ()
  (interactive)
  (let* ((sexp (thing-at-point 'list))
         (end (length sexp))
         (_ (set-text-properties 0 end nil sexp))
         (sexp (replace-regexp-in-string "^(" "(setq-local " sexp)))
  (message "%s" (eval (car (read-from-string sexp))))))

If I move cursor to sexp above, it will assign the rest of the form to
variable `sexp' and there will be no change of the code.

I can see in minibuffer: (sexp (thing-at-point 'list)) but then I have
not used `message'. I do use message and I open separate buffer for my
particular messages when program is running that I can see if there is
some problem overall. Sometimes program finds comma , in the name and
cannot send it as email. Messages come there handy. For that I use
this function to add to special buffer my private messages and not to
mix it with Emacs messages.

(defun rcd-mailing-message (s)
  (let ((buffer "*RCD Mailings Messages and Errors*")
        (current (current-buffer)))
    (get-buffer-create buffer)
    (switch-to-buffer buffer)
    (goto-char (point-max))
    (insert (concat (prin1-to-string s) "\n"))
    (switch-to-buffer current)))

>From there I understand it. Basically I do the same but I was
referring to individual line debugging of let form rather than
debugging in continual run of the program. I got it now what you
mean in regards to `message'.




reply via email to

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