all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Tip: Debugging with function `message-box'
@ 2021-06-24 15:53 Jean Louis
  2021-06-24 18:49 ` [External] : " Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Jean Louis @ 2021-06-24 15:53 UTC (permalink / raw)
  To: Help GNU Emacs

I find it often easier to debug values of some variables by using the
function `message-box' instead of just `message':

(message-box "%s" "Hello")

Unlike the function `message' this one blocks the execution for a
while, or until confirmed. This is useful in various debugging
processes.

Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [External] : Tip: Debugging with function `message-box'
  2021-06-24 15:53 Tip: Debugging with function `message-box' Jean Louis
@ 2021-06-24 18:49 ` Drew Adams
  2021-06-24 19:31   ` Jean Louis
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2021-06-24 18:49 UTC (permalink / raw)
  To: Jean Louis, Help GNU Emacs

> I find it often easier to debug values of some variables by using the
> function `message-box' instead of just `message':
> 
> (message-box "%s" "Hello")
> 
> Unlike the function `message' this one blocks the execution for a
> while, or until confirmed. This is useful in various debugging
> processes.

Sure.  Some alternatives, just for info:

To just pause so you can see the message (which gets
logged to `*Messages*' anyway), you can use `sit-for'
or `sleep-for'.  E.g. `(message "...")(sleep-for 2)'.

To block until confirmed, you can use `(debug)'.
(`c' to just confirm.)  And `(debug nil <whatever>)'
prints the <whatever> at the top of the debugger
(like a message).



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [External] : Tip: Debugging with function `message-box'
  2021-06-24 18:49 ` [External] : " Drew Adams
@ 2021-06-24 19:31   ` Jean Louis
  2021-06-24 20:19     ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Jean Louis @ 2021-06-24 19:31 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help GNU Emacs

* Drew Adams <drew.adams@oracle.com> [2021-06-24 21:50]:
> > I find it often easier to debug values of some variables by using the
> > function `message-box' instead of just `message':
> > 
> > (message-box "%s" "Hello")
> > 
> > Unlike the function `message' this one blocks the execution for a
> > while, or until confirmed. This is useful in various debugging
> > processes.
> 
> Sure.  Some alternatives, just for info:
> 
> To just pause so you can see the message (which gets
> logged to `*Messages*' anyway), you can use `sit-for'
> or `sleep-for'.  E.g. `(message "...")(sleep-for 2)'.
> 
> To block until confirmed, you can use `(debug)'.
> (`c' to just confirm.)  And `(debug nil <whatever>)'
> prints the <whatever> at the top of the debugger
> (like a message).

Good tips.

When there is something wrong I am also using C-u C-M-x to instrument
the function then I can go step by step verifying what is happening.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [External] : Tip: Debugging with function `message-box'
  2021-06-24 19:31   ` Jean Louis
@ 2021-06-24 20:19     ` Drew Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2021-06-24 20:19 UTC (permalink / raw)
  To: Jean Louis; +Cc: Help GNU Emacs

> When there is something wrong I am also using C-u C-M-x to instrument
> the function then I can go step by step verifying what is happening.

1. That's `edebug', one of the Lisp debuggers for Emacs.

https://www.gnu.org/software/emacs/manual/html_node/elisp/Edebug.html

2. Plain `debug' is another Lisp debugger for Emacs.

https://www.gnu.org/software/emacs/manual/html_node/elisp/Debugger.html

 * `debug-on-entry' to debug on entry to a function,
   including a built-in (coded in C).  (And some C
   code calls Lisp functions.)

 * Non-nil `debug-on-error', to just see a backtrace.

 * Place calls to `debug' in code as breakpoints,
   i.e., places where the debugger is entered.

3. GUD is another debugger you can use with Emacs.

https://www.gnu.org/software/emacs/manual/html_node/emacs/Debuggers.html
____

They all let you go step by step.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-24 20:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-24 15:53 Tip: Debugging with function `message-box' Jean Louis
2021-06-24 18:49 ` [External] : " Drew Adams
2021-06-24 19:31   ` Jean Louis
2021-06-24 20:19     ` Drew Adams

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.