Subject: bug#24923: 25.1; Lisp watchpoints

From: Eli Zaretskii <[email-masked]>
Date: Sun, 13 Nov 2016 17:29:54 +0200

> From: [email-masked]
> Cc: [email-masked]
> Date: Sat, 12 Nov 2016 19:54:01 -0500
> 
> Here is the updated patch, created with -b.  I went with a call to
> `error'.  And actually, I had missed a couple of watchpoint types.

This LGTM, just one comment for when you actually push:

> +  else if (sym->redirect == SYMBOL_LOCALIZED &&
> +           SYMBOL_BLV (sym)->frame_local)

Our coding conventions put the logical operators at the beginning of a
line, not at EOL.

> +static void
> +harmonize_variable_watchers (Lisp_Object alias, Lisp_Object base_variable)
> +{
> +  if (!EQ (base_variable, alias) &&
> +      EQ (base_variable, Findirect_variable (alias)))

Same here.

> +  if (NILP (where) &&
> +      !EQ (operation, Qset_default) && !EQ (operation, Qmakunbound) &&
> +      !NILP (Flocal_variable_if_set_p (symbol, Fcurrent_buffer ())))

And here.

> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -626,6 +626,10 @@ two objects are 'eq' ('eql'), then the result of 'sxhash-eq'
>  consistency with the new functions.  For compatibility, 'sxhash'
>  remains as an alias to 'sxhash-equal'.
>  
> +** New function `add-variable-watcher' can be used to call a function
> +when a symbol's value is changed.  This is used to implement the new
> +debugger command `debug-watch'.
                     ^^^^^^^^^^^
This should follow the renaming.

(Hopefully, this will be followed by a suitable Edebug binding.)

> For the manual, do you think I should document just the debugging
> commands, or should there additionally be a section in the "Variables"
> chapter about the watchpoint mechanism?

Both, I think.

Thanks, I think this is a very important new feature.