[Top][All Lists]

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

Re: How to debug modification to a variable value?

From: Davis Herring
Subject: Re: How to debug modification to a variable value?
Date: Mon, 25 Jan 2010 14:30:45 -0800 (PST)
User-agent: SquirrelMail/1.4.8-5.7.lanl7

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

There's a difference between "gone" and "set to nil", even for
automatically-buffer-local variables.  Does it still have a buffer-local
value (which is wrong), or is it using the default (again)?  C-h v will

> 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?

Destructive operations on lists can't set the value of a variable to nil,
nor can they invoke `kill-local-variable'.  `set[qf]?' is of course
destructive, as are `kill-local-variable' and `kill-all-local-variables';
have you looked for all of those?

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

I don't that you can do this in the Emacs debugger, but you should be able
to use a watchpoint in gdb for this purpose.  Find where the buffer-local
value of the variable is stored, set the watchpoint, and then save.

Meanwhile, my psychic powers suggest that you have a `let' binding of the
variable in question and switch buffers within the `let', or else that
something is reasserting your major mode so that
`kill-all-local-variables' is getting called.  You could test for the
latter with the `permanent-local' property.


PS - Sorry if some of these instructions are obvious; I don't know just
what you know!

This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during

reply via email to

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