unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How to debug modification to a variable value?
@ 2010-01-25 20:52 Tassilo Horn
  2010-01-25 21:08 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Tassilo Horn @ 2010-01-25 20:52 UTC (permalink / raw)
  To: emacs-devel

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




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

end of thread, other threads:[~2010-01-27 15:42 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-25 20:52 How to debug modification to a variable value? Tassilo Horn
2010-01-25 21:08 ` Drew Adams
2010-01-26  8:00   ` Tassilo Horn
2010-01-26 15:17     ` Stefan Monnier
2010-01-26 16:49       ` Richard Stallman
2010-01-26 21:02         ` Stefan Monnier
2010-01-26 18:02       ` alin.s
2010-01-27  7:37     ` Andreas Roehler
2010-01-27  8:24       ` Tassilo Horn
2010-01-27  8:51         ` Andreas Roehler
2010-01-25 22:30 ` Davis Herring
2010-01-26  8:43   ` Tassilo Horn
2010-01-26 21:04     ` Davis Herring
2010-01-27  7:50       ` Tassilo Horn
2010-01-27 15:42         ` Davis Herring
2010-01-26 15:52 ` alin.s
2010-01-26 20:26   ` Tassilo Horn
2010-01-27  8:13     ` alin.s

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