unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Phil Sainty <psainty@orcon.net.nz>
To: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: Katsumi Yamaoka <yamaoka@jpl.org>, 38173@debbugs.gnu.org
Subject: bug#38173: describe-variable: Also tell user *where* variable was changed
Date: Wed, 13 Nov 2019 12:10:37 +1300	[thread overview]
Message-ID: <9a2ece93c5474cdd68e6f7253408dba8@webmail.orcon.net.nz> (raw)
In-Reply-To: <878solyfr2.8.fsf@jidanni.org>

On 2019-11-12 15:45, 積丹尼 Dan Jacobson wrote:
> It's like telling users "you transferred $123 from your bank
> account" but not telling users who they transferred it to.

That's pretty crucial information for a bank transfer.  Not so much
for every arbitrary variable change (and I think you'd need to be
making an incredible number of bank transactions for the analogy to
hold up :)

Logging every change of every variable made during the execution of a
computer program might carry a noticeable cost, vs the absolutely
tiny number of cases where the logged information would ever be
inspected, so it's not obvious that this would be worthwhile on the
whole?

However, since 26.1 you can do this yourself on a case-by-case basis
when you wish to investigate some particular situation. See: C-h f
add-variable-watcher and remove-variable-watcher, and commands M-x
[cancel-]debug-on-variable-change

Some extremely basic logging without invoking the debugger might be
something like:

     (defun var-watcher-backtrace (symbol newval operation where)
       "Used with `add-variable-watcher' to log details to *Messages*."
       (let ((frames (backtrace-frames)))
         (message "%S %S %S %S %S" symbol newval operation where
                  (pp-to-string frames))))

     (add-variable-watcher 'foo 'var-watcher-backtrace)


I suppose the variable watcher mechanism could check another variable
to decide whether to do the sort of "global watching" being requested
here.  Then users could turn the behaviour on if desired.


-Phil






  reply	other threads:[~2019-11-12 23:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12  1:14 bug#38173: describe-variable: Also tell user *where* variable was changed 積丹尼 Dan Jacobson
2019-11-12  2:28 ` Katsumi Yamaoka
2019-11-12  2:45   ` 積丹尼 Dan Jacobson
2019-11-12 23:10     ` Phil Sainty [this message]
2019-11-12 23:28       ` 積丹尼 Dan Jacobson
2019-11-13  9:19         ` Phil Sainty
2019-11-13 15:06           ` 積丹尼 Dan Jacobson
2019-11-13 22:56             ` Phil Sainty
2019-11-14  6:27               ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a2ece93c5474cdd68e6f7253408dba8@webmail.orcon.net.nz \
    --to=psainty@orcon.net.nz \
    --cc=38173@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    --cc=yamaoka@jpl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).