[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: |
Tassilo Horn |
Subject: |
Re: How to debug modification to a variable value? |
Date: |
Wed, 27 Jan 2010 08:50:46 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux) |
"Davis Herring" <address@hidden> writes:
Hi Davis,
>> So tg-mode contains
>> [...]
>> and in greql-mode (which requires tg-mode), there is the only function
>> modifying the value of `tg-schema-alist' by assigning the buffer-local
>> value of a temporary buffer to the buffer-local value in the query
>> buffer.
>
> Aha! Now we can ignore most of what I've written so far (except perhaps
> for reference for future bugs).
>
> `tg-init-schema' also sets `tg-schema-alist', of course; that's how
> `greql-set-graph' gets it. And I see that `tg-eldoc-init' adds that
> function to `after-save-hook' (globally!),
Indeed, that's wrong. Now it's only added to `after-save-hook' locally.
> and that `tg-initialize' adds -that- to `eldoc-mode-hook' (globally!),
> and that `tg-mode' calls -that-.
No, `tg-eldoc-init' is added locally, but I guess you mean that as a
result, `tg-init-schema' ends up globally in `after-save-hook' as soon
as `eldoc-mode-hook' was run, and you are right.
> While greql-mode.el never actually invokes `tg-mode' for you, I suspect
> that at some point your Emacs did run `tg-mode', which called
> `tg-initialize', which registered `tg-eldoc-init', which got called
> (perhaps in some other buffer) by `eldoc-mode' and registered
> `tg-init-schema', which got called by `basic-save-buffer' in your GReQL
> buffer. This non-local, delayed effect probably does look a lot like
> magic and probably does only happen in some Emacs sessions.
>
> Am I right?
Absolutely. How much time did you spend on that, and how did you debug
it? Using a watchpoint in gdb as you suggested? While I clearly see
that the global `add-hook' is plain wrong, I wouldn't have found it by
looking carefully at the code.
Thanks a lot, I evaled
(cons "Davis Herring" list-of-extremely-helpful-guys).
Bye,
Tassilo
Re: How to debug modification to a variable value?, Davis Herring, 2010/01/25
Re: How to debug modification to a variable value?, alin.s, 2010/01/26