emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to debug modification to a variable value?


From: Tassilo Horn
Subject: How to debug modification to a variable value?
Date: Mon, 25 Jan 2010 21:52:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)

Hi all,

today I had some strange problems with a major mode we use at my
institute, and that I created and maintain.  This mode defines some
buffer-local variable:

--8<---------------cut here---------------start------------->8---
(defvar tg-schema-alist nil
  "The schema of the current TG file.")
(make-variable-buffer-local 'tg-schema-alist)
--8<---------------cut here---------------end--------------->8---

This variable is set once, when a new graph is loaded (whatever that
means, but there is only one function that setqs the variable).

Also, there's a function, which refreshes some font-locking stuff when
saving.  This function is added to `after-save-hook' locally.

--8<---------------cut here---------------start------------->8---
after-save-hook is a variable defined in `files.el'.
Its value is 
(t greql-set-fontlock-types-regex)

Local in buffer method-calls-per-activity.greql; global value is nil
--8<---------------cut here---------------end--------------->8---

Now, my problem was that under some circumstances after saving, the
buffer-local value of `tg-schema-alist' was gone, i.e. set to nil.

I double-checked `greql-set-fontlock-types-regex' that it doesn't modify
`tg-schema-alist', and it doesn't.  I also removed all destructive
function calls in there, although it operates only on a list created by
`mapcar', and that's a copy anyway, right?

Till now, I couldn't reproduce this behavior.  After restarting emacs,
the problem was gone first.  Suddenly, it appeared again.  Maybe it has
something to do with using the same buffer in many frames (tty and X),
but I cannot tell for sure...

So what I need is some way to be put in the debugger when the value of
`tg-schema-alist' is modified.  Is that feasible?  I tried adding an
after advice to `setq' which does exactly that, but that screwed my
emacs instance.  I guess it's no good idea to advice such primitives...

Bye,
Tassilo




reply via email to

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