public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Clarify when dont_repeat should be called
@ 2020-03-12 20:44 Christian Biesinger
  2020-04-01 20:03 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Biesinger @ 2020-03-12 20:44 UTC (permalink / raw)
  To: gdb-patches

It is not immediately obvious that Command.dont_repeat should be called
in invoke(), not in __init__. Make this obvious in the documentation.

gdb/doc/ChangeLog:

2020-03-12  Christian Biesinger  <cbiesinger@google.com>

	* python.texi (Commands In Python): Clarify when Command.dont_repeat
	should be called.
---
 gdb/doc/python.texi | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 76cdf7f541..e2bc824357 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -3655,8 +3655,11 @@ not documented.'' is used.
 @defun Command.dont_repeat ()
 By default, a @value{GDBN} command is repeated when the user enters a
 blank line at the command prompt.  A command can suppress this
-behavior by invoking the @code{dont_repeat} method.  This is similar
-to the user command @code{dont-repeat}, see @ref{Define, dont-repeat}.
+behavior by invoking the @code{dont_repeat} method.  Because a command
+can dynamically determine whether it wants to be repeatable, this needs
+to be called inside the command's @code{invoke} method, not in
+@code{__init__}.  This is similar to the user command @code{dont-repeat},
+see @ref{Define, dont-repeat}.
 @end defun
 
 @defun Command.invoke (argument, from_tty)
-- 
2.25.1.481.gfbce0eb801-goog


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

* Re: [PATCH] Clarify when dont_repeat should be called
  2020-03-12 20:44 [PATCH] Clarify when dont_repeat should be called Christian Biesinger
@ 2020-04-01 20:03 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2020-04-01 20:03 UTC (permalink / raw)
  To: Christian Biesinger via Gdb-patches; +Cc: Christian Biesinger, Eli Zaretskii

>>>>> "Christian" == Christian Biesinger via Gdb-patches <gdb-patches@sourceware.org> writes:

Christian> It is not immediately obvious that Command.dont_repeat should be called
Christian> in invoke(), not in __init__. Make this obvious in the documentation.

I didn't see a review of this.
Probably Eli just missed it; CC'ing him.

I think it's worth having.

Tom

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

end of thread, other threads:[~2020-04-01 20:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 20:44 [PATCH] Clarify when dont_repeat should be called Christian Biesinger
2020-04-01 20:03 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).